## Bézier triangle definition

@BEZIER_TRIANGLE_DEFINITION {
@BEZIER_TRIANGLE_NAME {BzTrigName} {
@IS_DEFINED_IN_FRAME {FrameName} {
@POINT_DEFINITION {
@NUMBER_OF_CONTROL_POINTS {nu}
@DEGREE_OF_CURVE {pu}
@RATIONAL_CURVE_FLAG {RationalFlag}
@EDGE_CURVES {Curve0Name, Curve1Name, Curve2Name}
@COORDINATES {x1, x2, x3, ww}
}
}
}

### Surface parameterization

1. Figure 1 shows a Bézier triangle in space. The surface has an arbitrary shape in three-dimensional space. Surfaces can be defined with respect to a fixed frame, FrameName.
2. ##### Figure 1. Configuration of a surface.
3. The subsection @POINT_DEFINITION defines the shape of the Bézier triangle. Control parameters must be specified first:
1. The number of control points, nu, that define the overall shape of the Bézier triangle. nu defines the number of control points for each of the curves depicted on fig. 1.
2. The degree, pu, of the polynomials representing the curves. Note that nu > pu.
3. If RationalFlag == YES, the surface is a rational surface and weights must be defined for all control points. For a rational surface, the curves must be rational curves. If RationalFlag == NO, the surface is non rational and no weight are defined.
4. Next, nu (nu + 1) / 2 control points are defined. In general, a control point is defined by its @COORDINATES resolved in the fixed frame FrameName. The points are numbered in the order indicated in fig. 1.
5. It is often convenient to define the bounding curves labeled Curve 0, Curve 1, and Curve 2 in fig. 1. The curves can be specified as Curve0Name, Curve1Name, and Curve2Name, respectively. Note that the bounding curves must be specified in the order shown on the figure. The coordinates of the edge curves are not affected by the the fixed frame FrameName. Curves Curve0Name, Curve1Name and Curve2Name must each feature nu control points.
6. The user can either define all three bounding curves, or none. If the three bounding curves are defined, the remaining points must be defined by their @COORDINATES. In the example depicted in fig. 1, the remaining point would be point labeled 6.
7. If the surface is a rational surface, weights must be defined for each control point. If a control point is defined by its @COORDINATES, the fourth entry is the weight. The edge curves must then also be rational curves. The length along the u and v curves is measured by curvilinear variable u and v, respectively, see fig. 1. u = 0.0 and u = 1.0 correspond to curves Curve1Name, and Curve3Name, respectively. v = 0.0 and v = 1.0 correspond to curves Curve2Name, and Curve0Name, respectively. Values 0.0 ≤ u ≤ 1.0 and 0.0 ≤ v ≤ 1.0 define a point on the surface.
4. It is possible to attach comments to the definition of the object; these comments have no effect on its definition.

### Examples

#### Example 1.

The following example defines a planar Bézier triangle. The corner points are pointA, pointB, and pointC. At first, the three bounding curves are defined.

@CURVE_DEFINITION {
@CURVE_NAME {curveAB} {
@IS_DEFINED_IN_FRAME {INERTIAL}
@POINT_DEFINITION {
@NUMBER_OF_CONTROL_POINTS {2}
@DEGREE_OF_CURVE {1}
@RATIONAL_CURVE_FLAG {NO}
@END_POINT_0 {pointA}
@END_POINT_1 {pointB}
}
@CURVE_NAME {curveBC} {
@IS_DEFINED_IN_FRAME {INERTIAL}
@POINT_DEFINITION {
@NUMBER_OF_CONTROL_POINTS {2}
@DEGREE_OF_CURVE {1}
@RATIONAL_CURVE_FLAG {NO}
@END_POINT_0 {pointB}
@END_POINT_1 {pointC}
}
@CURVE_NAME {curveAC} {
@IS_DEFINED_IN_FRAME {INERTIAL}
@POINT_DEFINITION {
@NUMBER_OF_CONTROL_POINTS {2}
@DEGREE_OF_CURVE {1}
@RATIONAL_CURVE_FLAG {NO}
@END_POINT_0 {pointA}
@END_POINT_1 {pointC}
}

Since the curves are straight lines, no internal point need to be defined, the curves are entirely defined by the end points. Next, the Bézier triangle is defined.

@BEZIER_TRIANGLE_DEFINITION {
@BEZIER_TRIANGLE_NAME {surface} {
@IS_DEFINED_IN_FRAME {INERTIAL}
@POINT_DEFINITION {
@NUMBER_OF_CONTROL_POINTS {2, 2}
@DEGREE_OF_CURVE {1, 1}
@RATIONAL_CURVE_FLAG {NO}
@EDGE_CURVE_0 {curveAB}
@EDGE_CURVE_1 {curveBC}
@EDGE_CURVE_2 {curveAC}
}
}
}

Since the Bézier triangle only has 2 control points for each of the curves, no internal points are defined for this simple Bézier triangle.