IfcFirstProjAxis

函数定义

注:定义符合ISO/CD 10303-42:1992
此函数生成三维方向,即在完全定义输入的情况下,arg在垂直于z轴的平面上的投影。默认为arg时,结果是(1.0,0.0,0.0)在此平面上的投影,但如果z轴=(1.0,0.0,0.0),则(0.0,1.0,0.0)用作arg的初始值。如果arg与输入z轴的方向相同,则会发生冲突。
注:根据ISO 10303-42中定义的第一个投影轴改编的功能。
IFC1.5中增加的新函数

 

EXPRESS Specification

FUNCTION IfcFirstProjAxis
  (ZAxis, Arg : IfcDirection) : IfcDirection;
LOCAL
  XAxis : IfcDirection;
  V     : IfcDirection;
  Z     : IfcDirection;
  XVec  : IfcVector;
END_LOCAL;

  IF (NOT EXISTS(ZAxis)) THEN
    RETURN (?) ;
  ELSE
    Z := IfcNormalise(ZAxis);
    IF NOT EXISTS(Arg) THEN
      IF (Z.DirectionRatios <> [1.0,0.0,0.0]) THEN
        V := IfcRepresentationItem() || IfcGeometricRepresentationItem () || IfcDirection([1.0,0.0,0.0]);
      ELSE
        V := IfcRepresentationItem() || IfcGeometricRepresentationItem () || IfcDirection([0.0,1.0,0.0]);
      END_IF;
    ELSE
      IF (Arg.Dim <> 3) THEN
        RETURN (?) ;
      END_IF;
      IF ((IfcCrossProduct(Arg,Z).Magnitude) = 0.0) THEN
        RETURN (?);
      ELSE
        V := IfcNormalise(Arg);
      END_IF;
    END_IF;
    XVec  := IfcScalarTimesVector(IfcDotProduct(V, Z), Z);
    XAxis := IfcVectorDifference(V, XVec).Orientation;
    XAxis := IfcNormalise(XAxis);
  END_IF;
  RETURN(XAxis); 
END_FUNCTION;

 

posted @ 2021-03-03 07:08  西北逍遥  阅读(57)  评论(0编辑  收藏  举报