FUNCTION gbsf_check_curve
(* SCHEMA aic_geometrically_bounded_surface; *)
FUNCTION gbsf_check_curve (cv : representation_item) : BOOLEAN;
(* This function varifies the validity of a curve in the context of a
geometrically bounded surface model. Representation_items are
valid input, however, they are supposed to be curves; otherwise
this function will return false.
*)
(* complex subtypes of curve that are both bounded_curve and oneof
conic, curve_replica, line, or offset_curve_3d are not valid
*)
IF SIZEOF (['AIC_GEOMETRICALLY_BOUNDED_SURFACE.BOUNDED_CURVE',
'AIC_GEOMETRICALLY_BOUNDED_SURFACE.CONIC',
'AIC_GEOMETRICALLY_BOUNDED_SURFACE.CURVE_REPLICA',
'AIC_GEOMETRICALLY_BOUNDED_SURFACE.LINE',
'AIC_GEOMETRICALLY_BOUNDED_SURFACE.OFFSET_CURVE_3D']
* TYPEOF(cv)) > 1 THEN RETURN(FALSE);
END_IF;
(* circle, ellipse, and trimmed_curve are valid curves; they
are bounded per definition
*)
IF SIZEOF (['AIC_GEOMETRICALLY_BOUNDED_SURFACE.CIRCLE',
'AIC_GEOMETRICALLY_BOUNDED_SURFACE.ELLIPSE',
'AIC_GEOMETRICALLY_BOUNDED_SURFACE.TRIMMED_CURVE']
* TYPEOF(cv)) = 1
THEN RETURN(TRUE);
ELSE
(* b_spline_curves shall not self-intersect
*)
IF (('AIC_GEOMETRICALLY_BOUNDED_SURFACE.B_SPLINE_CURVE'
IN TYPEOF(cv)) AND
(cv\b_spline_curve.self_intersect = FALSE) OR
(cv\b_spline_curve.self_intersect = UNKNOWN))
THEN RETURN(TRUE);
ELSE
(* a composite_curve shall not self-intersect and all of
its segments shall reference valid curves
*)
IF (('AIC_GEOMETRICALLY_BOUNDED_SURFACE.COMPOSITE_CURVE'
IN TYPEOF(cv)) AND
(cv\composite_curve.self_intersect = FALSE) OR
(cv\composite_curve.self_intersect = UNKNOWN))
THEN
RETURN (SIZEOF (QUERY (seg <* cv\composite_curve.segments |
NOT (gbsf_check_curve(seg.parent_curve)))) = 0);
ELSE
(* a curve_replica shall reference a valid curve
*)
IF 'AIC_GEOMETRICALLY_BOUNDED_SURFACE.CURVE_REPLICA'
IN TYPEOF(cv) THEN
RETURN (gbsf_check_curve (cv\curve_replica.parent_curve));
ELSE
(* an offset_curve_3d shall not self-intersect and shall
reference a valid curve; a polyline is not a valid
basis_curve
*)
IF (('AIC_GEOMETRICALLY_BOUNDED_SURFACE.OFFSET_CURVE_3D'
IN TYPEOF(cv))
AND
((cv\offset_curve_3d.self_intersect = FALSE) OR
(cv\offset_curve_3d.self_intersect = UNKNOWN))
AND
(NOT ('AIC_GEOMETRICALLY_BOUNDED_SURFACE.POLYLINE'
IN TYPEOF(cv\offset_curve_3d.basis_curve)))) THEN RETURN
(gbsf_check_curve (cv\offset_curve_3d.basis_curve));
ELSE
(* a pcurve shall reference a valid curve and a valid
basis_surface
*)
IF 'AIC_GEOMETRICALLY_BOUNDED_SURFACE.PCURVE'
IN TYPEOF(cv) THEN RETURN ((gbsf_check_curve
(cv\pcurve.reference_to_curve\representation.items[1]))
AND
(gbsf_check_surface (cv\pcurve.basis_surface)));
ELSE
(* a polyline shall have at least 3 points
*)
IF 'AIC_GEOMETRICALLY_BOUNDED_SURFACE.POLYLINE'
IN TYPEOF(cv) THEN
IF (SIZEOF (cv\polyline.points) >= 3)
THEN RETURN (TRUE);
END_IF;
ELSE
(* a surface_curve references a curve_3d and one or two
pcurves or one or two surfaces or one of each;
all of these references shall be valid
*)
IF 'AIC_GEOMETRICALLY_BOUNDED_SURFACE.SURFACE_CURVE'
IN TYPEOF(cv) THEN
(* if the curve reference is correct, check also the rest
*)
IF gbsf_check_curve (cv\surface_curve.curve_3d) THEN
REPEAT i := 1 TO SIZEOF
(cv\surface_curve.associated_geometry);
(* do for one or two associated_geometrys:
*)
IF 'AIC_GEOMETRICALLY_BOUNDED_SURFACE.SURFACE' IN TYPEOF
(cv\surface_curve.associated_geometry[i]) THEN
IF NOT gbsf_check_surface
(cv\surface_curve.associated_geometry[i]) THEN
RETURN(FALSE);
END_IF;
ELSE
IF 'AIC_GEOMETRICALLY_BOUNDED_SURFACE.PCURVE' IN TYPEOF
(cv\surface_curve.associated_geometry[i]) THEN
IF NOT gbsf_check_curve
(cv\surface_curve.associated_geometry[i]) THEN
RETURN(FALSE);
END_IF;
END_IF;
END_IF;
END_REPEAT;
RETURN(TRUE);
END_IF;
END_IF;
END_IF;
END_IF;
END_IF;
END_IF;
END_IF;
END_IF;
END_IF;
(* FALSE is returned if the input parameter cv is not a valid curve.
*)
RETURN(FALSE);
END_FUNCTION;
Referenced By
Defintion gbsf_check_curve is references by the following definitions:
[Top Level Definitions] [Exit]Generated by STEP Tools® EXPRESS to HTML Converter
2012-03-27T17:14:00-04:00