0

Rotations query

Anonymous 10 years ago 0
This discussion was imported from CodePlex

Nikk wrote at 2013-07-03 03:07:

Hi there,
I'm new to this toolkit and it looks pretty good :) Nice and quick to get good controls and objects in place quickly.

I am building a simple app to help our users understand some 3D geometry. To that end
I have built some spheres with manipulators which seem to function as expected. I can move them around and rotate at will. What I would like to do now, is get a report out that details the bearings, in polar coordinates of the rotated objects. However I am unsure of what to query to get the new bearings of a shape after it has been rotated?
I'd really like to eventually be able to manipulate other 3D objects too, so knowing how to query either the manipulators, or the objects for their directions would be great.

Can anyone offer any guidance?

Here is a snippet of the code I have used to generate the sphere and manipulator:
            var builder = new MeshBuilder(true, true);
            var position = new Point3D(0, 0, 0);
            builder.AddSphere(position, 1);
            var geom = new GeometryModel3D(builder.ToMesh(), Materials.Red);
            var visual = new ModelVisual3D();
            visual.Content = geom;

            r1Manip = new RotateManipulator();
            r1Manip.Color = Colors.Orange;
            r1Manip.Axis = new Vector3D(0, 0, 1);
            r1Manip.Diameter = 1;
            r1Manip.Bind(visual);

            r2Manip = new RotateManipulator();
            r2Manip.Color = Colors.Blue;
            r2Manip.Axis = new Vector3D(0, 1,0);
            r2Manip.Diameter = 1;
            r2Manip.Bind(visual);
            
            r3Manip = new RotateManipulator();
            r3Manip.Color = Colors.Green;
            r3Manip.Axis = new Vector3D(1, 0, 0);
            r3Manip.Diameter = 1;
            r3Manip.Bind(visual);

            ModelArea.Children.Add(r1Manip);
            ModelArea.Children.Add(r2Manip);
            ModelArea.Children.Add(r3Manip);
            
            ModelArea.Children.Add(visual);
ModelArea is my ModelVisual3D element in the XAML

Thanks
Nikk

objo wrote at 2013-07-12 23:14:

I think you should query the Transform property to find the orientation of the objects. You can use the rotation matrix to find Euler angles.

hbdev wrote at 2014-04-21 09:11:

I am new to Helix 3D.

I copied and pasted this code, but i don't see the colors mentioned in the code. What i get is completely black figure though i can rotate it. Can please post full code for this?