WPF 3D Object Moving

  • Thread starter Thread starter despird
  • Start date Start date
D

despird

Since tranformations don't change the real positions of geometry3d
objects, what if I wanna do so? I got an 3d object with combination
of
a translationtransform and a rotationtransform , both of which will
be
animated using animation objects. but what I really want is the
object
DOES move while transforming, ie. the Positions property changed
really.
 
It is very inefficient to move individual vertices everytime you want to
transform your mesh.

Do you have an actual reason you don't want to use matrix transforms? It is
possible and quite easy (once you understand how matrices work) to find the
inverse transformation for combinations of matrix-style transformations such
as TranslateTransform3D or RotateTransform3D. This is useful if you want to
project - for example, a hit test position - back to global world space.

The aforementioned transform objects inherit from AffineTransform3D,
property "Value" of which contains the 4x4 matrices representing the
transformation in matrix form. The matrix structure contains a method
"Invert" which will effectively work to cancel the transformation
represented by that matrix.

Please reply here if you want more help.

-Niko Suni
Consultant
 
It is very inefficient to move individual vertices everytime you want to
transform your mesh.

Do you have an actual reason you don't want to use matrix transforms? It is
possible and quite easy (once you understand how matrices work) to find the
inverse transformation for combinations of matrix-style transformations such
as TranslateTransform3D or RotateTransform3D. This is useful if you want to
project - for example, a hit test position - back to global world space.

The aforementioned transform objects inherit from AffineTransform3D,
property "Value" of which contains the 4x4 matrices representing the
transformation in matrix form. The matrix structure contains a method
"Invert" which will effectively work to cancel the transformation
represented by that matrix.

Please reply here if you want more help.

-Niko Suni
Consultant






- Show quoted text -

I sort of understand what you have outlined about transformations, and
I think I got the solution not having to change the Positions.
Transformations can totally fulfil my requirements, many thanks Niko.
 
Hi Niko, I appreicate your help very much. Here are the further
questions, I'm using a transform3dgroup with combination of multiple
transforms including translatetransform3d and rotatetransform3d, the
question is my rotatetransform's axis keeps varying while
transforming, so after a series of random transformations, now if I
wanna know the extract current position of my object, can I still
count on the current matrix3d value of the each transformations? I
found the transform3dgroup also has a version of Value property, is
that the one I want?

In all, what I really want is a value via which I can remember in
order that next time I can load the object directly(not through
transformation path) at the position it appeared last time.

Despird
 
The Value of the transform group should be the matrix representing all the
transformations in said group multiplied together in order from first to
last. Therefore, you can "count on it", if I understand your purpose
correctly.

Why do you want to "load object directly at the position that it appeared
the last time"? You could just use an another matrix for this and not lose a
single bit of flexibility.

-Niko
 
Thank you Niko, based on my understanding upon your statements,

real position = mesh.position * transformgroup.matrix
transformgroup.matrix = child1.matrix * child2.matrix*...

I think I found the solution for my issue, I add a MatrixTransform3D
into my Transform3dGroup and put it as the first child. Each time
before I'm about to make aother weird transformation, eg. change the
axis(centerX, centerY, centerZ) of the rotatetransform3D, I store the
current matix3d of the Transform3dGroup into the MatrixTransform3D and
reset all of other children transformations so that I can make any
further transformations. Sounds right to you Niko?
 
You can multiply an indefinite quantity of matrices together, to combine the
transformations that they represent. However, you need to be careful with
the order of the multiplies, because matrix multiplication is not
commutative (that is, AxB != BxA). The exact order is always dependent on
what you actually want to do - for example, if you want to first rotate and
then transform, multiply the transforms in that order; if you want to change
the rotation origin, first translate and then rotate, etc.

Just to be clear, TransformGroup represents the ordered multiply of the
matrices internally.

-Niko


Thank you Niko, based on my understanding upon your statements,

real position = mesh.position * transformgroup.matrix
transformgroup.matrix = child1.matrix * child2.matrix*...

I think I found the solution for my issue, I add a MatrixTransform3D
into my Transform3dGroup and put it as the first child. Each time
before I'm about to make aother weird transformation, eg. change the
axis(centerX, centerY, centerZ) of the rotatetransform3D, I store the
current matix3d of the Transform3dGroup into the MatrixTransform3D and
reset all of other children transformations so that I can make any
further transformations. Sounds right to you Niko?
 
Back
Top