IFC 4.4.0.0 build 20261005 (IFC4X4_DEV_20260525) ⚠ buildingSMART Working Draft. All content is under development.

  • Help suggest improvements
  • Get user or developer support

8.9.6.26 IfcVectorDifference

8.9.6.26.1 Semantic definition

{ .extDef}

8.9.6.26.2 Formal representation

FUNCTION IfcVectorDifference
(Arg1, Arg2 : IfcVectorOrDirection)
: IfcVector;
LOCAL
Result : IfcVector;
Res, Vec1, Vec2 : IfcDirection;
Mag, Mag1, Mag2 : REAL;
Ndim : INTEGER;
END_LOCAL;
IF ((NOT EXISTS (Arg1)) OR (NOT EXISTS (Arg2))) OR (Arg1.Dim <> Arg2.Dim) THEN
RETURN (?) ;
ELSE
BEGIN
IF 'IFC4X4_DEV_20260525.IFCVECTOR' IN TYPEOF(Arg1) THEN
Mag1 := Arg1\IfcVector.Magnitude;
Vec1 := Arg1\IfcVector.Orientation;
ELSE
Mag1 := 1.0;
Vec1 := Arg1;
END_IF;
IF 'IFC4X4_DEV_20260525.IFCVECTOR' IN TYPEOF(Arg2) THEN
Mag2 := Arg2\IfcVector.Magnitude;
Vec2 := Arg2\IfcVector.Orientation;
ELSE
Mag2 := 1.0;
Vec2 := Arg2;
END_IF;
Vec1 := IfcNormalise (Vec1);
Vec2 := IfcNormalise (Vec2);
Ndim := SIZEOF(Vec1.DirectionRatios);
Mag := 0.0;
Res := IfcRepresentationItem() || IfcGeometricRepresentationItem () || IfcDirection([0.0:Ndim]);
REPEAT i := 1 TO Ndim;
Res.DirectionRatios[i] := Mag1*Vec1.DirectionRatios[i] - Mag2*Vec2.DirectionRatios[i];
Mag := Mag + (Res.DirectionRatios[i]*Res.DirectionRatios[i]);
END_REPEAT;
IF (Mag > 0.0 ) THEN
Result := IfcRepresentationItem() || IfcGeometricRepresentationItem () || IfcVector( Res, SQRT(Mag));
ELSE
Result := IfcRepresentationItem() || IfcGeometricRepresentationItem () || IfcVector( Vec1, 0.0);
END_IF;
END;
END_IF;
RETURN (Result);
END_FUNCTION;

8.9.6.26.3 References

Edit on Github

3 contributor(s): ArturTomczakDion MoultbSI-Bot
Last change: Improve definition split (#876) * bring back headers headers were previously removed by mistake, now bringing them back * add new lines and rename the tag add the word 'short' in it * unify newlines make exactly one newline before and two after the tag * resolving typos Because bringing back headers required to go back in time to previous version, I'm now re-resolving the issues: #861, #860, #856 by ArturTomczak on 2024-07-16T16:07:28+02:00

Is this page difficult to understand? Let us know!