Component transformation rotation

Forum Forums Visual Components 4.1 .NET Addon Programming Component transformation rotation

Viewing 4 posts - 1 through 4 (of 4 total)
• Author
Posts
• #13854

Hello together,

i am set a transofrmation of a component like this:

var component = this.SimApplication.World.FindComponent(componentName);
var matrix = component.TransformationInWorld;
matrix.Px = 100
matrix.Py = 200
matrix.Pz = 300
matrix.RotateAroundZ(90);
component.TransformationInWorld = matrix;

After that the position in the visualisation is ok. And the matrix x, y and z parameters of the .NET object are equals with the setted values 100, 200 and 300). But I can`t find any property of which has the value for the “rotationAroundZ”. Also not in another unit (radians).

Thank you.

#13880

Hi,

You need to learn more about rotation (and transformation) matrices to understand why this is. Wikipedia has fairly decent article on this:

http://en.wikipedia.org/wiki/Rotation_matrix

Briefly put the rotation around Z (or X or Y) affects more than one value inside the matrix and that is why there is no single property that shows it. Rather you need to calculate the RZ from multiple values inside the matrix.

Of course in the API there could be a property called RZ, that would return the computed value for the angle. Like it is done with the Determinant property.

-k

#13881

You can set the orientation of the component’ matrix in world using specified yaw, pitch and roll vector values.

Vector3 vec = new Vector3(90, 30, 20);
_app.World.Components.Last().TransformationInWorld.SetWPR(vec);

and you can get the matrix orientation as follows

vec.X = _app.World.Components.Last().TransformationInWorld.GetWPR().X;
vec.Y = _app.World.Components.Last().TransformationInWorld.GetWPR().Y;
vec.Z = _app.World.Components.Last().TransformationInWorld.GetWPR().Z;

Hope that helps.

#13899