MCPcopy Index your code
hub / github.com/CadQuery/cadquery / _calcTransforms

Method _calcTransforms

cadquery/occ_impl/geom.py:816–847  ·  view source on GitHub ↗

Computes transformation matrices to convert between coordinates Computes transformation matrices to convert between local and global coordinates.

(self)

Source from the content-addressed store, hash-verified

814 self.yDir = self.zDir.cross(self.xDir).normalized()
815
816 def _calcTransforms(self):
817 """Computes transformation matrices to convert between coordinates
818
819 Computes transformation matrices to convert between local and global
820 coordinates.
821 """
822 # r is the forward transformation matrix from world to local coordinates
823 # ok i will be really honest, i cannot understand exactly why this works
824 # something bout the order of the translation and the rotation.
825 # the double-inverting is strange, and I don't understand it.
826 forward = Matrix()
827 inverse = Matrix()
828
829 forwardT = gp_Trsf()
830 inverseT = gp_Trsf()
831
832 global_coord_system = gp_Ax3()
833 local_coord_system = gp_Ax3(
834 gp_Pnt(*self.origin.toTuple()),
835 gp_Dir(*self.zDir.toTuple()),
836 gp_Dir(*self.xDir.toTuple()),
837 )
838
839 forwardT.SetTransformation(global_coord_system, local_coord_system)
840 forward.wrapped = gp_GTrsf(forwardT)
841
842 inverseT.SetTransformation(local_coord_system, global_coord_system)
843 inverse.wrapped = gp_GTrsf(inverseT)
844
845 self.lcs = local_coord_system
846 self.rG = inverse
847 self.fG = forward
848
849 @property
850 def location(self) -> "Location":

Callers 1

originMethod · 0.95

Calls 2

MatrixClass · 0.85
toTupleMethod · 0.45

Tested by

no test coverage detected