Default Axis Arrows

Anonymous 10 years ago 0
This discussion was imported from CodePlex

RobPerkins wrote at 2012-09-04 23:07:

I'm still trying to sort out how Helix 3D arranges its axes by default. 

A HelixViewport3D can automatically display a coordinate system graphic which tracks with the camera by specifying this properties:

 <h:HelixViewport3D ShowCoordinateSystem="True" >

This displays three arrows, one each of red, green, and blue. 

The question is, which one corresponds to X, which to Y, and which to Z?

The reason for the question is related to the top view, which when clicked on by the view box displays the arrows as red increasing left, green increasing up, and blue increasing towards the camera. If this is an RHS, then the green corresponds to X. If it's an LHS, then it corresponds to Y. 

Thus, the operative other question becomes "how do I get the "top view" to rotate so that the X axis increases to the right of the screen, the Y axis increases to the top, and the Z axis points toward the camera?

objo wrote at 2012-09-04 23:17:

The red arrow has direction (1,0,0)
The green arrow has direction (0,1,0)
The blue arrow has direction (0,0,1) 

RobPerkins wrote at 2012-09-04 23:25:

objo wrote:

The red arrow has direction (1,0,0)
The green arrow has direction (0,1,0)
The blue arrow has direction (0,0,1) 

OK, that makes Helix's coordinate system a left handed system, with the "top U" view displaying X increasing left, Y increasing up, and Z increasing towards the camera, doesn't it? That is, a rotation proceeding from X=1 to Y=1 happens clockwise

Is there a convenient place to transform the coordinates so that you can get an RHS out of Helix, where the top view corresponds to my second question? 

RobPerkins wrote at 2012-09-05 00:49:

OK, I've done some more testing and it doesn't look like a problem with the coordinate system. 

I added this code to my viewport:

Private Sub VP_MouseMove(sender As Object, e As MouseEventArgs) Handles VP.MouseMove
  Dim q = Viewport3DHelper.FindHits(VP.Viewport, e.GetPosition(VP))
  If q.Count > 0 Then
    Coordinates.Text = q(0).Position.FormattedString
  End If
End Sub

 When in the "U" top view, tracking the mouse along my geometries shows X increasing to the right, and Y increasing up. 

However, while the axis display looks points correctly for Y and Z, it indicates X increasing to the left, which is false! The red arrow appears to have direction (-1,0,0), suggesting a transform in that viewport which is not accurate!

There is no problem with the coordinate system of the main viewport; it's RHS the way we discussed in another thread. It's the viewport onto the axis that I think needs attention. 

RobPerkins wrote at 2012-09-05 01:35:

OK, I've uploaded a small sample here:




... to demonstrate what I mean. Position the running viewer in the "U" top view and run the mouse along the cube from left to right, observing the text below. The X coordinate increases to the right, but the red arrow points left! The Y coordinate increases up, with the green arrow pointing up, as it should, and a Front view shows that the blue arrow, indicating Z, points up with the Z coordinates increasing up.

That X coordinate arrow is inverted.  

RobPerkins wrote at 2012-09-05 01:44:

Found it.

In the project, the "Generic.xaml" file defined this XAML:


                            <Viewport3D x:Name="PART_CoordinateView" 
                                        Width="{TemplateBinding CoordinateSystemWidth}" Height="{TemplateBinding CoordinateSystemHeight}" Margin="0" 
                                        HorizontalAlignment="{TemplateBinding CoordinateSystemHorizontalPosition}" VerticalAlignment="{TemplateBinding CoordinateSystemVerticalPosition}" 
                                        ClipToBounds="False" Visibility="{TemplateBinding ShowCoordinateSystem, Converter={StaticResource BoolToVisibilityConverter}}">
                                <local:ArrowVisual3D Point2="-10 0 0" Fill="#964B4B" />
                                <local:ArrowVisual3D Point2="0 10 0" Fill="#4B964B" />
                                <local:ArrowVisual3D Point2="0 0 10" Fill="#4B4B96" />
                                <local:PieSliceVisual3D Normal="1,0,0" UpVector="0,0,1" InnerRadius="3" OuterRadius="6"  Fill="#80ff0000"/>
                                <local:PieSliceVisual3D Normal="0,1,0" UpVector="1,0,0" InnerRadius="3" OuterRadius="6"  Fill="#8000ff00"/>
                                <local:PieSliceVisual3D Normal="0,0,1" UpVector="0,1,0" InnerRadius="3" OuterRadius="6"  Fill="#800000ff"/>

The problem was in the vector defining Point2 for the X axis arrow:

                                <local:ArrowVisual3D Point2="-10 0 0" Fill="#964B4B" />

Changing the first value from -10 to 10 corrected the incorrect arrow direction. I don't know if this XAML is present in the current release bits of Helix as I found it in mine or if I twiddled it at one point in the past, since I'm using Helix source code in my project. Might be worth a check...