How to Plot A 3D Ring of any given shape?
9 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Sushmitha Kudari
le 22 Fév 2020
Commenté : Walter Roberson
le 23 Fév 2020
Say for example I have a 2D matrix that makes a simple shape like a star, rectangle or circle. How can I take this 2D shape and turn it into a 3D ring? If it was a star, a star shaped ring, if its a square, a square shaped ring and so on...
2 commentaires
Jacob Wood
le 23 Fév 2020
Would you like to extrude your 2D shape into a 3D shape? And what is the intended result? A plot of this object or just a matrix description?
Réponse acceptée
Walter Roberson
le 23 Fév 2020
Create a reference set of vertices centered around 0, 0, and a description of faces joining them. I suggest using something compatible with patch()
Now translate the reference point out to what would correspond to angle 0 in the ring.
Now iterate.
Use makehgtform to create a transform matrix that would describe rotating (relative to the origin) by the appropriate angle for this iteration.
Now apply the transform matrix to the reference vertex coordinates by matrix multiplication, keeping them in the same relative order. Record the rotated coordinates for your point cloud. Usethe rotated coordinates and the previously constructed face information to patch() the rotated object into visual existence.
After all of the iterations, use the recorded vertices to patch() into place faces joining each rotated object to its adjacent rotated object -- the skin of the ring.
If your object being rotated has no internal structure such that the skin is all you care about then you can skip the patch() as you iterate, just using the list of final coordinates to build the skin.
4 commentaires
Walter Roberson
le 23 Fév 2020
Not without writing the code for you. The algorithm I set out should be enough for you to create the point cloud of the ring. Once you have done that part then we will look more closely at the challenges of drawing a solid around the point cloud.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur 3-D Scene Control dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!