码迷,mamicode.com
首页 > 其他好文 > 详细

IfcNormalise

时间:2021-03-06 14:48:30      阅读:0      评论:0      收藏:0      [点我收藏+]

标签: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;

 

IfcNormalise

标签:orm   vector   输入   ISE   rect   类型   oca   cto   sts   

原文地址:https://www.cnblogs.com/herd/p/14459820.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!