# Synopsis

PDX_MSGT gcr_NurbSurf(long option, MDA_PTR orig_db_ptr, int u_degree, int v_degree, int surface_type, MDA_COUNT num_of_u_ctrl_pts, MDA_COUNT num_of_v_ctrl_pts, double **ctrl_pts, double *u_knots, double *v_knots, double u_bounds[2], double v_bounds[2], int gdx_model, MDA_PTR *gdx_NS_ptr)

# Purpose

Create a GDX NURB Surface.

# Description

Given a set of U and V 4D XYZW control points (and weights), the knots, the weights and the U and V degree of the NURB surface, creates a GDX NURB surface.

The U and V degree (u_degree and v_degree) must be > 0 and the number of U and V control points (num_of_u_ctrl_pts and num_of_v_ctrl_pts) must be > 1.

If the weights are all the same, then the surface is flagged as non-rational and all the control points are modified such that the weights are 1.0.

If any of the weights are different, the the surface is flagged as rational.

If any of the weights are zero, the surface is not created and an error is returned.

If the NURB surface contains more than 2 distinct points in U and/or V and the surface U and/or V boundaries are within the current GDX PARM_SPACE_PNT_TOL, the GDX NURB surface is flagged as closed in the U and/or V parametric direction.

If the GDX NURB surface un-clamped, then the GDX NURB surface is flagged as periodic.

If the u_knots and/or v_knots knot values arrays are NULL, then the NURB surface is assumed to be a Bezier surface and the GDX NURB surface U and/or V knot values are generated.

If the knot value array is specified, the knot multiplicity must not exceed order within the current GDX KNOT_TOL. In addition, the knot sequence must be in increasing order.

If the NURB surface is clamped, then the starting and ending orderful knots must be identical.

If only the first and/or last U or V knots differ from the first and/or last orderful U or V knots, the first and/or last U or V knot is made the same as the remaining first and/or last orderful U or V knot.

The GDX NURB surface is parameterized from the degreed indexed knot to the degreed knot from the end of the knots in the U and V parametric direction.

\fBRules\fR .IP • 3 u_degree > 0 .IP • 3 v_degree > 0 .IP • 3 num_of_u_ctrl_pts > 1 .IP • 3 num_of_v_ctrl_pts > 1 .LP

# Input

## option

### GCR_NOVALIDATE

No validation will occur on the input data.

## orig_db_ptr

The original entities orig_db_ptr as obtained from the mda_GetOrigDbptr call, or MDA_NULL_PTR

## u_degree

The U degree of the NURB surface (Must be > 0)

## v_degree

The V degree of the NURB surface (Must be > 0)

## surface_type

### GDX_NURB_GENERAL

The general form of the NURB surface

### GDX_NURB_PLANE

The plane form of the NURB surface

### GDX_NURB_CYLINDER

The cylinder form of the NURB surface

### GDX_NURB_CONE

The cone form of the NURB surface

### GDX_NURB_SPHERE

The sphere form of the NURB surface

### GDX_NURB_TORUS

The torus form of the NURB surface

### GDX_NURB_SREV

The surface of revolution form of the NURB surface

### GDX_NURB_TABCYL

The tabulated cylinder form of the NURB surface

### GDX_NURB_RULED

The ruled form of the NURB surface

### GDX_NURB_QUAD

The quadratic form of the NURB surface

### GDX_NURB_OFFSET_SURF

The offset form of the NURB surface

### GDX_NURB_CURV_SURF

The curve form of the NURB surface

### GDX_NURB_POINT_SURF

The point form of the NURB surface

## num_of_u_ctrl_pts

The number of U control points for each V of the NURB surface (Must be > 1)

## num_of_v_ctrl_pts

The number of V control points for the NURB surface (Must be > 1)

## ctrl_pts

MDA memory array containing the 4D X, Y, Z, W control point coordinates and weights. Assumes point multiplied by weight. ctrl_pts[num_of_v_ctrl_pts][num_of_u_ctrl_pts * 4] Always consumed by this function even on error.

## u_knots

MDA memory containing the U knots for the NURB surface, or NULL. Always consumed by this function even on error.

## v_knots

MDA memory containing the V knots for the NURB surface, or NULL. Always consumed by this function even on error.

## u_bounds

The U active parametric domain of the curve, or NULL. If value is NULL, gdx u_bounds[0] = u_knots[u_degree] and u_bounds[1] = u_knots[num_of_u_knots - u_order];

## v_bounds

The U active parametric domain of the curve, or NULL. If value is NULL, gdx v_bounds[0] = v_knots[v_degree] and v_bounds[1] = v_knots[num_of_v_knots - v_order];

## gdx_model

The GDX model for entity creation

# Output

## gdx_NS_ptr

Entity database pointer of the GDX NURB Surface

# Tolerances

          GDX KNOT_TOL
          GDX PARM_SPACE_PNT_TOL
          .fi

# Return

          GCR_NOERR
          GCR_INVALID_MODEL
          GCR_NURB_U_DEGREE
          GCR_NURB_V_DEGREE
          GCR_NURB_U_CTRL_PNTS
          GCR_NURB_V_CTRL_PNTS
          GCR_NURB_ZERO_WEIGHT
          Low level error return
          .fi