Standard |
public class StandardTransform3D : ISupportInitialize
The StandardTransform3D type exposes the following members.
Name | Description | |
---|---|---|
StandardTransform3D | Constructor |
Name | Description | |
---|---|---|
RotateX | Gets or sets a double that specified the rotation angle in degrees around the X axis (Attitude in SphericalCamera). | |
RotateY | Gets or sets a double that specified the rotation angle in degrees around the Y axis (Heading in SphericalCamera). | |
RotateZ | Gets or sets a double that specified the rotation angle in degrees around the Z axis (Bank in SphericalCamera). | |
ScaleX | Gets or sets a double that specified the scale in the direction of the X axis. | |
ScaleY | Gets or sets a double that specified the scale in the direction of the Y axis. | |
ScaleZ | Gets or sets a double that specified the scale in the direction of the Z axis. | |
Transform | Gets the MatrixTransform3D that defines the transformation specified by the properties of this StandardTransform3D. | |
TranslateX | Gets or sets a double that specified the translation in X direction. | |
TranslateY | Gets or sets a double that specified the translation in Y direction. | |
TranslateZ | Gets or sets a double that specified the translation in X direction. |
Name | Description | |
---|---|---|
BeginInit | Signals the object that initialization is starting. | |
EndInit | Signals the object that initialization is complete. | |
GetStandardTransform3D(Model3D) | GetStandardTransform3D returns a StandardTransform3D object that was set to the specified Model3D. | |
GetStandardTransform3D(Visual3D) | GetStandardTransform3D returns a StandardTransform3D object that was set to the specified Visual3D. | |
GetTranslateVector3D | Returns a Vector3D created from TranslateX, TranslateY and TranslateZ properties. | |
OnChanged | OnChanged | |
Reset | Reset method sets all translation and rotation to zero and all scales to 1. | |
SetStandardTransform3D(Model3D, StandardTransform3D, Boolean) | SetStandardTransform3D sets the specified standardTransform3D as a StandardTransform3DProperty to the specified Model3D. If updateTransform3D parameter is true (by default), then the Model3D.Transform is also set to the standardTransform3D.Transform. standardTransform3D parameter can be null to clear the value. | |
SetStandardTransform3D(Visual3D, StandardTransform3D, Boolean) | SetStandardTransform3D sets the specified standardTransform3D as a StandardTransform3DProperty to the specified Visual3D. If updateTransform3D parameter is true (by default), then the Visual3D.Transform is also set to the standardTransform3D.Transform. standardTransform3D parameter can be null to clear the value. | |
UpdateMatrix | Updates the value of Transform.Matrix. |
Name | Description | |
---|---|---|
StandardTransform3DProperty | StandardTransform3D is a DependencyProperty that can be set to a Model3D or Visual3D object to store the used StandardTransform3D. |
Name | Description | |
---|---|---|
StandardTransform3D | StandardTransform3D is a DependencyProperty that can be set to a Model3D or Visual3D object to store the used StandardTransform3D. |
Because WPF does not allow deriving your own classes from Transform3D object, it is not possible to create our own class that could be set to the Model3D.Transform or Visual3D.Transform property. This means that you cannot use something like:
model3d.Transform = new StandardTransform3D(); // not possible
Instead the usage patter for StandardTransform3D is to use its static StandardTransform3D.SetStandardTransform3D method to assign the StandardTransform3D to Model3D or Visual3D. Behind the scenes the method adds a StandardTransform3D.StandardTransform3DProperty to the Model3D or Visual3D. This way we store the StandardTransform3D to the object that is using it and this way we can read the assigned StandardTransform3D by using the static StandardTransform3D.GetStandardTransform3D method.
The SetStandardTransform3D by default (default value of updateTransform3D attribute is true) also sets the Transform property of the Model3D or Visual3D to the StandardTransform3D.Transform property. This property is a MatrixTransform3D that is created based on the translate, rotate and scale transform.
When the properties of StandardTransform3D change, then this also updates the MatrixTransform3D.
The class also implements BeginInit and EndInit to update the matrix only once even when multiple properties are changed.
Usage example:
var standardTransform3D = new StandardTransform3D() { RotateY = 30, TranslateX = 100 }; // Assign standardTransform3D to model3d.Transform and store it in the model3d object StandardTransform3D.SetStandardTransform3D(model3d, standardTransform3D); // ... // Change rotation: standardTransform3D.RotateY += 10; // This will update the MatrixTransform3D (standardTransform3D.Transform) and also the model3d because its Transform is set to the same MatrixTransform3D. // ... // Somewhere else in the application we can read the StandardTransform3D from a Model3D or Visual3D: var standardTransform3D = StandardTransform3D.GetStandardTransform3D(model3);