PEXOCCNURBSurface - Non-Uniform Rational B-spline Surface Primitive (5.0)


Synopsis

 
   void PEXOCCNURBSurface(
        PEXOCC context,
        unsigned int shape,
        PEXSurfaceGeometrySpline *points,
        unsigned int curve_count,
        PEXListOfTrimCurve *trim_curves,
        PEXSurfaceColorSpline *color_spline,
        unsigned int num_data_splines,
        PEXSurfaceDataSpline *data_splines
   )
 

Arguments

context
An OC context returned by a successful PEXCreateOCC call.

display (OCC)
A pointer to a display structure returned by a successful XOpenDisplay call.

resource_id (OCC)
The resource identifier of the renderer or structure.

req_type (OCC)
The request type for the output command (PEXOCRender, PEXOCStore, PEXOCRenderSingle or PEXOCStoreSingle).

shape
Hint indicating the geometrical shape of the surface.

points
A pointer to a surface geometry spline data structure defining the B-spline surface.

curve_count
The number of trimming curves.

trim_curves
A pointer to a list of trimming curve data structures.

color_spline
A pointer to a surface color spline data structure/

num_data_splines
The number of data splines supplied in the data_splines argument.

data_splines
A pointer to a list of surface data spline data structures.

Returns

None.

Description

Invoke PEXOCCNURBSurface to create a non-uniform B-spline surface primitive output command with optional trimming curves, color spline, and data splines. Depending on the attributes you supply, this function generates a PEXOCNURBSurface or PEXOCNURBSurfaceWithData output command. Note that the PEXDataStride and PEXDataUnpacked data models are not supported in this function. You must specify all coordinate, knot, color and float data in contiguous lists.

Shape is a hint indicating the geometrical shape of the surface. PEXlib defines the following shape values: PEXNURBSHintUnknown which indicates that nothing is known about the shape of the surface. The implementation determines the hint itself. In addition, PEXlib defines PEXNURBSHintPlane, PEXNURBSHintCone, PEXNURBSHintSphere, PEXNURBSHintTorus, PEXNURBSHintRightCircularCylinder, PEXNURBSHintSurfaceOfRevolution, PEXNURBSHintTabulatedCylinder, PEXNURBSHintRuledSurface, and PEXNURBSHintGeneralQuadric. If the specified shape does not match the surface, then the result is implementation-dependent.

Specify the surface with the PEXSurfaceGeometrySpline data structure. The surface is generated as a function of the parametric variables u and v. The uorder and vorder must be positive integers and indicate the order of the surface in each of the u and v argument dimensions. Invoke the PEXGetImpDepConstants function to determine the largest supported value for surface uorder and vorder. The spline shape is specified using two lists of knots in the parametric coordinate space, plus an array of control points specified in modeling coordinates. The uknot and vknot sequences must each form a non-decreasing sequence of numbers. The col_count indicates the number of control points in the u direction and the row_count indicates the number of control points in the v direction. The control points are stored in the array in row-major order (i.e., the column number varies fastest as vertices are stored in the array) and the rows increase in the direction of increasing v. The number of knots in the u direction is the sum of the order in the u direction and col_count. The number of knots in the v direction is the sum of the order in the v direction and row_count. The number of control points in each direction must be at least as large as the corresponding order.

The minimum and maximum knot values define the range over which the B-spline surface is evaluated in the u or v parametric direction.

If the rationality is PEXRational, then you must specify the control point list in homogeneous (4D) modeling coordinates. If rationality is PEXNonRational, then you must specify the control point list in non-homogeneous (3D) modeling coordinates.

In addition to the parametric bounds, you can also specify a list of trimming loops. Trimming loops serve to further restrict the region in parametric coordinate space over which the surface is evaluated. Each trimming loop is defined as a list of one or more B-spline trimming curves that are connected head-to-tail. Each trim curve is a completely specified NURB curve, i.e. it is rational or non-rational, has its own order, etc. Close the list explicitly so that the tail of the last curve joins the head of the first. Each trimming curve is parameterized independently. If there is floating-point inaccuracy in closure or in head- to-tail connectivity between curves, then closure or connectivity is assumed. Trimming loops are defined in the parameter space of the surface and may not go outside the parameter space of the surface.

If the application does not specify any trimming loops, then the implementation renders the rectangular parameter limits of the surface as the edges of the surface, based on the edge flag attribute.

Trimming loops define the region of the surface based on the following two rules:

  1. the implementation renders a point that is in the portion of the surface if any ray projected from it to infinity has an odd number of intersections with trimming loops, and
  2. traveling in the direction of a trimming loop, the portion of the surface that the implementation trims away should be on the right and the portion the implementation retains should be on the left. In other words, defining a loop in counter-clockwise order causes the implementation to retain the interior of the loop and to trim away the exterior. A clockwise loop causes the implementation to retain the exterior of the loop to and to trim away the interior. If you nest loops, they must alternate in direction. In all cases, the outermost loop must be counter-clockwise. No trimming curve may intersect itself, and no trimming loop may intersect itself or any other trimming loop. For trimming loops that do not conform to these rules, the result is implementation-dependent.

Each trimming curve has a visibility flag that controls its visibility for the purposes of displaying the surface edges. Depending on the surface edge attributes and the visibility flags associated with trimming curves, the curves in trimming loops may be drawn as surface edges.

Trimming curve specification must abide by the constraints of NURB curve (e.g., the number of control points at least as large as the order, non-decreasing knot sequence, order plus number of controls points equals the number of knots). Also, the trim curve order must not be less than two.

The color and data attribute splines do not have to have the same orders, rationality, or knot sequences as the geometric surface. The number of attribute spline control points in each argument must be at least as large as the spline's order in that argument. The number of knots in each argument must be equal to the number of control points plus the order in that direction. The parameter ranges of the attribute spline must wholly include the bound parameter ranges of the geometric spline, or, if trimming loops are specified for the geometric surface, then the parameter range must wholly contain the parameter range defined by the trimming loops.

If you do not supply a color spline, set the argument color_spline to NULL. Otherwise, supply a pointer to a PEXCurveColorSpline data structure to define the color distribution of the primitive's geometry. The color of any point on the primitive's geometry is determined by evaluating the color spline at the corresponding parametric values. Each control point's components correspond to a direct color. If the color spline is rational, then the direct color components include a homogeneous coordinate. The color components may be outside the range normally associated with the color type. If an implementation indicates support for a non-homogeneous color type via the PEXColorType enumerated type, then it also supports the homogeneous form of the same color type in the color spline, except for PEXColorTypeIndexed.

Specify the number of supplied data splines with the num_data_splines argument and supply a pointer to a PEXSurfaceDataSpline data structure in the data_splines argument to define the distribution over the primitive's geometry of each floating-point value. Each data spline may represent the distribution of any number of floating-point values. A specific floating-point value is determined by evaluating the appropriate data spline at the corresponding parametric values. Each of the control point's components correspond to a specific floating-point value. If a data spline is rational, then the control point additionally includes a homogeneous coordinate. Because there are multiple data splines and each data spline may represent multiple floating-point values, functions referencing the floating-point values must use two indices to indicate a specific floating-point value distribution. If such a functionality only provides one index (as is required for all other primitives with floating-point data), it is assumed this index selects which data spline is to be used. The first floating-point value of that spline is then implicitly selected.

All attributes affecting the representation of fill area sets also affect the representation of the non-uniform B-spline surface primitive. In addition, the implementation uses the surface approximation to determine how to approximate the B-spline surface and uses the parametric surface characteristics to specify the appearance of the surface.

If either of the specified surface orders are not supported, then the implementation stores the output primitive in a structure, but when rendered, there is no visual effect. The implementation ignores the primitive.

Errors

BadPEXOutputCommand
The output command contains an invalid value.

BadPEXRenderer
The specified renderer resource identifier is invalid.

BadPEXStructure
The specified structure resource identifier is invalid.

See Also

For PEXlib 5.1 compatibility primitives similar to this one see PEXNURBSurface.

For attributes that affect this primitive, see

For an overview, see Output Command Functions.