SunPHIGS 3.0 Extensions Reference Manual
  Buscar sólo este libro
Descargar este libro en PDF

NAME

NON-UNIFORM B-SPLINE SURFACE - create a non-uniform B-spline surface structure element

SYNOPSIS

C Syntax

pnuni_bsp_surf ( uorder, vorder, uknots, vknots, rationality, grid, nloops, tloops )
Pint              uorder;       U spline order
Pint              vorder;       V spline order
Pfloat_list        * uknots;     U knots
Pfloat_list        * vknots;     V knots
Prational         rationality;  rationality selector
Ppoint_grid34     * grid;       grid of 3D or 4D control points
Pint              nloops;       number of trim curve loops
Ptrimcurve_list   * tloops;     trim curve loops

FORTRAN Syntax

SUBROUTINE pnubss ( UORDER, VORDER, NUKNTS, NVKNTS, UKNOTS, VKNOTS, RATSEL, NUCPTS, NVCPTS, DIMU, USTART, VSTART, CPTS, NLOOPS, LOOPS, VIS, ORDER, TATYPE, TAVAL, TRATS, NTKNTS, TKSTRT, TKNOTS, NTCPTS, TCSTRT, TCPTS, TMIN, TMAX )
INTEGER      UORDER                  order in u dimension
INTEGER      VORDER                  order in v dimension
INTEGER      NUKNTS                  number of knots in u dimension
INTEGER      NVKNTS                  number of knots in v dimension
REAL         UKNOTS(NUKNTS)          knots in u dimension
REAL         VKNOTS(NVKNTS)          knots in v dimension
INTEGER      RATSEL                  surface rationality
INTEGER      NUCPTS                  number of ctrl points in u dimension
INTEGER      NVCPTS                  number of ctrl points in v dimension
INTEGER      DIMU                    u dimension of control points array
INTEGER      USTART, VSTART          indices of control point's start location
REAL         CPTS(4, DIMU, * )       control points
INTEGER      NLOOPS                  number of trim loops
INTEGER      LOOPS(NLOOPS)           number of trim curves in each loop
INTEGER      VIS(nt)                 visibility flags for all trim curves
INTEGER      ORDER(nt)               curve orders for all trim curves
INTEGER      TATYPE(nt)              array of trim curve approximation types
REAL         TAVAL(nt)               array of trim curve approximation values
INTEGER      TRATS(nt)               curve types for all trim curves
INTEGER      NTKNTS(nt)              number of knots in each curve
INTEGER      TKSTRT(nt)              start indices of knot lists in TKNOTS
REAL         TKNOTS(* )              knots, for all trim curves
INTEGER      NTCPTS(nt)              number of ctrl points in each curve
INTEGER      TCSTRT(nt)              start indices of control point lists in TCPTS
REAL         TCPTS(3, * )            control points, for all trim curves
REAL         TMIN(nt), TMAX(nt)      parameter limits for all trim curves

Note: In the array dimensions above, nt refers to the total number of trim curves.

Required PHIGS Operating States

(PHOP, * ,STOP, * )

DESCRIPTION

Purpose

NON-UNIFORM B-SPLINE SURFACE creates a structure element containing the definition of a non-uniform B-spline surface.
This is a SunPHIGS Extension function based on PHIGS PLUS and is not part of the PHIGS standard.

C Input Parameters

uorder/vorder
Order of the surface in the u and v dimensions, respectively.
uknots/vknots
Pointers to Pfloat_list structures listing the knots for the u and v dimensions of the surface. Pfloat_list is defined in phigs.h as follows:
typedef struct {
Pint            num_floats;      /* number of Pfloats in list * /
Pfloat           * floats;        /* list of floats * /

} Pfloat_list;
rationality
The rationality selector. Prational is defined in phigs.h as follows:
typedef enum {
PNON_RATIONAL = 0 ,
PRATIONAL = 1
} Prational;
grid
Pointer to a Ppoint_grid34 structure containing the surface control points. Ppoint_grid34 is defined in phigs.h as follows:
typedef struct {
/* grid of 3D or 4D points,
[u_dim] [v_dim] * /
Ppcs_dims
num_points;
/* number of points in each
dimension * /
union {
Ppoint3 * point3d;
/* array of 3D points * /
Ppoint4 * point4d;
/* array of 4D points * /
} points;
} Ppoint_grid34;
Ppcs_dims is defined in phigs.h as:
typedef struct {
Pint  u_dim;    /* dimension (number of divisions) along u * /
Pint  v_dim;    /* dimension (number of divisions) along v * /

} Ppcs_dims;
Ppoint3 is defined in phigs.h as:
typedef struct {
Pfloat   x;   /* x coordinate * /
Pfloat   y;   /* y coordinate * /
Pfloat   z;   /* z coordinate * /

} Ppoint3;
Ppoint4 is defined in phigs.h as:
typedef struct {
Pfloat   x;   /* x coordinate * /
Pfloat   y;   /* y coordinate * /
Pfloat   z;   /* z coordinate * /
Pfloat   w; /* w coordinate * /

} Ppoint4;
nloops
Number of trimming curve loops.
tloops
A pointer to an array of Ptrimcurve_list structures that specifies the trimming curve loops. Each of these structures contains the specification of an individual trimming curve loop (set of trimming curves). Ptrimcurve_list is defined in phigs.h as:
typedef struct {
Pint
num_curves;
/* number of trimming curves
in list * /
Ptrimcurve
* curves;
/* list of curves * /
} Ptrimcurve_list;
Ptrimcurve is defined in phigs.h as:
typedef struct {
Pedge_flag      visible;      /* curve visibility flag * /
Prational      rationality;  /* rationality * /
Pint           order;        /* curve order * /
Pint           approx_type /* approximation type * /
Pfloat          approx_val    /* approximation value * /
Pfloat_list     knots;        /* curve knot vector * /
Pfloat          tmin, tmax;   /* curve parameter range * /
Ppoint_list23  cpts;         /* control points * /

} Ptrimcurve;
Pedge_flag is defined in phigs.h as:
typedef enum {
PEDGE_OFF,
PEDGE_ON
} Pedge_flag;
Prational is defined in phigs.h as:
typedef enum {
PNON_RATIONAL = 0 ,
PRATIONAL = 1
} Prational;
Pfloat_list is defined in phigs.h as:
typedef struct {
Pint    num_floats;    /* number of Pfloats in list * /
Pfloat   * floats;      /* list of floats * /

} Pfloat_list;
Ppoint_list23 is defined in phigs.h as:
typedef struct {
/* list of 2D or 3D
points * /
Pint
num_points;
/* number of points * /
union {
        Ppoint      * point2d;     /* array of 2D points * /
        Ppoint3     * point3d;     /* array of 3D points * /
} points;

} Ppoint_list23;
The point3d member of the points union is used if the rationality member of Ptrimcurve is PRATIONAL; otherwise, the point2d member is used. Ppoint is defined in phigs.h as:
typedef struct {
Pfloat   x;   /* x coordinate * /
Pfloat   y;   /* y coordinate * /

} Ppoint;
Ppoint3 is defined in phigs.h as:
typedef struct {
Pfloat   x;   /* x coordinate * /
Pfloat   y;   /* y coordinate * /
Pfloat   z;   /* z coordinate * /

} Ppoint3;

FORTRAN Input Parameters

All of the following data types are predefined in phigs77.h.
UORDER, VORDER
Order of the surface in the u and v dimensions, respectively.
NUKNTS, NVKNTS
Number of knots in the u and v dimensions, respectively.
UKNOTS(NUKNTS)
Array of knots for the u dimension.
VKNOTS(NVKNTS)
Array of knots for the v dimension.
RATSEL
Surface rationality is either Rational or Nonrational. This integer specifies the rationality and hence the dimensionality of the control points. Valid values defined are:
PRAT
Rational
PNRAT
Nonrational
NUCPTS, NVCPTS
Number of control points in the u and v dimensions, respectively.
DIMU
The declared second dimension of CPTS, the three-dimensional control points array.
USTART, VSTART
The u and v indices of the first array element used in the control points array. For example, CPTS(1, USTART, VSTART) is the x coordinate of the first control point of the surface. This allows the use of the CPTS subarray.
CPTS(4, DIMU, * )
Array of control points. The point coordinates are stored as:
CPTS(1 ,u, v) = x Coordinate
CPTS(2 ,u, v) = y Coordinate
CPTS(3 ,u, v) = z Coordinate
CPTS(4 ,u, v) = w Coordinate
The w coordinate is not used if the surface is Nonrational, that is, RATSEL = PNRAT.
NLOOPS
Number of trimming curve loops.
LOOPS(NLOOPS)
Number of trimming curves in each loop.
Note: In the array dimensions below, nt refers to the total number of trim curves.
VIS(nt) Array of visibility flags, one entry for each trimming curve.
ORDER(nt)
Array of curve orders, one entry for each trimming curve.
TATYPE(nt)
Array of trim curve approximation types, one entry for each trimming curve. The curve approximation types defined in phigs77.h are:
PCAWSD
Workstation-dependent
PCAEPK
Constant parametric between knots
PCACSW
Chordal size in WC space
PCACSN
Chordal size in NPC space
PCACSD
Chordal size in DC space
PCACDW
Chordal deviation in WC space
PCACDN
Chordal deviation in NPC space
PCACDD
Chordal deviation in DC space
TAVAL(nt)
Array of trim curve approximation values, one entry for each trimming curve. The meaning of these values is dependent on the approximation type.
TRATS(nt)
Array of trimming curve rationalities, one entry for each trimming curve. Each entry is an integer specifying the rationality and hence the dimensionality of the control points. Valid values defined are:
PRAT
Rational
PNRAT
Nonrational
NTKNTS(nt)
Number of knots in each curve, one entry for each trimming curve.
TKSTRT(nt)
Start positions of the knot lists in the array TKNOTS, one entry for each trimming curve.
TKNOTS(* )
Array of knots for all trimming curves. Each curve uses a contiguous segment of the array. The index of the head of the array segment used by a curve is specified in the TKSTRT array.
NTCPTS(nt)
Number of control points in each curve, one entry for each trimming curve.
TCSTRT(nt)
Start positions of the control point lists in the TCPTS array, one entry for each trimming curve.
TCPTS(3, * )
Array of control points for all trimming curves. Each curve uses a contiguous segment of the array. The index of the head of the array segment used by a curve is specified in the TCSTRT array. The point coordinates are stored in each column of the array as:
TCPTS(1 ,t) = u Coordinate
TCPTS(2 ,t) = v Coordinate
TCPTS(3 ,t) = w Coordinate
The w coordinate is not used if the curve is Nonrational, that is, TRATS(t) = PNRAT.
TMIN(nt), TMAX(nt)
Arrays of parameter limits for the trimming curves, one entry in each array for each trimming curve.

Execution

Depending on the edit mode, a NON-UNIFORM B-SPLINE SURFACE element is either inserted into the open structure after the element pointer, or replaces the element pointed at by the element pointer. The element pointer is then updated to point to this NON-UNIFORM BSPLINE SURFACE structure element.
The surface u and v orders must be positive integers. Surfaces of unsupported orders in either dimension are displayed by drawing the control grid, that is, the corresponding surface of order 2 in both dimensions.
The u and v knots must each form a non-decreasing sequence of numbers.
The rationality selector parameter may have the enumerated value Rational or Nonrational. When Rational is specified, the control points must be specified as 4D homogeneous modelling coordinates. When Nonrational is specified, the control points are 3D PHIGS modelling coordinates.
The number of control points in the u and v directions must be at least as large as the corresponding order. The number of control points in each direction plus the corresponding spline order must be equal to the corresponding number of knots.
At structure traversal time, a NON-UNIFORM B-SPLINE SURFACE primitive is drawn using the attributes that apply to FILL AREA SET 3 primitives, plus the extended interior attributes. See SET INTERIOR REPRESENTATION PLUS for a listing of these attributes.

Trimming Curves

The surface parameter area to be rendered may be defined by trimming curves. Trimming curves override the specified surface parameter range values, and the parameter range values are ignored during traversal if trimming curves are specified.
The trimming definition of a surface consists of a list of loops. Each of these loops is a list of one or more trimming
curves. Each trimming curve is a non-uniform rational B-spline curve defined in the 2D parameter space of the surface. The curves of a loop connect in a head-to-tail fashion. Each loop must be explicitly closed. Closure is assumed and not checked.
The restrictions on trimming curves are the same as those for non-uniform B-spline curves, and are specified in the function NON-UNIFORM B-SPLINE CURVE. Only the trimming curve's control polygon is used when it is of unsupported order or of order 1.
When the PCURV_WS_DEP approximation type is used for a trimming curve, the trimming curve tesselation is controlled by the tesselation of the surface. In this case, an approximation value between 0.0 and 1.0 indicates the relative quality of the trimming curve compared to surface quality. Higher values mean better relative quality.
Trimming loops may not go outside the parameter space of the surface. The trimming curves associated with a surface may touch each other only at their end points. No other pair of trimming curves may connect at that same point. A trimming curve may not be self-touching or self-intersecting.
If trimming curves are specified, then they define the edges of the surface. Each trimming curve has a flag that controls its visibility. These visibility flags have lower precedence than the edge flag attribute and are ignored if the edge flag attribute is set to OFF.
SunPHIGS Extensions restricts trimming loops of a single surface primitive to a certain canonical form. This form must redundantly identify the interior parameter area in two different ways: according to the odd winding and the curve handedness rules.

Attributes Applied

The attributes listed below are used to display the NON-UNIFORM B-SPLINE SURFACE primitive when the structure is traversed.
The Aspect Source Flags (ASFs) tell where to access the output display attributes. These attributes can come directly from the traversal state list, or they can be accessed indirectly, using the appropriate index in the traversal state list and the corresponding bundled representation in the workstation state list.
interior colour
interior colour index ASF
back interior colour
back interior colour ASF
interior style
interior style ASF
back interior style
back interior style ASF
interior style index
interior style index ASF
back interior style index
back interior style index ASF
interior shading method
interior shading method ASF
back interior shading method
back interior shading method ASF
interior reflectance characteristics
interior reflectance characteristics
ASF
back interior reflectance characteristics
back interior reflectance
characteristics ASF
reflectance properties
reflectance properties ASF
back reflectance properties
back reflectance properties ASF
interior index
edge colour
edge colour index ASF
edge flag
edge flag ASF
edgetype
edgetype ASF
edgewidth scale factor
edgewidth scale factor ASF
surface approximation criteria
surface approximation criteria ASF
edge index
face distinguishing mode
face culling mode
depth cue index
light source state
name set

ERRORS

005
Ignoring function, function requires state (PHOP, * ,STOP, * )
600
Ignoring function, not enough control points for specified order
601
Ignoring function, knot sequence is not nondecreasing
602
Ignoring function, order is inconsistent with number of knots and control points specified
615
Ignoring function, parameter range is inconsistent with knots

SEE ALSO

SET SURFACE APPROXIMATION CRITERIA (3PP)
NON-UNIFORM B-SPLINE CURVE (3PP)
SET INTERIOR REPRESENTATION PLUS (3PP)
INQUIRE CURVE AND SURFACE FACILITIES (3PP)
INTRO (3PP)
GENERALIZED DRAWING PRIMITIVE 3 -19 (3P)