Navigation
Navigate Navigate Navigate Navigate

IfcDotProduct

Definition from ISO/CD 10303-42:1992: This function returns the scalar (or dot) product of two directions. The input arguments can be directions in either two- or three-dimensional space. The returned scalar is undefined if the input directions have different dimensionality, or if either is undefined.

NOTE  Corresponding STEP function: dot_product. Please refer to ISO/IS 10303-42:1994, p.104 for the final definition of the formal standard. 

HISTORY  New function in IFC Release 1.5

EXPRESS specification:

FUNCTION IfcDotProduct
  (Arg1, Arg2 : IfcDirection) 
    : REAL;
LOCAL
  Scalar : REAL;
  Vec1, Vec2 : IfcDirection;
  Ndim   : INTEGER;
END_LOCAL;

  IF NOT EXISTS (Arg1) OR NOT EXISTS (Arg2) THEN
    Scalar := ?;
  ELSE
    IF (Arg1.Dim <> Arg2.Dim) THEN
      Scalar := ?;
    ELSE
      BEGIN
        Vec1 := IfcNormalise(Arg1);
        Vec2 := IfcNormalise(Arg2);
        Ndim := Arg1.Dim;
        Scalar := 0.0;
        REPEAT i := 1 TO Ndim;
          Scalar := Scalar + Vec1.DirectionRatios[i]*Vec2.DirectionRatios[i];
        END_REPEAT;
      END;
    END_IF;
  END_IF;
  RETURN (Scalar);
END_FUNCTION;