Analytic Surface

Overview

This class manages an analytic surface. An analytic surface is defined by its shape and parameters. For example, a spherical surface is defined by its center and radius. AnalyticSurface allows for the definition of ruled surfaces, surfaces of revolution, standard geometric shapes such as a sphere, faceted surfaces and surfaces defined by trimmed NURBS.

The functions associated with a AnalyticSurface object are the following.

Specify the surface type using define(). Three types of surfaces can be defined: pre-defined shapes such as planes, spheres, cones and cylinders, or surfaces generated from segments or surfaces generated from collections of facets or NURBS. Parameters for pre-defined surfaces are defined using their specific functions such as setPlane(), setSphere(), or setCylinder().

Surfaces created from segments are defined in two steps. First, a curve profile must be defined in the x-y plane. Then the surface is defined from the two-dimensional profile by either extruding it about an axis - a ruled surface - or by revolving it about an axis - a surface of revolution. Profile points are defined with setPoint(). Segments are defined with setSegment(). Supported segment types are a straight line (LINE), an circular arc (ARC), or a parabola (PARABOLIC).

Once the profile is defined a ruled surface is created with setSegmentRuleAxis(). A surface of revolution is created with setSegmentRevolutionAxis(). A fillet radius can be defined on the two-dimensional profile using setSegmentFilletRadius().

The functions setSegmentRuleAxis(), setSegmentRevolutionAxis(), setPlane(), setBox(), setCone(), and setCylinder() all require three points, a, b, and c, in addition to parameters that are specific to each of them. These three points define a local coordinate system as follows: the local x direction is given by the vector a-b; the vector a-c lies in the local x-y plane so that the local z-direction is given by the cross product a-b X a-c.

Surfaces which are defined as a collection of facets or NURBS require the defining points in 3D space to be input using setPoint(). Facets are defined using setFacet() and may be linear or parabolic triangles or quadrilaterals. NURBS surfaces are defined using setNURBS() with optional trimming loops defined by setNURBSTrimLoop(). Query functions exist to return the number of facets or NURBS defined and the individual facet and NURBS definitions.

Class Members Descriptions

The currently available AnalyticSurface enumerations and functions are described in detail in this section.

class AnalyticSurface

Analytical surface class for creating and managing geometric surfaces.

Public Types

enum class Type

Surface type.

Values:

enumerator SEGMENTED

Two-dimensional segmented surface.

enumerator SEGMENTED_RULE

Segmented ruled surface.

enumerator SEGMENTED_REVOLUTION

Segmented surface of revolution.

enumerator PLANE

Planar surface.

enumerator BOX

Box surface.

enumerator SPHERE

Spherical surface.

enumerator CYLINDER

Cylindrical surface.

enumerator CONE

Conical surface.

enumerator FACET

Facetted surface.

enumerator NURBS

NURBS surface.

enum class SegmentType

Segment type for surface profiles.

Values:

enumerator LINE

Straight line segment.

enumerator ARC

Circular arc segment.

enumerator PARABOLIC

Parabolic segment.

enum class FacetType

Facet type for facetted surfaces.

Values:

enumerator LINEAR_TRIANGLE

Linear triangle facet.

enumerator PARABOLIC_TRIANGLE

Parabolic triangle facet.

enumerator LINEAR_QUADRILATERAL

Linear quadrilateral facet.

enumerator PARABOLIC_QUADRILATERAL

Parabolic quadrilateral facet.

enum class NurbsType

NURBS type.

Values:

enumerator LINE

NURBS line.

enumerator SURFACE

NURBS surface.

Public Functions

ErrorCode getErrorCode()

Return the current ErrorCode of the AnalyticSurface object.

Returns: ErrorCode - The current error code, or NONE if no error.
Status define(Type type)

Set the surface type. Segmented, facetted and NURBS types require points defined with setPoint() and specific surface definitions defined by setSegment() , setFacet() and setNURBS() respectively. All other surfaces only require the parameters defined by their own functions.

See Also inquire()

Parameters:type Type
Returns:Status
Status inquire(Type *type)

Inquire of defined type as output argument

See Also define()

Returns:Status
Status setName(const char *name)

Attach a name to the surface. Inquire of specified name as an output argument using getName() .

Parameters:name – String with surface name
Returns:Status
Status getName(char name[])

Get name string

See Also setName()

Returns:Status
Status setPoint(int id, double coord[3])

Specify the location of a point in the two-dimensional segmented profile or NURBS. For segments only the first two coordinates are used.

See Also getPoint()

Errors
OPERATION is generated if points are not defined in ascending order in increments of 1.

Parameters:
  • id – Point id
  • coord – Point coordinates
Returns:

Status

Status getPoint(int id, double coord[3])

Get segment or NURBS point

See Also setPoint()

Status getPointCount(int *count)

Query for the number of points defined with setPoint() .

Parameters:count[out] Number of defined points
Status setSegment(int id, SegmentType type, int connectivity[])

Specify the type and connectivity for each segment in the two-dimensional profile. A segment of type LINE requires two point ids in the connectivity array connectivity. ARC requires three point ids: the first point, the center of the circular arc, and the end point. Finally, the parabolic segment requires three point ids: the first, a middle point, and the last point.

See Also getSegment()

Parameters:
  • id – Segment id
  • type SegmentType
  • connectivity – Segment connectivity
Returns:

Status

Status getSegment(int id, SegmentType *type, int connectivity[])

Get segment type and connectivity

See Also setSegment()

Status getSegmentCount(int *count)

Query for the number of profile segments defined with setSegment() .

Parameters:count[out] Number of defined segments
Status setSegmentRuleAxis(double a[3], double b[3], double c[3])

Set ruled surface direction. Sets the local coordinate system information for a ruled surface. The ruled surface extrudes the planar profile in the z-direction.

See Also getSegmentRuleAxis()

Errors
OPERATION is generated if a-b is parallel to a-c.

Parameters:
  • a – Origin of local coordinate system
  • b – Point such that a-b defines the local x-axis
  • c – Point such that a-c defines a vector in the local x-y plane
Returns:

Status

Status getSegmentRuleAxis(double a[3], double b[3], double c[3])

Get ruled surface direction

See Also setSegmentRuleAxis()

Returns:Status
Status setSegmentRevolutionAxis(double a[3], double b[3], double c[3])

Set the local coordinate system information for a surface of revolution. The revolution is about the z-direction.

See Also getSegmentRevolutionAxis()

Errors
OPERATION is generated if a-b is parallel to a-c.

Parameters:
  • a – Origin of local coordinate system
  • b – Point such that a-b defines the local x-axis
  • c – Point such that a-c defines a vector in the local x-y plane
Returns:

Status

Status getSegmentRevolutionAxis(double a[3], double b[3], double c[3])

Get surface of revolution direction

See Also getSegmentRevolutionAxis()

Returns:Status
Status setSegmentFilletRadius(double r)

Set fillet radius

See Also setSegmentFilletRadius()

Returns:Status
Status getSegmentFilletRadius(double *r)

Get fillet radius

See Also setSegmentFilletRadius()

Returns:Status
Status setPlane(double a[3], double b[3], double c[3], double length, double width)

Set the local coordinate system information for a planar surface. Sets the dimensions, length and width, in the local x and y axes, respectively.

See Also getPlane()

Errors
OPERATION is generated if a-b is parallel to a-c.

Parameters:
  • a – Origin of local coordinate system
  • b – Point such that a-b defines the local x-axis
  • c – Point such that a-c defines a vector in the local x-y plane
  • length – Length along the local x-axis
  • width – Length along the local y-axis
Returns:

Status

Status getPlane(double a[3], double b[3], double c[3], double *length, double *width)

Get planar surface parameters

See Also setPlane()

Status setBox(double a[3], double b[3], double c[3], double length, double width, double height)

Set the local coordinate system information for a box surface. Sets the dimensions, length, width, and height, in the local x, y, and z axes, respectively.

See Also getBox()

Errors
OPERATION is generated if a-b is parallel to a-c.

Parameters:
  • a – Origin of local coordinate system
  • b – Point such that a-b defines the local x-axis
  • c – Point such that a-c defines a vector in the local x-y plane
  • length – Length along the local x-axis
  • width – Length along the local y-axis
  • height – Length along the local z-axis
Returns:

Status

Status getBox(double a[3], double b[3], double c[3], double *length, double *width, double *height)

Get box surface parameters

See Also setBox()

Returns:Status
Status setCylinder(double a[3], double b[3], double c[3], double radius, double height)

Set the local coordinate system information for a cylindrical surface. Sets the cylinder radius and height. The axis of the cylinder is aligned with the local z-axis.

See Also getCylinder()

Errors
OPERATION is generated if a-b is parallel to a-c.

Parameters:
  • a – Origin of local coordinate system
  • b – Point such that a-b defines the local x-axis
  • c – Point such that a-c defines a vector in the local x-y plane
  • radius – Cylinder radius
  • height – Cylinder height along z-axis
Returns:

Status

Status getCylinder(double a[3], double b[3], double c[3], double *radius, double *height)

Get cylindrical surface parameters

See Also setCylinder()

Returns:Status
Status setCone(double a[3], double b[3], double c[3], double r1, double r2, double height)

Set the local coordinate system information for a conical surface. Sets the cone radii, r1 and r2 and height. The axis of the cone is aligned with the local z-axis. The cone height dimension is along the cone axis.

See Also getCone()

Errors
OPERATION is generated if a-b is parallel to a-c.

Parameters:
  • a – Origin of local coordinate system
  • b – Point such that a-b defines the local x-axis
  • c – Point such that a-c defines a vector in the local x-y plane
  • r1 – Cone radius at origin
  • r2 – Cone radius at height
  • height – Cone height along local z-axis
Returns:

Status

Status getCone(double a[3], double b[3], double c[3], double *r1, double *r2, double *height)

Get conical surface parameters

See Also setCone()

Returns:Status
Status setSphere(double center[3], double radius)

Define the center and the radius of a spherical surface.

See Also getSphere()

Parameters:
  • center – Center of sphere
  • radius – Sphere radius
Returns:

Status

Status getSphere(double center[3], double *radius)

Get spherical surface parameters

See Also setSphere()

Returns:Status
Status print()

Print the contents of the analytic surface object to standard output.

Returns:Status
Status setNURBS(int id, NurbsType type, int uPointCount, int uOrder, int vPointCount, int vOrder, int connectivity[], double homoWeights[], double knots[], int trimLoopsCount, int trimList[])

Specify the type, norders, connectivity, weights, knot values and trimming loops for each NURBS. If the NURBS is a line then the number of points and weights is uPointCount. The number of knot values is uPointCount + uOrder. If the NURBS is a surface then the number of points and weights is uPointCount * vPointCount. The number of knot values is uPointCount + uOrder + vPointCount + vOrder.

See Also getNURBS()

Parameters:
  • id – NURBS id
  • type NurbsType
  • uPointCount – Number of points in u
  • uOrder – Order in u
  • vPointCount – Number of points in v
  • vOrder – Order in v
  • connectivity – NURBS connectivity
  • homoWeights – Homogeneous weights
  • knots – Knot values
  • trimLoopsCount – Number of trimming loops
  • trimListList of trimming loops
Returns:

Status

Status getNURBSCount(int *count)

Query for the number of NURBS defined with setNURBS() .

Parameters:count[out] Number of defined NURBS
Returns:Status
Status getMaxNURBSOrder(int *maxOrder)

Query for the maximum order of all defined NURBS.

Parameters:maxOrder[out] Maximum NURBS order
Returns:Status
Status getNurbsPointsAndTrimLoops(int id, NurbsType *type, int *uPointCount, int *uOrder, int *vPointCount, int *vOrder, int *trimLoopsCount)

Query for the NURBS type, point counts, orders, and trimming loop count. Use this function before calling getNURBS() to determine array sizes.

Parameters:
  • id – NURBS id
  • type[out] NURBS type
  • uPointCount[out] Number of points in u
  • uOrder[out] Order in u
  • vPointCount[out] Number of points in v
  • vOrder[out] Order in v
  • trimLoopsCount[out] Number of trimming loops
Returns:

Status

Status getNURBS(int id, NurbsType *type, int *uPointCount, int *uOrder, int *vPointCount, int *vOrder, int connectivity[], double homoWeights[], double knots[], int *ntrim, int trimlist[])

Get NURBS surface

See Also setNURBS()

Returns:Status
Status setNURBSTrimLoop(int id, int pointCount, int points[])

Specify a trimming loop for a NURBS surface. The trim loop is defined by a list of point indices.

See Also getNURBSTrimLoop()

Parameters:
  • id – Trim loop id
  • pointCount – Number of points in trim loop
  • points – Point indices defining trim loop
Returns:

Status

Status getNURBSTrimLoopCount(int *count)

Query for the number of NURBS trim loops defined with setNURBSTrimLoop() .

Parameters:count[out] Number of defined NURBS trim loops
Returns:Status
Status getNURBSTrimLoopPointCount(int id, int *pointCount)

Query for the number of points in a specific NURBS trim loop.

Parameters:
  • id – Trim loop id
  • pointCount[out] Number of points in trim loop
Returns:

Status

Status getNURBSTrimLoop(int id, int *pointCount, int points[])

Get NURBS trim loop

See Also setNURBSTrimLoop()

Returns:Status
Status setFacet(int id, FacetType type, int connectivity[])

Specify the type and connectivity for each facet in a facetted surface. A facet of type LINEAR_TRIANGLE requires three point ids in the connectivity array. A facet of type LINEAR_QUADRILATERAL requires four point ids. A facet of type PARABOLIC_TRIANGLE requires six point ids. A facet of type PARABOLIC_QUADRILATERAL requires eight point ids.

See Also getFacet()

Parameters:
  • id – Facet id
  • type FacetType
  • connectivity – Facet connectivity
Returns:

Status

Status getFacetCount(int *count)

Query for the number of facets defined with setFacet() .

Parameters:count[out] Number of defined facets
Returns:Status
Status getFacet(int id, FacetType *type, int connectivity[])

Get facet type and connectivity

See Also setFacet()