Navigation

IfcFirstProjAxis

Function Semantic 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 ZAxis. With Arg defaulted the result is the projection of (1.0,0.0,0.0) onto this plane except that if ZAxis = (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 ZAxis.

NOTE Corresponding STEP function first_proj_axis, new function in IFC Release 1.5. Please refer to ISO/IS 10303-42:1994, p. 102 for the final definition of the formal standard.

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 := IfcDummyGri || IfcDirection([1.0,0.0,0.0]);
      ELSE
        V := IfcDummyGri || 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;