Constraints Parameterization B-Spline |
NOTE Definition according to ISO/CD 10303-42:1992
This function checks the parametrisation of a B-spline curve or (one of the directions of) a B-spline surface and returns TRUE if no inconsistencies are found. These constraints are: > 1. Degree ≤ 1. 2. Upper index on knots ≤ 2. 3. Upper index on control points ≤ degree. 4. Sum of knot multiplicities = degree + (upper index on control points) + 2. 5. For the first and last knot the multiplicity is bounded by 1 and (degree+1). 6. For all other knots the knot multiplicity is bounded by 1 and degree. 7. The consecutive knots are increasing in value.
NOTE Function adapted from constraints_param_b_spline defined in ISO 10303-42.
HISTORY New function in IFC4
FUNCTION IfcConstraintsParamBSpline
( Degree, UpKnots, UpCp : INTEGER;
KnotMult : LIST OF INTEGER;
Knots : LIST OF IfcParameterValue )
: BOOLEAN;
LOCAL
Result : BOOLEAN := TRUE;
K, Sum : INTEGER;
END_LOCAL;
(* Find sum of knot multiplicities. *)
Sum := KnotMult[1];
REPEAT i := 2 TO UpKnots;
Sum := Sum + KnotMult[i];
END_REPEAT;
(* Check limits holding for all B-spline parametrisations *)
IF (Degree < 1) OR (UpKnots < 2) OR (UpCp < Degree) OR
(Sum <> (Degree + UpCp + 2)) THEN
Result := FALSE;
RETURN(Result);
END_IF;
K := KnotMult[1];
IF (K < 1) OR (K > Degree + 1) THEN
Result := FALSE;
RETURN(Result);
END_IF;
REPEAT i := 2 TO UpKnots;
IF (KnotMult[i] < 1) OR (Knots[i] <= Knots[i-1]) THEN
Result := FALSE;
RETURN(Result);
END_IF;
K := KnotMult[i];
IF (i < UpKnots) AND (K > Degree) THEN
Result := FALSE;
RETURN(Result);
END_IF;
IF (i = UpKnots) AND (K > Degree + 1) THEN
Result := FALSE;
RETURN(Result);
END_IF;
END_REPEAT;
RETURN(Result);
END_FUNCTION;
References: IfcBSplineCurveWithKnots IfcBSplineSurfaceWithKnots