FUNCTION IfcNormalise

(* SCHEMA IFC2X3; *)
FUNCTION IfcNormalise
	(Arg : IfcVectorOrDirection)
	: IfcVectorOrDirection;
  LOCAL
    Ndim : INTEGER;
    V    : IfcDirection
         := IfcRepresentationItem() || IfcGeometricRepresentationItem () || IfcDirection([1.,0.]); 
    Vec  : IfcVector 
         := IfcRepresentationItem() || IfcGeometricRepresentationItem () || IfcVector (
              IfcRepresentationItem() || IfcGeometricRepresentationItem () || IfcDirection([1.,0.]), 1.);
    Mag  : REAL;
    Result : IfcVectorOrDirection
           := V;
  END_LOCAL;
  
    IF NOT EXISTS (Arg) THEN
      RETURN (?);
    ELSE
      Ndim := Arg.Dim;
      IF 'IFC2X3.IFCVECTOR' IN TYPEOF(Arg) THEN
        BEGIN
  	V.DirectionRatios := Arg\IfcVector.Orientation.DirectionRatios;
          Vec.Magnitude := Arg\IfcVector.Magnitude;
  	Vec.Orientation := V;
          IF Arg.Magnitude = 0.0 THEN
            RETURN(?);
          ELSE
            Vec.Magnitude := 1.0;
          END_IF;
        END;
      ELSE
        V.DirectionRatios := Arg.DirectionRatios;
      END_IF;
      Mag := 0.0;
        REPEAT i := 1 TO Ndim;
          Mag := Mag + V.DirectionRatios[i]*V.DirectionRatios[i];
        END_REPEAT;
      IF Mag > 0.0 THEN
        Mag := SQRT(Mag);
        REPEAT i := 1 TO Ndim;
          V.DirectionRatios[i] := V.DirectionRatios[i]/Mag;
        END_REPEAT;
        IF 'IFC2X3.IFCVECTOR' IN TYPEOF(arg) THEN
          Vec.Orientation := V;
          Result := Vec;
        ELSE
          Result := V;
        END_IF;
      ELSE
        RETURN(?);
      END_IF;
    END_IF;
    RETURN (Result);
END_FUNCTION;

Referenced By

Defintion IfcNormalise is references by the following definitions:
DefinitionType
 IfcAxis1Placement ENTITY
 IfcBaseAxis FUNCTION
 IfcBuild2Axes FUNCTION
 IfcBuildAxes FUNCTION
 IfcCrossProduct FUNCTION
 IfcDotProduct FUNCTION
 IfcFirstProjAxis FUNCTION
 IfcScalarTimesVector FUNCTION
 IfcSecondProjAxis FUNCTION
 IfcVectorDifference FUNCTION
 IfcVectorSum FUNCTION


[Top Level Definitions] [Exit]

Generated by STEP Tools® EXPRESS to HTML Converter
2012-03-27T17:21:14-04:00