xBimTeam / XbimGeometry

XbimGeometry contains the CLR interop libraries and the c++ engine used to compute the 3D geometry of models.
https://xbimteam.github.io/
Other
260 stars 132 forks source link

Positioning elements with left local coordinate systems #346

Open GVladislavG opened 3 years ago

GVladislavG commented 3 years ago

Hello, xBim team! I need to locate some elements in the world space. These elements has transform matrix like this 1, 0, 0, 0 0,-1, 0, 0 0, 0, 1, 0 Ox, Oy, Oz, 1 It's left local coordinate system. If I pass these x-axis, z-axis and O coordinates to IfcAxis2Placement3D, result is incorrect. How can I fix this problem?

Or maybe there is any way to position elements in world space directly by matrix, not by IfcAxis2Placement3D?

Thanks!

bekraft commented 3 years ago

Hi, the IFC placement relies on RHS logic. Given two axis the 3rd is derived by the cross product. In your case the final Y axis is (0,1,0). Converting from LHS to RHS using IFC placement logic won‘t work, since you don‘t have full control over the transform. You have to convert the geometry itself (i.e. swapping Y and Z, or in your case mirroring the Y axis).

GVladislavG commented 3 years ago

So is there any universal method for me to convert geometry? Method that would work with any left coordinate system matrix. I also have matricies like this 1, 0, 0, 0 0,-1, 0, 0 0, 0, 1, 0 Ox, Oy, Oz, 1 And there can be other LHS matricies. Z - axis is always up in my models!

Thanks!

martin1cerny commented 3 years ago

Where is your transformation coming from? All CAD systems I know work in RHS local coordinate system. When LHS systems are used in there, they use either negative X or Y coordinates. This data therefore don't need to be transformed when exported to IFC.