Coordinate system

Jan 20, 2012 at 11:34 AM

Hi,

Though this is a great piece of work, I just can't figure out why is z axis pointing up. That just looks so wrong to me, am I missing something?

Jan 20, 2012 at 7:03 PM

Yes, Z is the default up direction in this library, but both HelixViewport3D and CameraController also supports Y as up direction.

I have mostly used this library for engneering/math projects, that's why I chose this convention. (I know it is common in computer graphcis to use Y up, and the default UpDirection of Media3D.ProjectionCamera is 0,1,0)

Jan 20, 2012 at 7:20 PM

Thanks for reply.

I just thought that it was WPF related, so Y should be up...

What is the easiest way to switch the logic, without rotating models or going through every line of code?

Jan 20, 2012 at 7:23 PM

sorry, I forgot:

set ModelUpDirection="0,1,0" on your HelixViewport3D.

See the UpdirectionDemo example.

Jan 20, 2012 at 7:46 PM

Tried that, but I get right view instead of front view. Still need to rotate models, which will mess up my transforms (long story...).

Never mind, I thought that you could save me some time, but I guess that I will have to do it myself.

Thanks anyway. Keep up the good work.

Jan 26, 2012 at 7:50 PM

sorry, I don't see the problem here. Do you need a left handed system? Let us know if there is a bug in the handling of the up direction!

Jan 28, 2012 at 12:42 AM
Edited Jan 28, 2012 at 1:05 AM

I guess the problem is that the view-cube is a little bit messed up. Usually, in graphics libraries like OpenGL and WPF, which both use a RHS (right-handed coordinate system) the Z-axis points towards the camera, the Y-axis to the sky and the X-axis to the right.  In a LHS system (like Direct3D) the Z-axis points away from the camera. In the Helix-Viewport generally everything works well except the view-cube which shows an R instead of F, B instead R, and so on, and the default camera. But one can customize the cube and the camera anyway. ...

Well, this is not a bug and also a minor issue. Personally, I would also prefer the have the front direction looking along the negative Z-axis as the very default setting, just because this is standard, not only in WPF, but also OpenGL... well I know, there is no real standard, Maya handles it differently, Blender and 3D Studio too, in truth this topic is a mess... just for this reason I stick to the coordinate-system of the libraries, and for WPF it is like explained. 

Anyway, lhs, you don't have to play around with your model transforms (if the model is in RHS), you just have to get used to the view-cube and, I recommend it, change the default camera position to something like 

 

            view.Camera.Position = new Point3D(4, 2, 16);
            view.Camera.LookDirection = new Vector3D(-4, -2, -16);
            view.Camera.UpDirection = new Vector3D(0, 1, 0);

 

Btw, we have already elaborated about the default camera here: http://helixtoolkit.codeplex.com/discussions/286186

 

PS: Maybe one could add a property to set the 'front-direction' just analogous to the 'up-direction' property? This shouldn't cause problems since the third axis would be derived automatically according to the CS?

Jan 29, 2012 at 9:15 AM

Great post! How would you implement support for a front-direction property? Apply a ScaleTransform3D(1,1,-1) to the model? Also note that there is a ViewCubeFrontText property in HelixViewport3D that can be used if you need to change the text on the faces of the view cube. 

Jan 31, 2012 at 4:23 AM
Edited Jan 31, 2012 at 4:25 AM

Yes, I think changing the text of the view-cube is the simplest way to achieve the goal. I wouldn't work with any additional transforms, the front-direction property should just imply how to set up the view-cube, i.e. setting the model-up and front-direction should imply how to setup the view cube naming, etc. This is basically not a really important issue, just cosmetics. 

Jul 5, 2012 at 8:22 AM
Edited Jul 5, 2012 at 8:29 AM

I've been reading and using Helix for awhile now and I'm very pleased so far. 

One thing I do need is a way to transform the coordinate system to an RHS. The display requirements I have are for X increasing to the right, Y increasing "into" the screen, and Z increasing up. It's said to be the coordinate system used by draftsmen. The one I see "by default" is a left-hand system with Y increasing towards the user. 

Is it possible to set properties for world coordinates in a Z-up RHS?  Possible to subclass HelixViewport3D for that? What approach would you suggest? Unless I'm seeing this wrong? 

Jul 6, 2012 at 11:48 PM

Isn't the ProjectionCamera only supporting LHS? I have not studied the code yet, may be wrong...

If a MatrixCamera is needed to support RHS the camera controller may need some changes.. 

I found simple explanations to LHS and RHS projection matrices in this presentation: http://users.ece.gatech.edu/lanterma/mpg10/mpglecture04f10_3dto2dproj.pdf

Direct3D has LH and RH versions of all the projection functions, e.g. http://msdn.microsoft.com/en-us/library/windows/desktop/bb204936(v=vs.85).aspx

Jul 7, 2012 at 12:02 AM

Let's see..

Helix appears to rotate the WPF default 90 degrees CCW about X, so that Z is up. I need that much, plus a -Y transformation. I can compute that at load and apply a reverse transformation during hit testing, that part is no problem.

I just need the coordinate system axes graphic to also invert the Y arrow, and I'm good to go.

Jul 26, 2012 at 2:41 PM

The link you have posted is somewhat misleading. WPF and OpenGL both use the RHS!!! This applies to the HelixToolkit too.

Aug 9, 2012 at 12:02 AM

Was getting confused here. Agree that WPF use RHS coordinate system for the cameras!

I see there is a need to create an example showing the different configurations...

See http://helixtoolkit.codeplex.com/workitem/9962

Aug 9, 2012 at 1:42 AM

I agree! I'm confused myself and was about to ask, with the "default" axis arrows, which color is x, which is y, which z...

I'm not the one to write that demo, though, in the confused state I'm in...

Oct 2, 2012 at 3:52 AM
RobPerkins wrote:

I agree! I'm confused myself and was about to ask, with the "default" axis arrows, which color is x, which is y, which z...

I'm not the one to write that demo, though, in the confused state I'm in...

Not confused any longer. I'd modified the axis arrows and caused my own pain. It's RHS with no problems at all once I cleared that up.