IfcAxis2Placement3D IFC构件的位置和方向

IfcAxis2Placement3D定义了三维空间中物体的位置和方向,由三部分组成:

The attribute Axis defines the Z direction, RefDirection the X direction. The Y direction is derived.

注:Y轴方向由X轴和Z轴方向通过外积计算获得。

当Axis和RefDirection未定义时,X轴为P[1] ,默认值 [1.,0.,0.]。Y轴为P[2],默认值为[0.,1.,0.]。Z轴为P[3] ,默认值为[0.,0.,1.]。

属性定义

#AttributeTypeCardinalityDescriptionC
2 Axis IfcDirection [0:1] The exact direction of the local Z Axis. X
3 RefDirection IfcDirection [0:1] The direction used to determine the direction of the local X Axis. If necessary an adjustment is made to maintain orthogonality to the Axis direction. If Axis and/or RefDirection is omitted, these directions are taken from the geometric coordinate system. X
  P
:=IfcBuildAxes(Axis, RefDirection)
IfcDirection L[3:3] The normalized directions of the placement X Axis (P[1]) and the placement Y Axis (P[2]) and the placement Z Axis (P[3]). X

 

RuleDescription
LocationIs3D The dimensionality of the placement location shall be 3.
AxisIs3D The Axis when given should only reference a three-dimensional IfcDirection.
RefDirIs3D The RefDirection when given should only reference a three-dimensional IfcDirection.
AxisToRefDirPosition The Axis and RefDirection shall not be parallel or anti-parallel.
AxisAndRefDirProvision Either both, Axis and RefDirection are not given and therefore defaulted, or both shall be given.
继承关系:

 

属性

#AttributeTypeCardinalityDescriptionC
IfcRepresentationItem
  LayerAssignment IfcPresentationLayerAssignment
@AssignedItems
S[0:1] Assignment of the representation item to a single or multiple layer(s). The LayerAssignments can override a LayerAssignments of the IfcRepresentation it is used within the list of Items. X
  StyledByItem IfcStyledItem
@Item
S[0:1] Reference to the IfcStyledItem that provides presentation information to the representation, e.g. a curve style, including colour and thickness to a geometric curve. X
IfcGeometricRepresentationItem
IfcPlacement
1 Location IfcCartesianPoint [1:1] The geometric position of a reference point, such as the center of a circle, of the item to be located. X
  Dim
:=Location.Dim
IfcDimensionCount [1:1] The space dimensionality of this class, derived from the dimensionality of the location. X
IfcAxis2Placement3D
2 Axis IfcDirection [0:1] The exact direction of the local Z Axis. X
3 RefDirection IfcDirection [0:1] The direction used to determine the direction of the local X Axis. If necessary an adjustment is made to maintain orthogonality to the Axis direction. If Axis and/or RefDirection is omitted, these directions are taken from the geometric coordinate system. X
  P
:=IfcBuildAxes(Axis, RefDirection)
IfcDirection L[3:3] The normalized directions of the placement X Axis (P[1]) and the placement Y Axis (P[2]) and the placement Z Axis (P[3]). X
 
ENTITY IfcAxis2Placement3D
 SUBTYPE OF (IfcPlacement);
  Axis : OPTIONAL IfcDirection;
  RefDirection : OPTIONAL IfcDirection;
 DERIVE
  P : LIST [3:3] OF IfcDirection := IfcBuildAxes(Axis, RefDirection);
 WHERE
  LocationIs3D : SELF\IfcPlacement.Location.Dim = 3;
  AxisIs3D : (NOT (EXISTS (Axis))) OR (Axis.Dim = 3);
  RefDirIs3D : (NOT (EXISTS (RefDirection))) OR (RefDirection.Dim = 3);
  AxisToRefDirPosition : (NOT (EXISTS (Axis))) OR (NOT (EXISTS (RefDirection))) OR (IfcCrossProduct(Axis,RefDirection).Magnitude > 0.0);
  AxisAndRefDirProvision : NOT ((EXISTS (Axis)) XOR (EXISTS (RefDirection)));
END_ENTITY;

 

DATA;
#1= IFCORGANIZATION($,'Autodesk Revit 2015 (CHS)',$,$,$);
#5= IFCAPPLICATION(#1,'2015','Autodesk Revit 2015 (CHS)','Revit');
#6= IFCCARTESIANPOINT((0.,0.,0.));
#9= IFCCARTESIANPOINT((0.,0.));
#11= IFCDIRECTION((1.,0.,0.));
#13= IFCDIRECTION((-1.,0.,0.));
#15= IFCDIRECTION((0.,1.,0.));
#17= IFCDIRECTION((0.,-1.,0.));
#19= IFCDIRECTION((0.,0.,1.));
#21= IFCDIRECTION((0.,0.,-1.));
#23= IFCDIRECTION((1.,0.));
#25= IFCDIRECTION((-1.,0.));
#27= IFCDIRECTION((0.,1.));
#29= IFCDIRECTION((0.,-1.));

#31= IFCAXIS2PLACEMENT3D(#6,$,$);
#15794= IFCAXIS2PLACEMENT3D(#6,$,$);
#15795= IFCLOCALPLACEMENT($,#15794);
#32= IFCLOCALPLACEMENT(#15795,#31);

#117= IFCAXIS2PLACEMENT3D(#6,$,$);
#118= IFCLOCALPLACEMENT(#32,#117);

#803= IFCCARTESIANTRANSFORMATIONOPERATOR3D($,$,#6,1.,$);
#684= IFCSHAPEREPRESENTATION(#88,'Body','SweptSolid',(#674));
#686= IFCAXIS2PLACEMENT3D(#6,$,$);
#687= IFCREPRESENTATIONMAP(#686,#684);



#1255= IFCMAPPEDITEM(#687,#803);
#1256= IFCSHAPEREPRESENTATION(#88,'Body','MappedRepresentation',(#1255));
#1258= IFCPRODUCTDEFINITIONSHAPE($,$,(#1256));

#1260= IFCCARTESIANPOINT((1325.86888709244,31631.0676658748,0.));
#1262= IFCAXIS2PLACEMENT3D(#1260,$,$);
#1263= IFCLOCALPLACEMENT(#118,#1262);
#1264= IFCCOLUMN('2ILfSTle57UhpKxVJ8Mj7L',#41,'\X2\7EFC5408697C\X0\-\X2\6DF751DD571F77E95F6267F1\X0\:450 x 600 mm:365232',$,'450 x 600 mm',#1263,#1258,'365232');

 

计算构件y轴方向

#1 = IfcDirection((0.,0.,1.));   //z轴
#2 = IfcDirection((1.,0.,1.));    //x轴
#3 = IfcAxis2Placement3D($,#1,#2);   //叉积计算出y轴 (0 ,1, 0)      
#4 = IfcLocalPlacement($,#3);
#5 = IfcDirection((0.,1.,0.));  //z轴
#6 = IfcDirection((1.,0.,1.));   //x轴
#7 = IfcAxis2Placement3D($,#5,#6);  //叉积计算出y轴(1, 0, -1)
#8 = IfcLocalPlacement(#4,#7);   //矩阵相乘(注意顺序)结果:x轴(0,0,1)y轴(1,0,0)z轴(0,1,0)

向量叉积计算

#include <iostream>

using namespace std;

struct Vec {
    double x;
    double y;
    double z;
};

Vec ThreeCross(const Vec& a, const Vec& b)
{
    Vec C;
    C.x = a.y * b.z - a.z * b.y;
    C.y = a.z * b.x - a.x * b.z;
    C.z = a.x * b.y - a.y * b.x;
    return C;
}


int main()
{
    Vec v1;
    v1.x = 0;
    v1.y = 0;
    v1.z = 1;

    Vec v2;
    v2.x = 1;
    v2.y = 0;
    v2.z = 1;

    Vec v3 = ThreeCross(v1,v2);

    cout << v3.x << "  " << v3.y << "  " << v3.z << endl;

    system("pause");
    return 0;
}

向量叉积计算公式:

a=(X1,Y1,Z1),b=(X2,Y2,Z2),
a×b=(Y1Z2 - Y2Z1,Z1X2 - Z2X1,X1Y2 - X2Y1)
V1(1,2,3)

V2(4,5,6)

V1 * V2=(12-15,12-6,5-8)=(-3,6,-3)

 

 

 

 

 

参考:https://blog.csdn.net/liyazhen2011/article/details/82347074

posted @ 2019-07-31 11:53  西北逍遥  阅读(1030)  评论(0编辑  收藏  举报