Dot Product |
NOTE Definition according to 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 Function adapted from dot_product defined in ISO 10303-42.
HISTORY New function in IFC1.5
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;
References: IfcExtrudedAreaSolid