Using the Ge library you can create and modify toruses. A torus is a surface generated by revolving a circular arc about an axis of symmetry, where the plane of the circular arc contains the axis of symmetry.
A torus is defined by the following parameters:
Parameter V is the longitude (about the axis of symmetry), which for a closed torus defaults to the range [-OdaPI, OdaPI). Zero corresponds to the reference axis (which is a vector orthogonal to the axis of symmetry). Applying the right hand rule along the symmetric axis (axisOfSymmetry X refAxis) defines the increasing direction for V if isReverseV() is false, and decreasing direction otherwise.
Parameter U parameterizes the circular tube, which for a closed circle defaults to the range [-OdaPI, OdaPI). Applying the right hand rule along the (reference axis)×(-axisOfSymmetry) defines an increasing direction for U.
The torus can be periodic in either parametric direction, with a period of Oda2PI.
A torus is represented by the OdGeTorus class. To create a torus, use one of the OdGeTorus() constructors:
An OdGeTorus object provides methods for working with torus properties:
To set torus properties, use the corresponding methods: setAnglesInU(), setAnglesInV(), setMajorRadius(), setMinorRadius(). Note that angles along U parameter are reset to the maximum allowed for the established minorRadius and majorRadius when using the setMajorRadius() and setMinorRadius() methods. Also when using the setAnglesInU(), the angles are set as the result of the intersection of the natural interval with the one that is formed from the passed values to the method (for Vortex, Apple, Lemon torus types). To define a set of properties, use the specific set() method. For example:
OdGeTorus torus1;
torus1.set(1.0, 2.0, OdGePoint3d(5.0, 0.0, 0.0), OdGeVector3d(0.0, 1.0, 0.0));
torus1.setMinorRadius(1.5);
OdGeTorus torus2(torus1.majorRadius(), -1 * torus1.minorRadius(), OdGePoint3d(0.0, 0.0, 0.0), OdGeVector3d(0.0, 0.0, 1.0));
There are four forms of a torus, which are determined by the magnitude of major radius relative to the magnitude of the minor radius:
To check if the torus is of a specific type, use the appropriate method: isDoughnut(), isVortex(), isApple(), or isLemon().
Vortex, apple, and lemon toruses are degenerate; this means that (majorRadius < |minorRadius| + OdGeContext::gTol.equalVector()). To check if the torus is degenerate, use the isDegenerate() method.
Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.
|