-
Notifications
You must be signed in to change notification settings - Fork 27
Geometries
thothbot edited this page Mar 4, 2016
·
16 revisions
Here are described how to use built-in geometries. All examples are for the complex constructors and all images are given for Mesh objects. Simple constructors are available also.
More documentation see in the API Reference
All the following classes are inherited from the Geometry class.
// In this example will be drawn a full circle.
CircleGeometry geometry = new CircleGeometry(
50 // Sets the radius for circle.
30, // The number of segments of a circle. The more segments
// a circle contains, the smoother its contour will be.
0, // Start angle.
Math.PI * 2.0 // The length of the angle.
);
// Lets draw a square plane
PlaneGeometry geometry = new PlaneGeometry(
10, // Sets the width of a plane
10, // Sets the height of a plane
1, // The number of segments in a width
1 // The number of segments in a height
);
CubeGeometry geometry = new CubeGeometry(
10, // Sets the width of a cube
10, // Sets the height of a cube
10, // Sets the depth of a cube
1, // The number of segments in a width
1, // The number of segments in a height
1 // The number of segments in a depth
);
CylinderGeometry geometry = new CylinderGeometry(
20, // Sets the top radius.
20, // Sets the bottom radius.
20, // Sets the height of a cylinder.
30, // The number of segments of top and bottom circles. The more segments
// a circle contains, the smoother its contour will be.
1, // The number of segments in a height.
false // If true, top and bottom circles will not be drawn.
);
SphereGeometry geometry = new SphereGeometry(
30, // Sets the radius for sphere
30, // The number of segments in a width
30, // The number of segments in a height. The more segments
// a sphere contains, the smoother its contour will be.
0, // Start horizontal angle
Math.PI * 2, // The length of the horizontal angle.
0, // Start vertical angle
Math.PI * 2 // The length of the vertical angle.
);
TorusGeometry geometry = TorusGeometry(
30, // Sets the radius for torus
10, // Sets the radius for torus's tube
20, // The number of segments in a torus radius.
20, // The number of segments in a torus's tube radius.
Math.PI * 2.0 // The angle of a torus
);
TorusKnotGeometry geometry = new TorusKnotGeometry(
30, // Sets the radius for torus knot.
10, // Sets the radius for torus knot's tube.
20, // The number of segments in a torus knot radius.
20, // The number of segments in a torus knot's tube radius.
2, // Sets knot winds times around its axis of rotational symmetry.
3, // Sets knot winds times around a circle in the interior of the torus.
1 // Sets the height scale
);
PolyhedronGeometry
is abstract class which is inherited from the Geometry class.
This is family of the following classes, which are inherited from the PolyhedronGeometry
TetrahedronGeometry geometry = new TetrahedronGeometry(
30, // Sets the radius of tetrahedron
0 // Sets the frequency of decomposition
);
OctahedronGeometry geometry = new OctahedronGeometry(
30, // Sets the radius of octahedron
0 // Sets the frequency of decomposition
);
IcosahedronGeometry geometry = new IcosahedronGeometry(
30, // Sets the radius of icosahedron
0 // Sets the frequency of decomposition
);