To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.cad.dat.partsOpen lugnet.cad.dat.parts in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 CAD / LDraw Files / Parts / 1694
1693  |  1695
Subject: 
Re: rotation matrices
Newsgroups: 
lugnet.cad.dat.parts
Date: 
Wed, 18 Oct 2000 14:48:37 GMT
Viewed: 
2193 times
  
In lugnet.cad.dat.parts, koen wrote:

> 
> > > Hello,
> > > Does anyone have more information about those 9 numbers that make up the
> > > rotation matrix for a part in the dat file?
> > 
> > Could you be more specific?
> 
> Well, I copied the coordinates of one side of the axlehol8 dat. This gives
> me a plane that is perpendicular to the Y-axis. I then had to position this
> plane on points of the curves and perpendicular to that curve. To get the
> direction I substracted the coordinates of 2 following points wich gives me
> a [a b c] vector to which the plane should be parallel.  The rotation matrix
> I created was then A=[b/l -a/l 0; a/L b/L c/L; -a/l*c/L -b/l*c/L l/L] where
> l=square root(a^2+b^2) , L=square root(a^2+b^2+c^2) and ;means next row. I
> don't really know if this is correct but the results seem to be right.
> Now, can I use these same numbers given by this matrix to position a part
> the correct way?
> 
> (I kind of derived my matrix from the top half of
> http://mathworld.wolfram.com/EulerAngles.html , so is this the correct way
> to do it in Ldraw . Or is there an other kind used since the axes are
> rotated ?)

I briefly scanned the page you mentioned, it looks like it should be OK for
LDraw.  Paul Gyugyi uses a general rotation method for LDLite's ROTATE
meta-statement, and I've implemented an equivalent in LDAO's LDL2DAT
translator.  But I don't know for sure that your specific calculations will
apply to parts or not.

Sorry I can't be more helpful.  This is not the approach I would take on
this problem; my matrix math skills aren't strong enough.

> In the Ldraw faq it also says something about scaling. How is put in to the
> matrix?

In the file-reference command

1 clr x y z a b c d e f g h i file.dat

The transformation matrix can be written:

a  d  g  0
b  e  h  0
c  f  i  0
x  y  z  1

To scale by all dimensions by S, multiply this matrix

S  0  0  0
0  S  0  0
0  0  S  0
0  0  0  1

Which is the same as multiplying all paramaters abcdefghixyz by S.

If you want to scale a single dimension, multiply just the parameters for
that dimension (a b c for x, d e f for y, g h i for z) by S.

> > A couple of things you might be able to do to control filesize:
> > 
> > 0. Make each segment *really* short, and just use axlehol8.dat for each
> > segment.
> 
> I don't really like this solution since it will create an awfull lot of
> triangles wich would take it a larger time to render.
> And I like spinning things 'round and 'round in Ldview a lot, so I can't do
> this.

In this case, each segment would be a single line of code: one reference to
axlehol8.dat.  Assuming you make each segment be 1LDU, you'd have at most a
few hundred lines of code in your file.  If each line is 80 bytes, that's
around 30K total.

> > 1. Put repeated segments into a subfile.  If you got a section of the part
> > that's got a fixed angle, each segment should be the same shape.  If you
> > turn this segment into a subfile, you can reuse the subfile as much as you
> > want, while only adding one line to the main file.
> 
> There are no repeated parts since I don't actually use axlehol8.dat , I just
> use its dimensions and then draw triangles along the outside of the figure
> between two following figures. This gives me a nice and smooth axle wich
> keeps on looking good even when zoomed in .

Are you rebuilding your file based on the zoom-factor?  If you are, then
there's no way to avoid having a very large file.

What I meant by 'repeated segments' is two sections which are the same
size.  This will happen only if you've got the same sweep-angle on two
sections.

> I could of course use subparts for the begin and end piece and for those 6
> cilinders that are located at the beginning and end.
> Can I put these in the same file some way? If yes: how?

Yes, probably.  You can use the MPD format to put subfiles into a main
file.  But not all LDraw tools support MPD cleanly.

> > 2. One thing I've done with bent cylinders is to build each straight
> > segment out of two sloped cylinders with a regular cylinder in the middle.
> > Each segment ends up looking something like this:
> > _________
> > \ |   | /
> >  \|___|/
> > 
> > Except the sloped parts aren't usually that extreme.  After each segment • is
> > constructed, it's a simple matter of arranging the segments so the angled
> > ends meet cleanly.
> > 
> > This approach could work on a crossaxle, except that you would need to
> > construct the 'sloped crossaxle' subpart.  And as long as you are either
> > bending in 2 dimensions, or you have a very regular curve.
> 
> I can't figure the drawing out, it must be deformed by my newsreader.

Are you using a fixed-pitch font?

> but are you perhaps meaning to make subparts like those used in the
> hose2.dat
> on http://www.math.uio.no/~fredrigl/technic/ldraw-mode/ .
> here every piece fits the next as long as the curve isn't too bend.

Somewhat, but that's more like suggestion #1.

> I think that for this curved axle (and sortlike airtubes and flexcables) I
> will stick to the large files, since the difference when zoomed into is
> pretty large with the one on Fredrik Glockner 's page.

OK, as long as you are happy with what you've got.

Steve



Message has 2 Replies:
  Re: rotation matrices
 
(...) What approach would you take? (26 years ago, 18-Oct-00, to lugnet.cad.dat.parts)
  Re: rotation matrices
 
I have put the entire curve online at (URL) 200 Kb I think it's pretty nice except for the strange twists in it. Koen (26 years ago, 18-Oct-00, to lugnet.cad.dat.parts)

Message is in Reply To:
  Re: rotation matrices
 
(...) Well, I copied the coordinates of one side of the axlehol8 dat. This gives me a plane that is perpendicular to the Y-axis. I then had to position this plane on points of the curves and perpendicular to that curve. To get the direction I (...) (26 years ago, 17-Oct-00, to lugnet.cad.dat.parts)

11 Messages in This Thread:



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

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

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