SunPHIGS 3.0 Extensions Reference Manual
  Search only this book
Download this book in PDF

NAME

NON-UNIFORM B-SPLINE CURVE - create a non-uniform B-spline curve structure element

SYNOPSIS

C Syntax

void
pnuni_bsp_curv ( order, knots, rationality, cpoints, min, max )
Pint            order;        spline order
Pfloat_list      * knots;      list of knots
Prational       rationality;  rationality specifier
Ppoint_list34   * cpoints;    list of 3D or 4D control points
Pfloat           min, max;     parameter range

FORTRAN Syntax

SUBROUTINE pnubsc (ORDER, NKNOTS, KNOTS, RATSEL, NCPTS, CPTS, MIN, MAX )
INTEGER      ORDER                 spline order
INTEGER      NKNOTS                number of knots
REAL         KNOTS(NKNOTS)         list of knots
INTEGER      RATSEL                rationality specifier (PRAT, PNRAT)
INTEGER      NCPTS                 number of control points
REAL         CPTS(4,NCPTS)         control points (MC)
REAL         MIN, MAX              parameter range

Required PHIGS Operating States

(PHOP, * ,STOP, * )

DESCRIPTION

Purpose

NON-UNIFORM B-SPLINE CURVE creates a structure element containing the definition of a non-uniform B-spline curve. The curve can be rational or nonrational.
This is a SunPHIGS Extension function based on PHIGS PLUS and is not part of the PHIGS standard.

C Input Parameters

order
The order of the curve. The degree of the curve's basic functions is one less than order.
knots
A pointer to a Pfloat_list structure containing a nondecreasing sequence of real numbers specifying the knot vector of the curve. 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 of the curve. Prational is defined in phigs.h as follows:
typedef enum {
PNON_RATIONAL = 0 ,
PRATIONAL = 1
} Prational;
cpoints A pointer to a Ppoint_list34 structure containing the list of the curve's control
points. The points are specified in Modelling Coordinates. Ppoint_list34 is defined in phigs.h as follows:
typedef struct {
/* list of 3D or 4D points * /
Pint
num_points;
/* number of control points * /
union {
        Ppoint3     * point3d;      /* array of 3D points * /
        Ppoint4     * point4d;      /* array of 4D points * /
} points;

} Ppoint_list34;
The point4d member of the points union is used if rationality is PRATIONAL; otherwise, the point3d member is used.
Ppoint3 is defined in phigs.h as follows:
typedef struct {
Pfloat   x;   /* x coordinate * /
Pfloat   y;   /* y coordinate * /
Pfloat   z;   /* z coordinate * /

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

} Ppoint4;
min, max
The parameter limits specifying the range over which the curve is to be evaluated.

FORTRAN Input Parameters

All of the following data types are predefined in phigs77.h.
ORDER The order of the curve. The degree of the curve's basis functions is one less than
ORDER.
NKNOTS
The number of knots in the curve's knot vector.
KNOTS(NKNOTS)
An array containing a nondecreasing sequence of real numbers specifying the curve's knot vector.
RATSEL
An integer specifying the rationality and hence the dimensionality of the control points. Valid values are defined as:
PRAT
Rational
PNRAT
Nonrational
NCPTS The number of control points.
CPTS(4,NCPTS)
The x, y, z, and w coordinates of the curve's control points. The points are specified in Modelling Coordinates (MC) and correspond to the array positions as follows:
CPTS(1 , * =) x Coordinate
CPTS(2 , * =) y Coordinate
CPTS(3 , * =) z Coordinate
CPTS(4 , * =) w Coordinate
The w coordinates are not used if the rationality is PNRAT.
MIN, MAX
The parameter limits specifying the range over which the curve is to be evaluated.

Execution

Depending on the edit mode, a NON-UNIFORM B-SPLINE CURVE element is either inserted into the open structure after the element pointer, or replaces the element to which the element pointer points. The element pointer is then updated to point to the NON-UNIFORM B-SPLINE CURVE structure element.
The spline order must be greater than zero. Curves of unsupported order will be displayed by drawing a polyline connecting the control points. Curves of order one are drawn as a polymarker using the current polymarker attributes.
The knots must form a nondecreasing sequence of numbers.
The rationality selector parameter may have the enumerated value Rational or Nonrational. When Rational is specified, the control points are specified as 4D homogeneous modelling coordinates. When Nonrational is specified, the control points are 3DPHIGS modelling coordinates.
The number of control points must be at least as large as the order. The number of control points plus the spline order must equal the number of knots.
The parameter range values, min and max, specify over what range the curve is evaluated. The value min must be less than max and greater than or equal to the order-th knot value. The value max must be less than or equal to the (k+1-order)-th knot value, where k is the
number of knots.
At structure traversal time, a non-uniform B-spline curve primitive is drawn using the extended polyline attributes. The curve approximation criteria is applied between MIN and MAX. See SET POLYLINE REPRESENTATION PLUS and SET CURVE APPROXIMATION CRITERIA for more information on display attributes.

Attributes Applied

The attributes listed below are used to display the NON-UNIFORM B-SPLINE CURVE 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.
polyline colour
polyline colour index ASF
linewidth scale factor
linewidth scale factor ASF
linetype
linetype ASF
polyline shading method
polyline shading method ASF
curve approximation criteria
curve approximation criteria ASF
polyline index
depth cue index
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

ADD TRIMMING CURVE (3PP)
SET CURVE APPROXIMATION CRITERIA (3PP)
INQUIRE CURVE AND SURFACE FACILITIES (3PP)
SET POLYLINE REPRESENTATION PLUS (3PP)
INTRO (3PP)