Creates torus surface object.


bool CreateSurfaceTorus(
HM_EntityGeometrySurface& new_torus,
const HM_Point& origin,
const HM_Vector& normal,
const HM_Vector& uorigin_dir,
double base_radius,
double tube_radius,
double tube_phase,
bool reverse_u


HyperMesh Ext API Function


The function creates the surface object of the type HM_ExtAPI::TORUS().

The torus is defined by a circular spine and a circular cross-section at each point of the spine. The spine of a torus is defined by a center point C, normal n, and radius R. The circular cross-section is defined by a minor radius r.

The torus is parameterized by angular parameters U and V. The V-parameter is the latitude with positive direction in the direction of the torus normal n. The value V = φ corresponds to the largest V-isoparametric circle on the tube of the torus.

The U-parameter is the longitude with positive direction in counter clockwise direction around the torus normal n in case the value of the parameter reverse_u is false. The direction of U-parameter is in clockwise direction around the torus normal n in case the value of the parameter reverse_u is true. The vector u defines the direction from the center of the torus C to the circle of constant U=0 parametric isoline of the torus.

The figure below clarifies the meaning of torus parameter and shows the fragment of the torus surface for the case when reverse_u is false.

Figure 1.

The points on the surface of the torus can be calculated parametrically as

S(U, V) = C + r n sin(V-φ) + [ R + r cos(V-φ) ] [ u cos U + q sin U ]

u = U - n (nU) , n = N / | N |

The table below clarifies correspondence between torus parameters and parameters used by the function CreateSurfaceTorus.
Parameters used by CreateSurfaceTorus Torus parameters
origin C
normal N
uorigin_dir U
base_radius R
tube_radius r
tube_phase φ
reverse_u If false then q = n X u,

If true then q = u X n

If the function succeeds, the return value is true. If the function fails, the return value is false. To get extended value information, call HM_ExtAPI::GetLastErrorCode().

Requires including hm_extapi.h.


[out] - Handle to new surface object.
[in] - Center point of torus circular spine.
[in] - Vector normal to the plane of the spine.
[in] - Vector that defines position of the tube circle corresponding to U=0 parameter.
[in] - Spine circle radius.
[in] - Tube radius.
[in] - Parameter shift on the tube. See Description above.
[in] - Flag that defines direction of constant V parametric lines along the tube of the torus. The value of false indicates counter clockwise direction of constant V parametric lines with respect to the normal direction. The value of true indicates clockwise direction of constant V parametric lines.