#### IfcFirstProjAxis

##### Semantic definitions at the function

Function Definition

Definition from 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 Corresponding STEP function: first_proj_axis. Please refer to ISO/IS 10303-42:1994, p.102 for the final definition of the formal standard.
> HISTORY New function in IFC Release 1.5

##### Formal representations

EXPRESS Specification

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;

Link to this page