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


Note: This function has been superseded by the PEXOCCNURBSurface function, but is maintained here for backwards compatibility with PEXlib 5.1

Synopsis

 
     void PEXNURBSurface(
          Display *display,
          XID resource_id,
          PEXOCRequestType req_type,
          int rationality,
          int uorder,
          int vorder,
          float *uknots,
          float *vknots,
          unsigned int col_count,
          unsigned int row_count,
          PEXArrayOfCoord points,
          unsigned int curve_count,
          PEXListOfTrimCurve *trim_curves
     )

Arguments

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

resource_id
The resource identifier of the renderer or structure.

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

rationality
The type of B-spline surface, whether rational or non-rational (PEXRational or PEXNonRational).

uorder
The order of the polynomial expression in the u direction.

vorder
The order of the polynomial expression in the v direction.

uknots
An array of floats specifying the B-spline curve knots in the u direction.

vknots
An array of floats specifying the B-spline curve knots in the v direction.

col_count
The number of columns in the points array (number of points in the u direction).

row_count
The number of rows in the points array (number of points in the v direction).

points
An array of points defining the B-spline surface.

curve_count
The number of trimming curves.

trim_curves
A pointer to a list of trimming curves

Returns

None.

Description

Invoke PEXNURBSurface to create a non-uniform B-spline surface output primitive.

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 argument 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, result is implementation-dependent.

Each trimming curve has a visibility flag that controls its visibility for the purposes of displaying surface edge. 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.

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.

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.

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 an overview, see Output Command Functions.