Thanks, Andras, good to know.
This behavior in the 3D view looks what I want to do but my use-case is to draw a rectangle for legion on an axial slice.
When I use ‘Interaction handles visible’ on an axial slice, the size and the orientation will be changed (same behavior as when I just move the center point on the axial view).
I’m pretty sure there are some ways to keep the size and the orientation moving the center point by modifying the codes in elif movedPointIndex == 0:
I’m almost there but I’m not quite understanding planeToWorldMatrix and MultiplyPoint .
Again, Thank you so much for your help! I’m very new to the 3D slicer development but thanks to you guys, I can make small progress!
Once you placed the rectangle, you can move the box with the interaction handles instead of the control points (you can hide the control points).
Of course you can also keep using the control points as I described above. Plane to World matrix stores the plane center and axes as a homogeneous transformation matrix. If you store the previous matrix then all you need to do after moving the plane center is to update the translation part of the matrix (last column) and then you can use it to get the two new side point positions (by multiplying the Plate to World matrix by (sideLength,0,0,1) and (0,sideLength,0,1) points).
You can store the matrix in a member variable in your module (or in slicer namespace if you do just quick testing in scripts and don’t have a module yet). Set the variable’s value when you create it, then update it each time at the end of the callback function.