08-27-2019, 01:55 PM
Note:
the new version works with setting new axes but they still need to be parallel with the original axes - so you can change the direction of axes and their order.
To use custom transformation and orient the ModelScalarVisual3D in any direction, you can add transformation to ModelScalarVisual3D (or ModelMoverVisual3D or ModelRotatorVisual3D) - for example:
After that in code instead of setting the SelectedModelScalar.Position, set the translation:
Of course, you can change the RotateTransform3D with any other transform.
the new version works with setting new axes but they still need to be parallel with the original axes - so you can change the direction of axes and their order.
To use custom transformation and orient the ModelScalarVisual3D in any direction, you can add transformation to ModelScalarVisual3D (or ModelMoverVisual3D or ModelRotatorVisual3D) - for example:
Code:
<visuals:ModelScalarVisual3D x:Name="SelectedModelScalar"
AxisLength="60" CenterBoxWidth="16" InnerBoxWidth="4" OuterBoxWidth="12"
CenterBoxColor="Gray" XAxisColor="Red" YAxisColor="Green" ZAxisColor="Blue"
IsCenterBoxShown="{Binding ElementName=IsCenterBoxShownCheckBox, Path=IsChecked}"
IsXAxisShown="{Binding ElementName=IsXAxisShownCheckBox, Path=IsChecked}"
IsYAxisShown="{Binding ElementName=IsYAxisShownCheckBox, Path=IsChecked}"
IsZAxisShown="{Binding ElementName=IsZAxisShownCheckBox, Path=IsChecked}">
<visuals:ModelScalarVisual3D.Transform>
<Transform3DGroup>
<RotateTransform3D x:Name="ScaleRotation">
<RotateTransform3D.Rotation>
<AxisAngleRotation3D Axis="0 1 0" Angle="30" />
</RotateTransform3D.Rotation>
</RotateTransform3D>
<TranslateTransform3D x:Name="ScaleTranslation" />
</Transform3DGroup>
</visuals:ModelScalarVisual3D.Transform>
</visuals:ModelScalarVisual3D>After that in code instead of setting the SelectedModelScalar.Position, set the translation:
Code:
//SelectedModelScalar.Position = boxPosition;
ScaleTranslation.OffsetX = boxPosition.X;
ScaleTranslation.OffsetY = boxPosition.Y;
ScaleTranslation.OffsetZ = boxPosition.Z;Of course, you can change the RotateTransform3D with any other transform.
Andrej Benedik

