September 4th, 2010, 08:17 AM
Transform a model's positions directly
I'm new to WPF, and I'm trying to understand the underlying architecture, so please correct me if I'm wrong:
As far as I know, there are three possibilities to dynamically transform a GeometryModel3D during runtime:
a) Set the model's Transform-property to a Transform3DGroup once, to which you add new / duplicate Transformations.
b) Cast the model's Transform-property as a MatrixTransform3D and multiply its matrix with the Value-property of a Transformation (which i guess is pretty much case (a) )
c) Leave the Transform-property as a identity matrix and instead transform the model's Geometry.Positions property directly (provided you use a MeshGeometry3D) like such:
On first glance, option (c) seems like the best (though not most intuitive) choice, especially when you need the actual positions of the model(s); for example to calculate hit-detection.
mesh = (SomeModel.Geometry as MeshGeometry3D);
for (i = 0; i < mesh.Positions.Count; i++)
mesh.Positions[i] = SomeTransform.Transform(
Is there another way to easily access a model's current, transformed position(s)? And why does WPF transform a model's own space instead of just the actual coordinates?
Kind regards, Frank
Tags for this Thread
Click Here to Expand Forum to Full Width