Rendering a 3D shape by stacking 2D layers
Mostra commenti meno recenti
I am new to using MATLAB, so I am not used to specific programming functions here. I am trying to render a 3D-shaped model by stacking 2D layers. The original 2D polar plot to start with looks like this:
t = 0:0.01:2*pi;
r = sin(t).^3 + cos(t).^3;
polar(t,r)

Or, we could also use the cartesian coordinate system instead of the polar coordinate system by using this:
I will call this layer a 'bean shape'.
The goal is to create similar bean shapes and stack them continuously in the z axis to create a 3D model. (Maybe a cartesian coordinate system should be used.)The ratio of similarity will follow y=sin(z) from 0 to pi. (So the shape starts with 0 at the bottom, becomes bigger as z increases, biggest at z=pi/2, and becomes smaller again.) The biggest layer would be the same as r = sin(t).^3 + cos(t).^3 since the ratio of similarity would be y=1. For an easier understanding, I will use 7 discrete bean shapes. Shape #1 goes on the very bottom in the z axis, then on top of Shape #1 goes Shape #2, and then #3, #4, ..., #7 (Which would be the biggest layer). On top of #7 goes #6, then #5, #4, ... #1.

The only difference is that we are not using 7 discrete layers, but stacking an infinite amount of layers (from z=0 to z=pi) continuously (which is same as integration).
I would also like to know how to calculate the volume of the 3D shape after rendering this. Thanks in advance!
Risposta accettata
Più risposte (1)
DGM
il 30 Lug 2025
0 voti
See also this later question on the same topic from the same user:
Categorie
Scopri di più su Assembly in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


