Subject:
|
Re: Quick way to mirror-image a model?
|
Newsgroups:
|
lugnet.cad
|
Date:
|
Tue, 22 Jun 2004 20:50:13 GMT
|
Viewed:
|
3694 times
|
| |
| |
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.
Works like a charm so far, and I haven't found any parts that aren't solvable by
a single exception matrix yet.
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! ;-)
> Forget about rotation and use Steve's plan. Universally applying
> 2 mirror matrices works for all parts. In this case, the exceptions
> use a default left-right mirror matrix for the initial mirror.
Yup. Far easier!
I better get busy coding...
Thanks,
Carl
|
|
Message has 1 Reply: | | Re: Quick way to mirror-image a model?
|
| (...) 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. (...) Me neither. (...) And generating the MIRROR.INI file. I did some (...) (20 years ago, 22-Jun-04, to lugnet.cad)
|
Message is in Reply To:
| | Re: Quick way to mirror-image a model? [DAT]
|
| (...) Hmm, I don't know. I'm pretty sure there's documentation on language DLL creation, but I'm not so sure about the generators. Ask this on the .mlcad group. (...) XML works, but it's harder for humans (ie. me) to read. (...) Under Steve's scheme (...) (20 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
|
|
|
|