Navigation

IfcScalarTimesVector

Function Semantic Definition
Definition from ISO/CD 10303-42:1992: This function returns the vector that is the scalar multiple of the input vector. It accepts as input a scalar and a 'vector' which may be either a Direction or a Vector. The output is a Vector of the same units as the input vector or unitless if a direction is input. If either input argument is undefined then the returned vector is also undefined.

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

EXPRESS specification:

FUNCTION IfcScalarTimesVector
  (Scalar : REAL; Vec : IfcVectorOrDirection)
    : IfcVector;
LOCAL
  V : IfcDirection;
  Mag : REAL;
  Result : IfcVector;
END_LOCAL;

  IF NOT EXISTS (Scalar) OR NOT EXISTS (Vec) THEN
    RETURN (?) ;
  ELSE
    IF 'IFCGEOMETRYRESOURCE.IFCVECTOR' IN TYPEOF (Vec) THEN
      V := Vec.Orientation;
      Mag := Scalar * Vec.Magnitude;
    ELSE
      V := Vec;
      Mag := Scalar;
    END_IF;
    IF (Mag < 0.0 ) THEN
      REPEAT i := 1 TO SIZEOF(V.DirectionRatios);
        V.DirectionRatios[i] := -V.DirectionRatios[i];
      END_REPEAT;
      Mag := -Mag;
    END_IF;
    Result := IfcRepresentationItem() || IfcGeometricRepresentationItem () || IfcVector(IfcNormalise(V), Mag);
  END_IF;
  RETURN (Result);
END_FUNCTION;