필터 지우기
필터 지우기

Plot and animate a 3D Dice Image

조회 수: 4 (최근 30일)
Alex Burton
Alex Burton 2015년 4월 13일
편집: pfb 2015년 4월 13일
I am building a simple dice simulator. User inputs #of sides, dice, rolls, and a random number generator (randi()) outputs a value or values.
Part of the requirement of the program is that there needs to be some sort of visualization. I know it is possible to plot a 3d cube/pyramid/etc, but is there any way to plot the shape with the resulting number from the generator printed on the side? If that is possible, is there any way to give the object a simple animation, like make it spin a few times before stopping and showing the value?
I know this is a long shot, but any advice you can provide would be extremely appreciated.
Thanks!

답변 (1개)

pfb
pfb 2015년 4월 13일
편집: pfb 2015년 4월 13일
perhaps placing dots (circles) instead of numbers on the faces of the dice is easier, at least for a traditional cubic dice. That would work also for a tetrahedron (even less dots). But if you plan a dice with many faces that becomes unpractical, readability-wise. Hard to tell apart 23 dots from 21.
I'd prepare the data for the faces of the dices and the relevant dots to be rendered using fill3. Then you can rotate them to build an animation.
Or else, you could rotate the point of view (setting the axes off).

카테고리

Help CenterFile Exchange에서 Animation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by