Model Rotator and ViewCubeCameraController Behavior
#1
Hi, I am having problems using two of your UI tools for rotating my models and was hoping you could explain where I am going wrong in my thinking.

I have a 3D scatter plot and need to be able to rotate the entire model in any orientation.

When I use the ViewCubeCameraController, it works great except when the cube is inverted (Y is pointing down).  When this happens, rotating the cube with the mouse using the cube faces is the inverse of what I would expect (the disk rotations work fine). In fact, trying to use the mouse to rotate in the XY plane is generally backwards of what I would expect.  I assume this is because I am moving the camera and not the model (which is conceptually what I actually need to do).

I also played with using the ModelRotatorVisual3D that moves with the model (e.g., the Rotator with StandardTransform sample) and it is almost perfect for manipulating my plot except... It stops working when rotated in 2 different axes.  In other words, if I spin the rotator in X it works great but if I then try and rotate on other axes it gets confused and the actions on the rotator no longer seem to track what it "should" do.

Thanks again for any help you can provide!
#2
First, sorry for the late answer. There were some problems with forum emails and therefore your post were missed.

I have updated the ViewCubeCameraController by adding a new IsHeadingRotationInvertedWhenUpsideDown property - when true (by default) then the heading direction is inverted when the ViewCube is shown upside down (y pointing down). This way the rotation of the ViewCube follows the mouse direction.

If you want I can send you a pre-release version with this feature. Just send my a private message and tell me if you need a trial or a commercial version.


If you were using the ModelRotatorVisual3D with the source code that came with Ab3d.PowerToys.samples, then you may use the following updated code for the AddTransform method:
Code:
        // Insert Transform3D before any TranslateTransform3D
        // Order of transformation is important: scale, rotate, translate !!!
        private void AddTransform(Visual3D visual3D, Transform3D transform3D)
        {
            if (visual3D.Transform == null)
            {
                visual3D.Transform = transform3D;
                return;
            }

            var transform3DGroup = visual3D.Transform as Transform3DGroup;
            if (transform3DGroup == null)
            {
                // If there is already some other transformation, then create a new Transform3DGroup
                // and add existing transformation as its first child.
                transform3DGroup = new Transform3DGroup();
                transform3DGroup.Children.Add(visual3D.Transform);

                visual3D.Transform = transform3DGroup;
            }

            if (transform3DGroup.Children.Count > 0)
            {
                int insertIndex = 0;
                for (int i = 0; i < transform3DGroup.Children.Count; i++)
                {
                    if (transform3DGroup.Children[i] is TranslateTransform3D)
                        break;

                    insertIndex++;
                }

                transform3DGroup.Children.Insert(insertIndex, transform3D);
            }
            else
            {
                transform3DGroup.Children.Add(transform3D);
            }
        }
Andrej Benedik
#3
No problem - I just saw your response.  We ended up redoing the plotting so inverting the Y-axis isn't needed - but in the future we might need to circle back so I appreciate it.  Thanks!
  


Forum Jump:


Users browsing this thread:
1 Guest(s)