3D Shapes

3D cube

General Instructions:

Click on the link to open the Starter file.

Now, click on the fork icon .

coloured background

Then at the bottom it will give the option to fork the project to save and modify .

coloured background

Add the code inside the highlighted box in the examples.

coloured background



Types 3D Shapes:

Box:

The box function takes three parameters width, height and depth.

box( width , height , depth );

coloured background

Sphere:

Sphere function takes three parameters radius, detailX and detailY.

The detailX and detailY are the number of triangular subdivisions in the x-axis and in the y-axis.

In the sphere, the detailX and detailY has the default or maximum value of 24.

sphere( radius , detailX(0 - 24) , detailY(0 - 24) );

coloured background

Ellipsoid:

Ellipsoid function takes radiusX, radiusY, radiusZ, detailX and detailY.

The radiusX, radiusY and radiusZ of the ellipsoid shape is the radius along the x-axis, y-axis and z-axis.

In the ellipsoid, the detailX has the default or maximum value of 24 , while the detailY has the default or maximum value of 16.

ellipsoid( radiusX , radiusY , radiusZ , detailX(0 - 24) , detailY(0 - 16) );

coloured background

Torus:

Torus function takes radius, tuberadius, detailX and detailY.

The radius parameter is the radius of the torus.Size of the torus can be increased or decrease by changing the value of the radius.

The tuberadius parameter is the radius of the tube or thickness of the tube of torus.

In the torus, the detailX has the default or maximum value of 24 , while the detailY has the default or maximum value of 16.

torus( radius , tuberadius , detailX(0 - 24) , detailY(0 - 16) );

coloured background

Cone:

Cone function takes radius, height, detailX and detailY.

The radius parameter is for setting the radius of the cone's base.

The height parameter is for the height of the cone.

In the cone, the detailX is the number of edges used for forming the cone's base and it has the default or maximum value of 24 .

While the detailY is the number of triagular subdivisions along y-axis and has the default or maximum value of 1.

cone( radius , height , detailX( 0 - 24) , detailY( 1 ) , base );

coloured background

Cylinder:

Cylinder function takes radius, height, detailX, detailY , bottomCap and topCap.

The radius parameter is for setting the radius of the cylinder's base.

The height parameter is for the height of the cylinder.

In the cone, the detailX is the number of edges used for forming the cylinder's top and bottom and it has the default or maximum value of 24 .

While the detailY is the number of triagular subdivisions along y-axis and has the default or maximum value of 1.

bottomCap parameter takes the boolean value. If the value is true the bottom will form. If the boolean value is false the bottom will not form.

topCap parameter also takes the boolean value. If the value is true the top will form. If the boolean value is false the top will not form.

cylinder( radius , height , detailX(0 - 24) , detailY( 1 ) , bottomCap , topCap );

coloured background

Happy Coding!!

Continue Reading

2D Shapes

Learn More

Map & Random

Learn More

Translate

Learn More