onekk wrote: ↑Thu Jun 23, 2022 12:14 pm
Let's see if poking him a little will solve also your problem, due to timezone problem it may need some hours to obtain an answer:
To expand on
@marioalexis reply, how would you figure this out for yourself. There are are some simple rules to apply. You do not need to know the details of the implementation - matrices, quaternions and the like.
- Every object lives in its own local coordinate system (LCS)
- In the 3D view, the objects are shown in the the global coordinate system (GCS)
- You move objects around with Placements
- A Placement rotates the object by Placement.Rotation then translates it by Placement.Base
- The effect of a Placement on any coordinate vector is given by
Code: Select all
transformed_vector = Placement.multVec(vector)
or
Code: Select all
transformed_vector = Placement * vector
- Placements are compounded if objects sit in nested containers e.g.
- Screen Shot 2022-06-23 at 7.40.38 AM.png (22.74 KiB) Viewed 520 times
Here Body001 sits inside Part002 and Body is inside Part001 inside Part
- Compounded placements are multiplied. This is not the multiplication of numbers, but has many properties in common with ordinary multiplication.
Code: Select all
global_placement_of_Body001 = Placement_of_Part002 * Placement_of_Body001 # or Placement_of_Part002.multiply(Placement_of_Body001)
global_placement_of_Body = Placement_of_Part * Placement_of_Part001 * Placement_of_Body
- The order of multiplication matters. Container placements go the left of their contents.
- Every Placement has an inverse, that will undo the operation.
Now we are ready to tackle the algebra of placements. First lets compact the the notation
Code: Select all
gBody = global_placement_of Body
pPart = Placement_of_Part
etc.
We know
Code: Select all
gBody = pPart * pPart001 * pBody
gBody001 = pPart002 * pBody001
Suppose we want to find a new pBody (call it pBody' )that makes gBody = gBody001
That gives us the equation
Code: Select all
gBody = pPart * pPart001 * pBody' = gBody001 = pPart002 * pBody001
or
Code: Select all
pPart * pPart001 * pBody' = pPart002 * pBody001
which we want to solve for pBody' . Just as in ordinary algebra, we need to divide through by pPart. Since division is the inverse of multiplication, this means multiplying both sides by the inverse of pPart. Order matters, so we do it in the left.
Code: Select all
pPart_inverse * pPart * pPart001 * pBody' = pPart_inverse * pPart002 * pBody001
pPart001 * pBody' = pPart_inverse * pPart002 * pBody001
since the effect of pPart_inverse * pPart is to do nothing - the identity transformation.
Now we repeat this multiplying each side by pPart001_inverse on the left, obtaining
Code: Select all
pBody' = pPart001_inverse * pPart_inverse * pPart002 * pBody001
Solving the for the placement we were looking for.
Try this for yourself. Suppose you wanted to change pPart001 so that gBody and gBody001 became equal. What would you change it to?