Subject:
|
Re: Quick way to mirror-image a model?
|
Newsgroups:
|
lugnet.cad
|
Date:
|
Thu, 24 Jun 2004 15:09:39 GMT
|
Viewed:
|
4155 times
|
| |
![Post a public reply to this message](/news/icon-reply.gif) | |
In lugnet.cad, Carl Nelson wrote:
> What about a flag for default behavior? I've been coding to ignore
> ones with default rotations,
Why? I have a slow PC, and running the mirwiz.exe program is
nearly instantaneous. It's a lookup and 2 matrix multiplies per
part. If the exception matrix lookup fails, use the default matrix.
It would take extra, unneeded code to ignore things. Resist the
urge...
> but there are plenty of parts (especially slopes) that need a
> (-1 0 0 0 1 0 0 0 1) rotation
Stop saying rotation. It makes me think you're not doing it right.
That's a mirror matrix.
> applied when reflected front-to-back
> and it would be nice to have a flag to distinguish those needing
> default behavior from those where the true correction matrix is
> (-1 0 0 0 1 0 0 0 1).
If you *always* do the same matrix math there's no need to
distinguish. If you're not, then you're making extra busy work
for yourself and possibly introducing bugs. Here's the pseudo code.
for (*ALL* parts in the subfile)
{
float m[4][4]; // Tempory working matrix.
float md[4][4] = { // Default = left-right mirror
{-1.0,0.0,0.0,0.0},
{0.0,1.0,0.0,0.0},
{0.0,0.0,1.0,0.0},
{0.0,0.0,0.0,1.0}
};
float *me = md; // Init exception mirror to left-right (the default).
float *mp = md; // Init global subfile mirror to left-right.
for( i=0; i< numExceptions; i++ )
{
if (exception[i] matches this part)
{
// Use the matrix from the exception list (instead of md).
me = exception[i].matrix
// Also use the substitute partname
strcpy(datname, exception[i].datname);
break;
}
}
M4M4Mul(m,LinePtr->v,me); // Run the initial mirror on the part
M4M4Mul(LinePtr->v,mp,m); // Apply global subfile mirror to part
// NOTE: You can set mp to mirror across whatever plane you want.
// The example here mirrors the subfile across the YZ plane.
}
It's simple and it's all done with mirrors, except for a few weird
parts which might contain a rotation and/or translation component
mixed in with the mirroring in the me matrix.
So far I've only found a few door parts that need a translation
component. See http://ldglite.sf.net/mirror.ini for details on
the doors.
Enjoy,
Don
|
|
Message has 1 Reply: ![](/news/x.gif) | | Re: Quick way to mirror-image a model?
|
| (...) Why process something as an exception when the default behavior is needed? It's all in what one sees as extra, unneeded code. ;-) Though I just did some timing and I don't see any performance differences between ignoring them and not. (...) (...) (20 years ago, 24-Jun-04, to lugnet.cad)
|
Message is in Reply To:
![](/news/x.gif) | | Re: Quick way to mirror-image a model?
|
| What about a flag for default behavior? I've been coding to ignore ones with default rotations, but there are plenty of parts (especially slopes) that need a (-1 0 0 0 1 0 0 0 1) rotation applied when reflected front-to-back and it would be nice to (...) (20 years ago, 24-Jun-04, to lugnet.cad)
|
65 Messages in This Thread: ![Quick way to mirror-image a model? -Carl Nelson (17-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Steve Krass (17-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Dave Schuler (17-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/246.gif) ![Re: Quick way to mirror-image a model? -Don Heyse (17-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/246.gif) ![Re: Quick way to mirror-image a model? -Don Heyse (17-Jun-04 to lugnet.cad)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: Quick way to mirror-image a model? -Dave Schuler (17-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/246.gif) ![Re: Quick way to mirror-image a model? -Don Heyse (17-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/246.gif) ![Re: Quick way to mirror-image a model? -Dave Schuler (17-Jun-04 to lugnet.cad)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: Quick way to mirror-image a model? -Carl Nelson (18-Jun-04 to lugnet.cad)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: Quick way to mirror-image a model? -Travis Cobbs (17-Jun-04 to lugnet.cad)](/news/x.gif)
![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: Quick way to mirror-image a model? -Carl Nelson (17-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Dave Schuler (17-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Dave Schuler (17-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Carl Nelson (18-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/246.gif) ![Re: Quick way to mirror-image a model? -Carl Nelson (18-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Carl Nelson (18-Jun-04 to lugnet.cad)](/news/x.gif)
![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: Quick way to mirror-image a model? -Dave Schuler (18-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Carl Nelson (18-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Don Heyse (18-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/246.gif) ![Re: Quick way to mirror-image a model? -Don Heyse (18-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Don Heyse (18-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Steve Bliss (18-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/246.gif) ![Re: Quick way to mirror-image a model? -Don Heyse (18-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Steve Bliss (21-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Don Heyse (21-Jun-04 to lugnet.cad)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: Quick way to mirror-image a model? -Don Heyse (21-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Steve Bliss (21-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Don Heyse (21-Jun-04 to lugnet.cad)](/news/x.gif)
![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: Quick way to mirror-image a model? -Carl Nelson (21-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Don Heyse (22-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/246.gif) ![Re: Quick way to mirror-image a model? -Carl Nelson (22-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Don Heyse (22-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/246.gif) ![Re: Quick way to mirror-image a model? -Carl Nelson (23-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/246.gif) ![Re: Quick way to mirror-image a model? -Don Heyse (23-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Carl Nelson (23-Jun-04 to lugnet.cad)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: Quick way to mirror-image a model? -Steve Bliss (23-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/246.gif) ![Re: Quick way to mirror-image a model? -Carl Nelson (23-Jun-04 to lugnet.cad)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: Quick way to mirror-image a model? -Carl Nelson (23-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Don Heyse (23-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Carl Nelson (23-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Don Heyse (23-Jun-04 to lugnet.cad, lugnet.cad.mlcad)](/news/x.gif) ![](/news/246.gif) ![Re: Quick way to mirror-image a model? -Steve Bliss (23-Jun-04 to lugnet.cad, lugnet.cad.mlcad)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: Quick way to mirror-image a model? -Michael Lachmann (24-Jun-04 to lugnet.cad, lugnet.cad.mlcad)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/268.gif) ![Re: Quick way to mirror-image a model? -Steve Bliss (23-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Don Heyse (23-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Don Heyse (23-Jun-04 to lugnet.cad)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: Quick way to mirror-image a model? -Steve Bliss (23-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Steve Bliss (23-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Carl Nelson (24-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/246.gif) ![Re: Quick way to mirror-image a model? -Carl Nelson (24-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Don Heyse (24-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Carl Nelson (24-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Don Heyse (24-Jun-04 to lugnet.cad)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![You are here](/news/here.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Carl Nelson (24-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/246.gif) ![Re: Quick way to mirror-image a model? -Steve Bliss (24-Jun-04 to lugnet.cad)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: Quick way to mirror-image a model? -Steve Bliss (24-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/246.gif) ![Re: Quick way to mirror-image a model? -Don Heyse (24-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Steve Bliss (24-Jun-04 to lugnet.cad)](/news/x.gif)
![](/news/x.gif) ![](/news/28.gif) ![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: Quick way to mirror-image a model? -Carl Nelson (25-Jun-04 to lugnet.cad)](/news/x.gif) ![](/news/46.gif) ![Re: Quick way to mirror-image a model? -Don Heyse (2-Jul-04 to lugnet.cad)](/news/x.gif)
![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Developing MLCAD plugins? -Don Heyse (23-Jun-04 to lugnet.cad, lugnet.cad.mlcad)](/news/x.gif) ![](/news/46.gif) ![Re: Developing MLCAD plugins? -Michael Lachmann (24-Jun-04 to lugnet.cad, lugnet.cad.mlcad)](/news/x.gif) ![](/news/46.gif) ![Re: Developing MLCAD plugins? -Don Heyse (24-Jun-04 to lugnet.cad, lugnet.cad.mlcad)](/news/x.gif) ![](/news/46.gif) ![Re: Developing MLCAD plugins? -Michael Lachmann (4-Jul-04 to lugnet.cad, lugnet.cad.mlcad)](/news/x.gif)
- 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
|
|
|
|