To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cadOpen lugnet.cad in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / 8741
8740  |  8742
Subject: 
Re: LDraw Math Question??
Newsgroups: 
lugnet.cad
Date: 
Thu, 26 Sep 2002 22:31:52 GMT
Viewed: 
1458 times
  
In lugnet.cad, Kyle McDonald wrote:

> To me this is a left hand coordinate system. Which is fine.
> What I'm curious about is  given the system above, when rotating
> about the Z axis by a positive angle, does the +X axis on the
> right swing up? or down?
> 
> When rotating about the X axis by a positive angle, does the +Z
> that is near the user swing up? or down?

When rotating around X, +Y -> +Z.  When rotating on Y, +Z -> +X.  For Z,
it's +X -> +Y.

> Along with this, I have questions about the Matrices in the type 1
> lines. There are two conventions here; in some systems you transform
> a point as a column vector on the right side of the matrix (as in
> traditional matrix math and as used in the Foley & Van Dam textbook),
> while in some other systems you transform a point as a row vector on the
> left side of the matrix (as in the Newman & Sproull textbook).  This is
> usually correlated with the choice of a right-handed vs. left-handed
> system, but not always.
> 
> Does anyone know which method LDraw uses?

It doesn't matter (I think) - you get the same results either way.
Personally, I program with the vertices as a row vector on the left:

[x1 y1 z1 1]  [xx yx zx 0]
[x2 y2 z2 1]  [xy yy zy 0]
[...       ]  [xz yz zz 0]
              [x  y   z 1]

where the first matrix is composed of all the triples in a files, and
the second matrix is built from the reference to that file:
  1 clr x y z xx xy xz yx yy yz zx zy zz subfile.dat
I find this approach easier to wrap my mind around, especially when I'm
stacking all those triples into a single Nx4 array for processing.

> If a type 1 line is:
> 1 16 X Y Z A B C D E F G H I  file.dat
> 
> and a point in file.dat (x,y,z) then which of the following does LDraw use:
> 
>            A B C
> 1)  x y z * D E F
>            G H I
> 
>            A D G
> 2)  x y z * B E H
>            C F I

This is the closest, but LDraw doesn't actually use any of these.  It
passes all the values around as individual parameters.  But the math is:
  x' = xA + yB + zC + X
  y' = xD + yE + zF + Y
  z' = xG + yH + zI + Z

>      x     A B C
> 3)    y   * D E F
>      z     G H I
> 
>      x     A D G
> 4)    y   * B E H
>      z     C F I

These aren't allowed - matrix multiplication works on two arrays of size
AxB and BxC - the number of columns in array #1 has to equal the number
of rows in array #2.

HTHADNC,
Steve



Message is in Reply To:
  LDraw Math Question??
 
Hi. I'm having a few problems with the LDraw coordinate/rotation system. I understand that LDraw 'world' coordinates follow the following: -X is on the left. +X is on the right. -Y is up +Y is down -Z is into the screen +Z is out of the screen To me (...) (24 years ago, 26-Sep-02, to lugnet.cad)

2 Messages in This Thread:

Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

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