The red arrow marks the yellow morph's (Y) initial position P in the light blue morph's coordinates. That initial position corresponds to the upper left corner of Y's bounding box, which is the bounding box of Y's shape.
After applying Y's transformation, Y has it's own (preliminary) local coordinate system (black arrows).
setOrigin on Y causes the origin of its coordinate system to be translated to a new point (green arrow & green spot). setOrigin(v) with v=pt(x,y) (with x,y in Y's local coordinate system) does two things:
- set Y's new position P' (blue arrow) to P + v. Y would move by v.
- translate Y's shape by (-1)*v in Y's local coordinate system, i. e. back to its previous position.
- for all of Y's submorphs s: translate s by (-1)*v
This means that setOrigin never affects the absolute position of Y's shape (the actual rectangle) or the absolute position of any of its submorphs.
The purple morph is located at pt(0,0) in Y's resulting local coordinate system (yellow arrows).