First Proj Axis |
NOTE Definition according to ISO/CD 10303-42:1992
This function produces a three dimensional direction which is, with fully defined input, the projection of arg onto the plane normal to the z-axis. With arg defaulted the result is the projection of (1.0,0.0,0.0) onto this plane except that if z-axis = (1.0,0.0,0.0) then (0.0,1.0,0.0) is used as initial value of arg. A violation occurs if arg is in the same direction as the input z-axis.
NOTE Function adapted from first_proj_axis defined in ISO 10303-42.
HISTORY New function in IFC1.5
FUNCTION IfcFirstProjAxis
(ZAxis, Arg : IfcDirection) : IfcDirection;
LOCAL
XAxis : IfcDirection;
V : IfcDirection;
Z : IfcDirection;
XVec : IfcVector;
END_LOCAL;
IF (NOT EXISTS(ZAxis)) THEN
RETURN (?) ;
ELSE
Z := IfcNormalise(ZAxis);
IF NOT EXISTS(Arg) THEN
IF (Z.DirectionRatios <> [1.0,0.0,0.0]) THEN
V := IfcRepresentationItem() || IfcGeometricRepresentationItem () || IfcDirection([1.0,0.0,0.0]);
ELSE
V := IfcRepresentationItem() || IfcGeometricRepresentationItem () || IfcDirection([0.0,1.0,0.0]);
END_IF;
ELSE
IF (Arg.Dim <> 3) THEN
RETURN (?) ;
END_IF;
IF ((IfcCrossProduct(Arg,Z).Magnitude) = 0.0) THEN
RETURN (?);
ELSE
V := IfcNormalise(Arg);
END_IF;
END_IF;
XVec := IfcScalarTimesVector(IfcDotProduct(V, Z), Z);
XAxis := IfcVectorDifference(V, XVec).Orientation;
XAxis := IfcNormalise(XAxis);
END_IF;
RETURN(XAxis);
END_FUNCTION;