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 / 11623
11622  |  11624
Subject: 
Re: Quick way to mirror-image a model?
Newsgroups: 
lugnet.cad
Date: 
Tue, 22 Jun 2004 21:32:55 GMT
Viewed: 
5986 times
  
In lugnet.cad, Carl Nelson wrote:
> In lugnet.cad, Don Heyse wrote:
> > Under Steve's scheme the exception matrix for 3045.dat would be
> > created by multiplying a mirror matrix by a rotate 90 matrix.  This
> > would create a part that looks identical, but is in fact mirrored. So
> > I don't think you need more than one exception matrix per part.  Look
> > at this.  The second part looks similar, but is actually mirrored.
> > That's the exception matrix for MIRROR.INI (except for the -32 Z
> > offset).
> > 
> > 1 2 0 0 0 1 0 0 0 1 0 0 0 1 3045.dat
> > 1 1 0 -32 0 0 0 -1 0 1 0 -1 0 0 3045.dat
> > 
> > Here's Steve's method using homogeneous 4x4 matrices (because they
> > make the math pretty):
> > 
> >   Default = MD = (-1, 0, 0, 0,   0, 1, 0, 0,    0, 0, 1, 0,    0, 0, 0, 1)
> >   Exception = ME = (a, d, g, 0,   b, e, h, 0,    c, f, i, 0,    x, y, z, 1)
> > 
> >     For a typical (left right symmetric) part ME = MD
> > 
> >   Current = MC = (A, D, G, 0,   B, E, H, 0,    C, F, I, 0,    X, Y, Z, 1)
> >   Mirror across an arbitrary plane = MP = (...)
> >     see http://www.geocities.com/SiliconValley/2151/matrices.html
> >     (or use a simple mirror across the xy, yz, or xz plane).
> > 
> >   For each part, calculate MF (final matrix) where:
> >   Mirrored (with no mirrored parts) = MF = MP * MC * ME
> 
> Steve, Don--thanks for the explanations; this now makes complete sense
> to me (finally!).
> 
> For a reflection about the plane containing the Z & Y axes
> (left-to-right), the reflection matrix (Mp) should be:
> 
> -1 0  0
> 0  1  0
> 0  0  1
> 
> Then Mp * (part-file rotation matrix from LDraw file) * Mp works for
> most parts.
> 
> Substitute the second Mp for the exception matrix for the exception
> parts.  The exception matrix needs to rotate to proper orientation
> and unmirror the part--for 2357 (brick 2 x 2 corner), the rotation
> matrix is:
> 
> 0  0 -1
> 0  1  0
> 1  0  0
> 
> To unmirror, the C element should be -1.

Err, I'm not sure what you mean by unmirror.  I got
(0 0 1 0 1 0 1 0 0   0 0 0) for a mirror.ini exception matrix, which
looks yours except for the sign of that one number.

> Works like a charm so far, and I haven't found any parts that
> aren't solvable by a single exception matrix yet.

Me neither.

> Anybody see a problem with the algorithm to generate the
> rotation matrix setting
> A = -A and C = -C every time?  One should always be 0, right?

> > Unless the text parsing code is already written.  Then it's the same.
> > I put the MLCAD.INI (minifig configurator) file parsing in CVS on the
> > sourceforge, and the proposed MIRROR.INI file uses the same format.
> > However if you want to convert to and from XML, that's ok with me.
> 
> OK, I haven't done anything else about the config file, but I'll
> stick with text if everyone thinks that's a better idea.
> 
> > Sounds like it could work.
> 
> Now I just have to program it! ;-)
> I better get busy coding...

And generating the MIRROR.INI file.  I did some corner parts, some
triangular wings, some minifig arms and legs, and some technic liftarms.
I also created a tiny C program to parse MIRROR.INI and use it to mirror
a file across the ZY plane.  It seems to work so far.  The source, ini,
and a windows command line executable is here:

  http://ldglite.sf.net/mirwin.zip

If anyone wants to update MIRROR.INI for all 2500 parts, that'd be
fantastic.

Enjoy,

Don



Message has 3 Replies:
  Re: Quick way to mirror-image a model?
 
(...) Unreflect is a better word--just undo the X coordinate swap that -1 0 0 0 1 0 0 0 1 does. I believe they're equivalent things--I'm doing a clockwise rotation, then negating the X coordinate swap, you're doing the opposite rotation. I think (...) (22 years ago, 23-Jun-04, to lugnet.cad)
  Re: Quick way to mirror-image a model?
 
(...) Dibs on Wings and files starting with 1! How hard would it be to support normal, self-referential reflections for patterned parts? So we could map all 973*.dat parts to themselves, with a default mirror. Steve (22 years ago, 23-Jun-04, to lugnet.cad)
  Re: Quick way to mirror-image a model?
 
(...) In mirror.ini, you noted: ; NOTE: I started using the Flags to keep track of which parts I checked. ; 0 = not checked. ; 1 = substitute part ; 2 = mirror across XY plane instead of default of ZY plane ; 3 = mirror and rotate a bit. ; 4 = (...) (22 years ago, 23-Jun-04, to lugnet.cad)

Message is in Reply To:
  Re: Quick way to mirror-image a model?
 
(...) Steve, Don--thanks for the explanations; this now makes complete sense to me (finally!). For a reflection about the plane containing the Z & Y axes (left-to-right), the reflection matrix (Mp) should be: -1 0 0 0 1 0 0 0 1 Then Mp * (part-file (...) (22 years ago, 22-Jun-04, to lugnet.cad)

65 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