-
Shouldn't from pyrx import Db, Ge, command
@command
def doit():
m_translation = Ge.Matrix3d.translation(Ge.Vector3d(5.0, 5.0, 0.0))
m_scaling = Ge.Matrix3d.alignCoordSys(
Ge.Point3d.kOrigin,
Ge.Vector3d.kXAxis,
Ge.Vector3d.kYAxis,
Ge.Vector3d.kZAxis,
Ge.Point3d.kOrigin,
Ge.Vector3d.kXAxis * -1.0,
Ge.Vector3d.kYAxis * 1.0,
Ge.Vector3d.kZAxis * 1.0,
)
m_rotation = Ge.Matrix3d.rotation(45.0, Ge.Vector3d.kZAxis, Ge.Point3d.kOrigin)
m = m_translation * m_rotation * m_scaling
ext = Db.Extents(Ge.Point3d(-1.0, -1.0, 0.0), Ge.Point3d(1.0, 1.0, 0.0))
print(f"{ext=}")
print(f"{m*ext.minPoint()=}")
print(f"{m*ext.maxPoint()=}")
print(">> ext.transformBy(m)")
ext.transformBy(m)
print(f"{ext.minPoint()=}")
print(f"{ext.maxPoint()=}")
# output:
ext=PyGe.Extents((-1.00000000000000,-1.00000000000000,0.00000000000000),(1.00000000000000,1.00000000000000,0.00000000000000))
m*ext.minPoint()=PyGe.Point3d(6.37622551335185,5.32558153571639,0.00000000000000)
m*ext.maxPoint()=PyGe.Point3d(3.62377448664815,4.67441846428361,0.00000000000000)
>> ext.transformBy(m)
ext.minPoint()=PyGe.Point3d(3.62377448664815,3.62377448664815,0.00000000000000)
ext.maxPoint()=PyGe.Point3d(6.37622551335185,6.37622551335185,0.00000000000000) |
Beta Was this translation helpful? Give feedback.
Answered by
gswifort
Jun 5, 2025
Replies: 1 comment 2 replies
-
according to the docs, the extents is recomputed to include the transformed points. Extents is always WCS aligned, to transformby will only grow or shrink the cube |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ok, I think I understand my mistake - I probably did it in the wrong order - I should transform the object and then calculate its Extents instead of transforming the Extents.