标签:orm vector 输入 ISE rect 类型 oca cto sts
注:定义符合ISO/CD 10303-42:1992
此函数返回一个向量或方向,其分量被规格化为平方和为1.0。输出与输入参数的类型相同(方向或向量,单位相同)。如果输入参数未定义或长度为零,则输出向量未定义。
注:函数改编自ISO 10303-42中定义的标准化。
IFC1.5中的新函数
EXPRESS Specification
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
IF ‘IFCGEOMETRYRESOURCE.IFCVECTOR‘ IN TYPEOF(Arg) THEN
BEGIN
Ndim := Arg\IfcVector.Dim;
V.DirectionRatios := Arg\IfcVector.Orientation.DirectionRatios;
Vec.Magnitude := Arg\IfcVector.Magnitude;
Vec.Orientation := V;
IF Arg\IfcVector.Magnitude = 0.0 THEN
RETURN(?);
ELSE
Vec.Magnitude := 1.0;
END_IF;
END;
ELSE
BEGIN
Ndim := Arg\IfcDirection.Dim;
V.DirectionRatios := Arg\IfcDirection.DirectionRatios;
END;
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 ‘IFCGEOMETRYRESOURCE.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;
标签:orm vector 输入 ISE rect 类型 oca cto sts
原文地址:https://www.cnblogs.com/herd/p/14459820.html