0

CombinedManipulator question

Anonymous 5 years ago 0
This discussion was imported from CodePlex

avgjoe wrote at 2012-03-11 18:39:

First off...Kick ass toolkit btw!  The examples gave me a good starting point.

The first thing I’m attempting to do is combine the ManipulatorDemo with the ModelViewer example.

I’ve added the following code to the ModelViewer to allow the model to be repositioned and rotated.  The visual rotate manipulators appear to grow in size but the translate manipulators do not.   Am I missing something here?

 

 private void ModelLoaded(object sender, RoutedEventArgs e)
{
view1.ZoomExtents();

CombinedManipulator manipulator = new CombinedManipulator();
Rect3D rect = Visual3DHelper.FindBounds(view1.Children);
manipulator.Diameter = rect.Y;
root1.Children.Add(manipulator);
manipulator.Bind(root1);
}

objo wrote at 2012-03-11 20:56:

To me it seems like the manipulation transform is applied twice to the manipulator. Adding the manipulator one level higher in the Visual3D tree should avoid it:

view1.Children.Add(manipulator);

Sorry the "ModelViewer" example is not in good shape, I am planning to improve it, hopefully this year :)


Mrme wrote at 2013-08-01 10:02:

I would like to know if you solved this problem

thebestgin wrote at 2014-08-05 15:32:

I have the same problem. The translate manipulator do not size.
The problem is the emty methode OnDiameterChanged() at line 404.

https://searchcode.com/codesearch/view/10564768/

Here my suggestion:
     /// <summary>
    /// The on diameter changed.
    /// </summary>
    protected virtual void OnDiameterChanged()
    {
        double radius = this.Diameter / 2;
        double newArrowLength = radius + radius * 0.4; 
        this.TranslateXManipulator.Length = newArrowLength;
        this.TranslateYManipulator.Length = newArrowLength;
        this.TranslateZManipulator.Length = newArrowLength;

        double newArrowDiameter = newArrowLength * 0.075;
        this.TranslateXManipulator.Diameter = newArrowDiameter;
        this.TranslateYManipulator.Diameter = newArrowDiameter;
        this.TranslateZManipulator.Diameter = newArrowDiameter;

        double newInnerDiameter = this.Diameter - this.Diameter * 0.12;
        this.RotateXManipulator.InnerDiameter = newInnerDiameter;
        this.RotateYManipulator.InnerDiameter = newInnerDiameter;
        this.RotateZManipulator.InnerDiameter = newInnerDiameter;
    }