3.5.1 Graphics FunctionsThe elementary Modeler3D graphics functions closely parallel the built-in Mathematica graphics primitives. Each graphics function generates Mathematica graphics primitives that represent points, lines, or polygons. The Modeler3D compound graphics functions generate more complex shapes, such as spheres and cylinders. Basic 3D graphics functions. More 3D graphics functions. Options for graphics functions. The Modeler3D Vertex, Edge, and Facet functions are analogous to the built-in Mathematica Point, Line, and Polygon graphics primitives. To demonstrate these functions, graphics objects are generated on body 2, which is named body2. This loads the Modeler3D package. Here is a pyramid with a filled floor. The coordinates of the graphic just created bdgraph are functions of the Modeler3D variables that locate body2: X2, Y2, Z2, Eo2, Ei2, Ej2, and Ek2. Therefore, these variables must be replaced with numeric values before trying to Show the graphic. Here is bdgraph located coincidentally with the local origin.
Out[5]= | |
To show the pyramid in another orientation, a set of four Euler parameters are fabricated that represent the desired angular orientation. Normally, Modeler3D graphics functions are used in conjunction with a Modeler3D solution rule that contains the values of the Euler parameters needed, but in this case they are generated explicitly. The pyramid is now rotated 0.5 radians about the global Z axis. The EulerParameters function returns the Euler parameters required for this rotation. These Euler parameters represent a rotation of 0.5 radians about the {0, 0, 1} axis.
Out[6]= | |
Now the parameters are turned into rules for Eo2, Ei2, Ej2, and Ek2.
Out[7]= | |
Here is bdgraph rotated 0.5 radians about the Z axis.
Out[8]= | |
The Box function is analogous to the built-in Cuboid function, with the exception that the sides of the Box graphic are aligned with the local coordinate system on which the graphic is located, instead of being aligned with the global coordinate system. The Cylinder function generates a faceted cylinder or cone, with endpoints located at the two ends of a Modeler3D line object. The Faces option is used with Cylinder to show only an outline of the cylinder. Here is a Box graphic on body2 and a Cylinder graphic spanning from body2 to the ground. Here is the result.
Out[10]= | |
The Wheel function is used here to generate a part of an octagon with a hole in it. Note that the n-gon returned by Wheel is placed on the body that is referenced in the Point argument, and is located with that body as such. This generates a piece of an octagon on body2. Here is the result.
Out[12]= | |
The Sphere and Torus functions are used here to generate a sphere and a torus. This generates a piece of a sphere and a torus on body2. Here is the result.
Out[14]= | |
Functions to generate pseudo-solid objects. Extrude is used to generate a sequence of faces that are defined by sweeping a sequence of connected lines through 3D space. The following example takes six points on body2 that define an hourglass form and extrudes them at an oblique angle into a set of six facets forming a canted hourglass. Here are the points for an hourglass graphic. The graphic is shown shifted 2 units in the Y direction off of the global origin.
Out[17]= | |
The same list of points can be revolved about an axis specified on body2. Here is a revolution of the hourglass graphic. Here is the result.
Out[19]= | |
|