3

Given a general 3D Matrix operation ... who can I apply "1/2" of the effect of it ?

I have an object with a given orientation in space and a given position ... and another version of same object with a different position and orientation ...

Is there a simple way to find a "middle ground" object that would be "1/2" way between ... say with regard to both position and rotation ? Would be super cool if we had a method that also would work if scale was involved.

I think I can work this all out if I distill out oriented bounding boxes (I have the code and it works for oriented bounding boxed). But ... I was hoping I'm overlooking a cool trick.

Mark
  • 31

2 Answers2

1

I don't know that there is a good answer for a general "matrix operation" but there are potential answers for more specific operations corresponding to basic geometric transformations. If you translate by a vector $\vec{v}$, for example, then $$f(\vec{x},t)=(1-t)\vec{x}+t(\vec{x}+\vec{v})$$ yields a point that is between $\vec{x}$ and $\vec{x}+\vec{v}$. In other words, this yields a partial translation. As another example, if $R(\theta)$ represents rotation through an angle $\theta$, then $R(t\theta)$ represents a partial rotation for $0<t<1$.

Functions like $f(\vec{x},t)$ are sometimes called homotopies. I use this type of function in the following answers:

Mark McClure
  • 30,510
0

Basic idea

You can linear interpolate from a state $x_1$ to a state $x_2$ via $$ x_\lambda = (1 -\lambda) x_1 + \lambda x_2 \quad (*) $$

and $\lambda \in [0, 1]$. If you set $\lambda = 1/2$, you get the state in the middle of the $\lambda$ parameter intervall.

You could try this on the interesting parameters (translation vector, rotation angles) of your transformation matrices.

Examples

$$ T_\lambda = \left( \begin{matrix} 1 & 0 & 0 & (1-\lambda)x_1 + \lambda x_2 \\ 0 & 1 & 0 & (1-\lambda)y_1 + \lambda y_2 \\ 0 & 0 & 1 & (1-\lambda)z_1 + \lambda z_2 \\ 0 & 0 & 0 & 1 \\ \end{matrix} \right) $$ Here you get translations by $(x_1,y_1,z_1)^T$ to $(x_2,y_2,z_2)^T$.

$$ R_\lambda = \left( \begin{matrix} \cos((1-\lambda) \phi_1 + \lambda \phi_2) & \sin((1-\lambda) \phi_1 + \lambda \phi_2) & 0 & 0 \\ -\sin((1-\lambda) \phi_1 + \lambda \phi_2) & \cos((1-\lambda) \phi_1 + \lambda \phi_2) & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ \end{matrix} \right) $$

This will rotate from $\phi_1$ to $\phi_2$ in the $x-y$-plane.

$$ S_\lambda = \left( \begin{matrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & (1-\lambda) s_1 + \lambda s_2 & 0 \\ 0 & 0 & 0 & 1 \\ \end{matrix} \right) $$

This will scale the $z$-axis from $s_1$ to $s_2$.

As usual a combined transformation matrix can be calculated by matrix multiplication of the individual transformation matrices.

Other transition functions

Of course you can use other transition functions than equation $(*)$.

For visual effects on web pages so called tweening libraries became popular in the last years. That term seems to come from "in-between-ing". Another term used for this is easing.

You might find some interesting visual effects for 2D there, which should not be hard to port to a 3D setting. See here for such a demo.

mvw
  • 34,562