Transformer3ds Class 
Namespace: Ab3d
public class Transformer3ds
The Transformer3ds type exposes the following members.
Name  Description  

Transformer3ds 
Constructor

Name  Description  

UsedReader3ds 
Gets a Reader3ds that is used in this Transformer3ds

Name  Description  

ApplyTransformation 
Applies the newTransformation to the modelToApplyTransformtion.
If the model already has the same type of transformation than this transformation is replaced with the new one.
If this type of transformation is not already applied to the models than the transformation is added to model's Transform3DGroup
 
ClearAllTransformations 
Clears all transformation in all objects in UsedReader3ds
 
ClearTransformations(String) 
Clears all transformation in objectName (only MatrixTransformations are left because they are needed to represent the hierarchy of read 3ds file)
 
ClearTransformations(Model3D) 
Clears all transformation in objectsGroup (only MatrixTransformations are left because they are needed to represent the hierarchy of read 3ds file)
 
GetCenterPosition 
Returns a center point of a Model3D object
 
GetChildren(String) 
Get Model3DCollection (Children) for objectName (Model3DGroup or GeometryModel3D) or null if model has no children.
GeometryModel3D can have children if for it there was a Model3DGroup created (becasue of a hierarchy).
In this case there is a (objectName + Reader3ds.GroupNameSuffix) in NamedObjects dictionary.
 
GetChildren(Model3D) 
Get Model3DCollection (Children) for Model3DGroup or GeometryModel3D or null if model has no children.
GeometryModel3D can have children if for it there was a Model3DGroup created (becasue of a hierarchy).
In this case there is a (objectName + Reader3ds.GroupNameSuffix) in NamedObjects dictionary.
 
GetObjectCenter 
Returns a center point of a Model3D object
 
GetObjectName 
Gets the name of the object from UsedReader3ds.NamedObjects dictionary
 
GetObjectOrItsGroup(String) 
If objectName from UsedReader3ds.NamedObjects is Model3DGroup or Light the same model is returned.
If objectName is GeometryModel3D and it has children (because of hierarchy there was a Model3DGroup created for it) than return the Model3DGroup.
If objectName is GeometryModel3D and has no children return model as GeometryModel3D.
 
GetObjectOrItsGroup(Model3D) 
If model is Model3DGroup or Light the same model is returned.
If model is GeometryModel3D and it has children (because of hierarchy there was a Model3DGroup created for it) than return the Model3DGroup.
If model is GeometryModel3D and has no children return model as GeometryModel3D.
 
GetObjectRotation(String) 
Gets a RotateTransform3D for the object with objectName  if there is a Transform3DGroup the RotateTransform3D is get from it
 
GetObjectRotation(Model3D) 
Gets a RotateTransform3D for the model  if there is a Transform3DGroup the RotateTransform3D is get from it
 
GetObjectScale(String) 
Gets a ScaleTransform3D for the object with objectName  if there is a Transform3DGroup the RotateTransform3D is get from it
 
GetObjectScale(Model3D) 
Gets a ScaleTransform3D for the model  if there is a Transform3DGroup the RotateTransform3D is get from it
 
GetObjectSize 
Gets the size of one Model3D  length of the diagonal of object's bounds
 
GetObjectTranslation(String) 
Gets a TranslateTransform3D for the object with objectName  if there is a Transform3DGroup the RotateTransform3D is get from it
 
GetObjectTranslation(Model3D) 
Gets a TranslateTransform3D for the model  if there is a Transform3DGroup the RotateTransform3D is get from it
 
GetParentGroup(String) 
Gets the parent Model3DGroup of the NamedObject. If the objectName is already a Model3DGroup than the same object is returned, else the parent group is returned.
Used when you get a GeometryModel3D from Reader3ds's NamedObjects and would like to apply a transformation to the GeometryModel3D and all its child objects.
 
GetParentGroup(GeometryModel3D) 
Gets the parent Model3DGroup of the GeometryModel3D.
Used when you get a GeometryModel3D from Reader3ds's NamedObjects and would like to apply a transformation to the GeometryModel3D and all its child objects
 
GetParentGroup(Model3DGroup, GeometryModel3D) 
Gets the parent Model3DGroup of the GeometryModel3D.
Used when you get a GeometryModel3D from Reader3ds's NamedObjects and would like to apply a transformation to the GeometryModel3D and all its child objects
 
GetSize 
Gets the size of one Model3D  length of the diagonal of object's bounds
 
HasChildren(String) 
Returns true if the objectName (Model3DGroup or GeometryModel3D) has children (at least one  empty collection returns false).
GeometryModel3D can have children if for it there was a Model3DGroup created (becasue of a hierarchy).
In this case there is a (objectName + Reader3ds.GroupNameSuffix) in NamedObjects dictionary.
 
HasChildren(Model3D) 
Returns true if the Model3DGroup or GeometryModel3D has children (at least one  empty collection returns false).
GeometryModel3D can have children if for it there was a Model3DGroup created (becasue of a hierarchy).
In this case there is a (objectName + Reader3ds.GroupNameSuffix) in NamedObjects dictionary.
 
RotateObject(AxisAngleRotation3D) 
Applies AxisAngleRotation3D to all objects and lights. The rotation is applied around objects center point.
 
RotateObject(RotateTransform3D) 
Applies RotateTransform3D to all objects and lights. The rotation is applied around objects center point.
 
RotateObject(String, AxisAngleRotation3D) 
Applies AxisAngleRotation3D to the object with objectName and to all its child objects. The rotation is applied around objects center point.
 
RotateObject(String, RotateTransform3D) 
Applies RotateTransform3D to the object with objectName and to all its child objects  enables rotating object around custom center point.
 
RotateObject(Vector3D, Double) 
Applies AxisAngleRotation3D to all objects and lights.
 
RotateObject(String, Vector3D, Double) 
Applies AxisAngleRotation3D to the object with objectName and to all its child objects
 
RotateObject(Vector3D, Double, Boolean) 
Applies AxisAngleRotation3D to all objects and lights. The rotation is applied around objects center point.
 
RotateObject(String, Vector3D, Double, Boolean) 
Applies AxisAngleRotation3D to the object with objectName and to all its child objects. The rotation is applied around objects center point.
 
ScaleObject(ScaleTransform3D) 
Applies scale transformation to all objects and lights.
 
ScaleObject(String, ScaleTransform3D) 
Applies scale transformation to the object with objectName and to all its child objects
 
ScaleObject(Double, Double, Double) 
Applies scale transformation to all objects and lights.
 
ScaleObject(Double, Double, Double, Boolean) 
Applies scale transformation to all objects and lights.
 
ScaleObject(String, Double, Double, Double) 
Applies scale transformation to the object with objectName and to all its child objects
 
ScaleObject(String, Double, Double, Double, Boolean) 
Applies scale transformation to the object with objectName and to all its child objects
 
TranslateObject(TranslateTransform3D) 
Applies scale transformation to all objects and lights.
 
TranslateObject(String, TranslateTransform3D) 
Applies scale transformation to the object with objectName and to all its child objects
 
TranslateObject(Double, Double, Double) 
Applies scale transformation to all objects and lights.
 
TranslateObject(Double, Double, Double, Boolean) 
Applies scale transformation to all objects and lights.
 
TranslateObject(String, Double, Double, Double) 
Applies scale transformation to the object with objectName and to all its child objects
 
TranslateObject(String, Double, Double, Double, Boolean) 
Applies scale transformation to the object with objectName and to all its child objects

Objects read with Reader3ds can be hierarchically organized and can already contain a Matrix3DTransform that must not be overridden Because of this additional transformations of the objects can be a little bit tricky. Also when adding a transformation (rotation, scale or translate) it is possible that the object already contains a different transformation so a new Transform3DGroup must be added to the object.
The methods in Transformer3ds can greatly simplify transforming the objects read with Reader3ds. Firstly we need to create an instance of Transformer3ds and put a Reader3ds instance as a parameter to the constructor. Main methods in the class are: RotateObject(Vector3D, Double), ScaleObject(Double, Double, Double), TranslateObject(Double, Double, Double).
Each of those methods can takes an objectName as a first parameter  the name from the Reader3ds's NamedObjects. The transformation will happen this object. If this parameter is omitted, than all the objects read with specified Reader3ds are transformed.
Than there are parameters to define the transformation  for example Vector3D objectRotationAxis and double objectRotationAngle
Also isAdditive parameter can be used  if true that means that the applied transformation will be added to the currently applied transformation and will not replace the current one. For example if we specify 5.0 for objectRotationAngle and set true for isAdditive than the rotation angle will be increased for 5 degrees.
Ab3d.Reader3ds robotArmReader3ds = new Ab3d.Reader3ds(); robotArmReader3ds.ReadFile("robotarm.3DS", Viewport1); Ab3d.Transformer3ds robotArmTransformer = new Ab3d.Transformer3ds(robotArmReader3ds); robotArmTransformer.RotateObject("BaseMotor", new AxisAngleRotation3D(new Vector3D(0, 1, 0), 10)); robotArmTransformer.RotateObject("Joint2", new AxisAngleRotation3D(new Vector3D(0, 0, 1), 45)); robotArmTransformer.TranslateObject("Hand3", 10, 0, 0);
robotArmTransformer.Transformer.RotateObject(new AxisAngleRotation3D(new Vector3D(0, 0, 1), 45));
robotArmReader3ds.RotateObject("BaseMotor", new Vector3D(0, 1, 0), 10, 10));
// Read robotarm.3ds into myViewport Ab3d.Reader3ds.Instance.ReadFile("robotarm.3ds", myViewport); // Scales all the read objects by 10% (by factor 1.1) Ab3d.Reader3ds.Instance.Transformer.ScaleObject(1.1, 1.1, 1.1); // Rotates the 3D object with name "BaseMotor" for 10 degrees around Y axis. // The rotation is additive (last parameter is true)  so the rotation does not replace the previous rotation but adds it to the previous rotation  usefull for animation. Ab3d.Reader3ds.Instance.Transformer.RotateObject("BaseMotor", new AxisAngleRotation3D(new Vector3D(0, 1, 0), 10), true);