To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cad.devOpen lugnet.cad.dev in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / Development / 10503
     
   
Subject: 
Re: LDraw coordinate system driving me crazy
Newsgroups: 
lugnet.cad.dev
Date: 
Sun, 19 Nov 2006 15:00:39 GMT
Viewed: 
2885 times
  

In lugnet.cad.dev, Roland Melkert wrote:
   Hello all,

I’m having difficulties with the ldraw coordinate system. As fas I understood it it’s Right handed, just like OpenGL. So


I’ve been having difficulty with importing/exporting .dat files from SketchUp. In SketchUp, if you stand at the Origin;

X is right, Y is forward, and Z is up.

The LDraw Primitives Reference (http://www.ldraw.org/library/primref/) says the LDraw axes are:

X is right, Y is down, and Z is forward. Here’s the image from the reference page.



So it first seems like a simple 90 degree rotation around the X axis is all you need to convert between SketchUp and LDraw system, but it doesn’t work in practice. I can’t get the 2 systems to agree on an axes system.

   
         
     
Subject: 
Re: LDraw coordinate system driving me crazy
Newsgroups: 
lugnet.cad.dev
Date: 
Sun, 19 Nov 2006 15:16:12 GMT
Viewed: 
2896 times
  

In lugnet.cad.dev, Jim Foltz wrote:
   In lugnet.cad.dev, Roland Melkert wrote:
   Hello all,

I’m having difficulties with the ldraw coordinate system. As fas I understood it it’s Right handed, just like OpenGL. So


I’ve been having difficulty with importing/exporting .dat files from SketchUp. In SketchUp, if you stand at the Origin;

X is right, Y is forward, and Z is up.

The LDraw Primitives Reference (http://www.ldraw.org/library/primref/) says the LDraw axes are:

X is right, Y is down, and Z is forward. Here’s the image from the reference page.



So it first seems like a simple 90 degree rotation around the X axis is all you need to convert between SketchUp and LDraw system, but it doesn’t work in practice. I can’t get the 2 systems to agree on an axes system.

In LDraw +z is backwards, not forwards or more strictly +Z points away from the camera when X is right and -Y is up.

Tim

    
          
     
Subject: 
Re: LDraw coordinate system driving me crazy
Newsgroups: 
lugnet.cad.dev
Date: 
Sun, 19 Nov 2006 18:31:55 GMT
Viewed: 
2916 times
  

Hi,

Here’s my box test model in SketchUp. (The above model is the same model unfolded.)



When I export this model to a .dat and open it in LDView, the green side is the top-view, blue is the front view (as expected), and I would expect the right-view to be orange. But I get the red side as the right side.

Here is the right-view in LDView



Any idea how I can translate this on export?

    
          
      
Subject: 
Re: LDraw coordinate system driving me crazy
Newsgroups: 
lugnet.cad.dev
Date: 
Sun, 19 Nov 2006 18:57:51 GMT
Viewed: 
2975 times
  

In lugnet.cad.dev, Jim Foltz wrote:
   Hi,

Here’s my box test model in SketchUp. (The above model is the same model unfolded.)



When I export this model to a .dat and open it in LDView, the green side is the top-view, blue is the front view (as expected), and I would expect the right-view to be orange. But I get the red side as the right side.

Here is the right-view in LDView



Any idea how I can translate this on export?

That looks like a correct mapping to me. Unless I’m mistaken the red and orange are on the same sides in both pictures. The unwrapped boxes are definitely identical and unless you’ve moved them in one or the other the whole thing is right.

Tim

     
           
      
Subject: 
Re: LDraw coordinate system driving me crazy
Newsgroups: 
lugnet.cad.dev
Date: 
Sun, 19 Nov 2006 22:24:42 GMT
Viewed: 
3005 times
  

In lugnet.cad.dev, Timothy Gould wrote:
   In lugnet.cad.dev, Jim Foltz wrote:
   Here is the right-view in LDView



Any idea how I can translate this on export?

That looks like a correct mapping to me. Unless I’m mistaken the red and orange are on the same sides in both pictures. The unwrapped boxes are definitely identical and unless you’ve moved them in one or the other the whole thing is right.

I agree with Tim. It looks fine to me. If there were any mirroring going on, then either the orange and red would be swapped on the unwrapped box, or the green and grey would be swapped.

The picture in LDView has a rotated camera angle relative to the one in Sketchup, but the geometry remains unchanged.

--Travis

    
          
     
Subject: 
Re: LDraw coordinate system driving me crazy
Newsgroups: 
lugnet.cad.dev
Date: 
Sun, 19 Nov 2006 19:59:03 GMT
Viewed: 
2934 times
  

Jim Foltz wrote:

Any idea how I can translate this on export?

Google uses the right handed system but indeed rotated by 90 degrees,
LDraw also uses the right handed system but 180 degrees rotated.

It should not matter how you show the model, the coordinates are
interchangeable, but if you want to use sketchup for drawing LDraw stuff
you should indeed rotate 90 degrees around the x-axis to get the
standard orientation of parts people expect.

I don't get why LDview switches left and right because the only side's
that change are front/back and top/bottom.

Have you tested in mlcad, there you can see the axis.

Roland

   
         
   
Subject: 
Re: LDraw coordinate system driving me crazy
Newsgroups: 
lugnet.cad.dev
Date: 
Mon, 20 Nov 2006 07:23:02 GMT
Viewed: 
3151 times
  

A sincere thanks to all of you. Your comments made me go back over (again) my export code, and I found an error. Now it works as expected. I was getting funny rotations because I mis-ordered the elements of the transformation matrix, duh. Seems obvious in hindsight.

Yea! Now I can draw right-side-up. (Helmet done in SketchUp.)



 

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR