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 / 11576
  Quick way to mirror-image a model?
 
Hi-- Does anybody know a quick way to do a mirror image of an LDraw model? For example, a castle that I'm working on has a left and right tower that are mirror images (not rotations) of each other (and the rear corner towers are mirrors of the front (...) (20 years ago, 17-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) I usually use submodels save your tower as a tower-left or something. you have to go thruogh each part and change either the x or z value to the opposite value (ex. if the X is -300 change to 300) then rotate each part 180 degrees. There are (...) (20 years ago, 17-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) The way I usually do this is clunky, but it basically works. It also requires a little familiarity with MS Excel and some kind of text editor, as well as an understanding of the LDraw DAT-file format. Create a backup of the MOC file. Open the (...) (20 years ago, 17-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) L (...) This is silly. Just put the structure you want to mirror in a subfile and do this. 1 0 0 0 0 1 0 0 0 1 0 0 0 1 subfile.ldr 1 0 320 0 0 -1 0 0 0 1 0 0 0 1 subfile.ldr You can do it in ldglite using the scale by (-1,1,1) command (just (...) (20 years ago, 17-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) Oops, wrong color. That should be 1 16 0 0 0 1 0 0 0 1 0 0 0 1 subfile.ldr 1 16 320 0 0 -1 0 0 0 1 0 0 0 1 subfile.ldr just in case... Enjoy, Don (20 years ago, 17-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) Won't that cause all of the LEGO logo on all of the studs in the mirrored parts to be reversed? I thought that part of the point of the question was to avoid that. I think that measures are being taken to correct the mirrored-logo issue, but (...) (20 years ago, 17-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
In lugnet.cad, Dave Schuler wrote: [snip] (...) Bad choice of words "silly". Sorry about that, but he asked for a "quick" way to do it. He used the word "quick" twice in fact. But everyone seemed intent on providing a thorough, but complex method (...) (20 years ago, 17-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) Fair enough--I guess "quick" is in the eye of the beholder. 8^) Dave! (20 years ago, 17-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) Thanks for the responses--they were very helpful. I found the disadvantage to Don's rotation matrix method to be that when it's used the mouse commands in MLCad are reversed, i.e., dragging the part left moves it right--but it sure worked (...) (20 years ago, 17-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?  [DAT]
 
(...) You know, I think you're correct about that. I think I'm the last person who still uses LEdit as his primary LDraw platform, and for reasons of my own I always orient my parts and models rotated 90 degrees relative to the true LDraw standard (...) (20 years ago, 17-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?  [DAT]
 
(...) Dumb, dumb, dumb. To be a true "mirror" as you've requested, the second example should have read this way: A B C D E F G H I J K L M N O P 1 16 -100 0 -10 -1 0 0 0 1 0 0 0 -1 3001.DAT The way I originally posted it, the 3001 brick would be (...) (20 years ago, 17-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) If this bothers you, a partial solution is here: (URL) the results from running the program aren't really appropriate for distribution to others, you can at least do your own POV renderings (as long as you don't use -lgeo). Additionally, the (...) (20 years ago, 17-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) I didn't necessarily mean quick, I meant easy. Hey, I'm lazy. ;-) I like both answers because you gave me what I needed to know to accomplish the task quickly, Dave gave me what I needed to know to understand what I'm doing! Carl (20 years ago, 18-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) Wouldn't that still be a 180 degree rotation rather than a flip, since -1 0 0 (x y z) * 0 1 0 = (-x y -z) 0 0 -1 ? Or am I laying out my rotation matrix incorrectly (is the first line a b c or a d g)? Sorry for all the stupid questions, I'm (...) (20 years ago, 18-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) I found the answer to this ((URL) the first column should be a d g. My poor layout doesnn't change the rotation matrix (I think). Carl (20 years ago, 18-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) Darn it, I meant the first ROW. (Doesn't show that I have a math degree, eh? ;-) Carl (20 years ago, 18-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) When you ask a stupid question, I'll let you know! 8^) You're right--it would rotate the brick 180 degrees, but I think that's necessary sometimes (like for the 2x2 slope bricks mirrored left-to-right). But you're also right that this isn't (...) (20 years ago, 18-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) Now that I've done that, I agree with you. The true proper thing to do is to adjust the rotation matrix of all parts by -a d -g (x, y, z) * -b e -h = (-ax-by-cz, dx+ey+fz, -gx-hy-iz) -c f -i and create a list of exceptions that would be a (...) (20 years ago, 18-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) Take a peek at the MLCAD.INI file for minifig posing. Could you use a config file like this to handle the exceptions? I'd imagine if you pick one axis for mirroring that works best with most parts, (I think Travis said most were symmetric (...) (20 years ago, 18-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) Oh yeah, the other exception would be a part substitution, like left minifig arm for right arm, or left wing plates for right wing plates. But watch out, some folks might object to substituting left-wing for right-wing of anything. ;^) (...) (20 years ago, 18-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) Talking to myself... Here's what I'm talking about. Completely ripped off from the MLcad.ini file. (URL) one contains an entry every part in my parts.lst file. It needs to have the changes made for the exceptions, but here's how it starts. ; ; (...) (20 years ago, 18-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?  [DAT]
 
(...) [...] (...) I think I've got a more general solution, but first a quick thought: You could make mirror.ini more human-readable if the 'normal' parts were just flagged. Something like: 2546.DAT default 41770.DAT exception 41769.DAT 0 1 0 0 0 1 (...) (20 years ago, 18-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) Actually I was thinking of deleting them from the file to make it smaller. The only problem is remembering which ones were deleted and which ones are new at update time. I'm not sure how to automate additions either way. Probably have to use (...) (20 years ago, 18-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) Keep a full.mirror.ini, with all the default entries. A simple grep drop the extra lines, giving us mirror.ini. (...) Well, it depends entirely on whether or not applying two mirroring transformations always gives an un-mirrored result. If (...) (20 years ago, 21-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) Or generate a parts.lst (and stash it somewhere) before adding parts, then diff it with the new parts.lst. I'm not sure how grep fits into your plan though... (...) My math intuition says it should be. There are only two choices for the sign (...) (20 years ago, 21-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) Err, Shouldn't that be (-1 0 0 0 1 0 0 0 1)? You have to negate the X coordinate to mirror across the Z axis. Don (20 years ago, 21-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) Sorry, I misunderstood the terminology. I figured you could either mirror across a plane, or along a line. You can't mirror across a line - it's 1D. So I assumed when people were writing about mirroring 'across the Z axis', they meant to use (...) (20 years ago, 21-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) Heh, I was thinking 2-dimensionally. It's easier for my tired old brain. All my sketches were happening on the XZ plane so mirroring across the Z axis made total sense to me. Oh well. (...) Ok, now I have to follow through and actually make a (...) (20 years ago, 21-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) Is there any documentation about what functionality needs to be exposed to make an MLCAD plugin? I've been playing with this in a class-based architecture, that has an LMirrorExceptionList that contains an array of LMirrorExceptionPart. I've (...) (20 years ago, 21-Jun-04, to lugnet.cad)
 
  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)
 
  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 (...) (20 years ago, 22-Jun-04, to lugnet.cad)
 
  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)
 
  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 (...) (20 years ago, 23-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) We already got some of them. The 4360 Space laser gun with side sight is gonna to be a problem. You just *know* someone out there'll hook it up to something by the stud on the asymetric sight portion. And there'll be no end to the whining when (...) (20 years ago, 23-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) Yup, oh well. I guess the mirror specification could always translate it with no rotation, or add a comment to the LDraw file saying that this part needs to be checked for proper placement. (...) Thanks! I put a 2 x 2 red brick by a 1 x 6 x 5 (...) (20 years ago, 23-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) Would that work in general cases, or just for right-left reflection? (...) Actually, I think they're not - "Steve's algorithm" (ha!) requires that both the MP and ME transforms be mirroring, so that the MF transform would be non-mirroring. (...) (20 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 (20 years ago, 23-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) It would need to determine the plane of reflection, and do the second reflection on the X components for left-right or Z components for front-back. (...) I've come up with the same results in all cases so far. I'll do some thinking as to which (...) (20 years ago, 23-Jun-04, to lugnet.cad)
 
  Developing MLCAD plugins?
 
(...) I forwarded this question to here because I don't know the answer. Apparently there has been some discussion in the past about developing plugins for MLCAD: (URL) there a specification for plugin development? Thanks, Don (20 years ago, 23-Jun-04, to lugnet.cad, lugnet.cad.mlcad)
 
  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 = (...) (20 years ago, 23-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) and another two: ; 6 = asymmetric ; 7 = asymmetric, but in a non-significant way Part 108 (a shock absorber spring) is getting a 7. Steve (20 years ago, 23-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) Read the comments at the top of MIRROR.INI in the zip file. I already did a bunch of wings. Only tested one though... Is there something special about files starting with 1, or are you taking an alphabetical approach? Sadly, I created my (...) (20 years ago, 23-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?  [DAT]
 
(...) Can you or Don check my work? I'm trying to figure out why the ME transform that I did works in my program and the ME that Don put in mirror.ini works in his code, but not vice-versa. The most likely explanation is that I'm doing something (...) (20 years ago, 23-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) Ignore the 9 suggestion, I see you're already way ahead of me on flag definition. Don (20 years ago, 23-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) Probably. ;^) (...) Matrix multiplication is not commutative. (distributive? Err, I forget my math terms.) You're doing one or more of the multiplications in the wrong order? Try ME * (MC * MP) instead. Notice I switched the order inside the (...) (20 years ago, 23-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) It's neither commutative [(a * b) * c != a * (b * c)] nor associative [a * b != b * a]. That shouldn't be the problem in the calculation above, since the current matrix was the identity matrix... (...) Looks like you're doing MF = MP * (MC * (...) (20 years ago, 23-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) Yes, that looks right. The other thing that messes me up with LDRAW matrices is the row, column ordering. The ordering in LDRAW files is not what I would have chosen, so I always have to look it up. From the old FAQ: (URL) type 1's format is: (...) (20 years ago, 23-Jun-04, to lugnet.cad, lugnet.cad.mlcad)
 
  Re: Quick way to mirror-image a model?
 
(...) Total side note: I agree with Don, row/column ordering is not what I would have chosen. BUT, it is far easier (IMO) to hand-transform row/column LDraw commands than the equivalent column/row commands (like I've had to do in POV-Ray code). (...) (20 years ago, 23-Jun-04, to lugnet.cad, lugnet.cad.mlcad)
 
  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)
 
  Re: Quick way to mirror-image a model?
 
(...) Never mind. 5 would be the correct value for this, right? (20 years ago, 24-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) 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 (...) (20 years ago, 24-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) I don't think so. 5 is for keeping track of which parts we've looked at, not which ones to ignore when your run your mirror program. Eventually I think we'll remove all the ones marked with a 5 from the MIRROR.INI file. (And that includes the (...) (20 years ago, 24-Jun-04, to lugnet.cad)
 
  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)
 
  Re: Quick way to mirror-image a model?
 
(...) IMO there *is* value to knowing that the proper exception matrix is indeed an exception rather than coincidentally the same as the default matrix. If the 5 is not the place for this, there should be a new flag for it. It's especially important (...) (20 years ago, 24-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) Sure, but you still haven't convinced me there's any difference between a 2x2 brick and a 2x2 slope brick. I must be getting senile in my old age, because I just don't get it. Anyhow, use 55 if it makes you happy. We'll figure out what to do (...) (20 years ago, 24-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
Hi Don, now it's getting interesting ... "Don Heyse" <dheyse@hotmail.spam....away.com> schrieb im Newsbeitrag news:HzrwBF.9t2@lugnet.com... <SNIP> (...) I'm actually reading it in as | a b c | | d e f | | g h i | and that is also how I'm writing my (...) (20 years ago, 24-Jun-04, to lugnet.cad, lugnet.cad.mlcad)
 
  Re: Developing MLCAD plugins?
 
Done, "Don Heyse" <dheyse@hotmail.spam....away.com> schrieb im Newsbeitrag news:Hzrprv.14sB@lugnet.com... <SNIP> (...) No sorry, MLCad does not support plugins yet, currently I have a very quick way introducing new generators and pseudo commands by (...) (20 years ago, 24-Jun-04, to lugnet.cad, lugnet.cad.mlcad)
 
  Re: Developing MLCAD plugins?
 
(...) While you're checking, think about this. What if the MLCad generators were reconfigured as some sort of plugins, and the plugin specs were documented? Then everyone could use your generators. You know, weird people like me who are frightened (...) (20 years ago, 24-Jun-04, to lugnet.cad, lugnet.cad.mlcad)
 
  Re: Quick way to mirror-image a model?
 
(...) Well, yeah. But it's simpler to process it all -- the only exceptional processing you need is "look for the part in mirror.ini. If not found, use the default settings". With your method, you have to also add "if the matrix looks like MD, then (...) (20 years ago, 24-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
Oops, I missed replying to one point. (...) If you mean (-1 0 0 0 1 0 0 0 1) as the 'default' matrix, my response is: that default matrix works for *any* reflection across any arbitrary plane. If you mean (-1 0 0 0 1 0 0 0 1) as the reflection (...) (20 years ago, 24-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) Uh, I thought we were refering to it as "Steve's algorithm". Are you having 2nd thoughts? ;^) Enjoy, Don PS. Why am I constantly seeing really long lines in the browser for this thread. It makes things really hard to read when I have to scroll (...) (20 years ago, 24-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) Sorry, I should have said "Don's pseudo-code". ;) (...) I don't know - I'm replying via the web interface, posting with plain text. (20 years ago, 24-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) Alright, I give up then. I've accomplished my original goal of mirroring a model, and I'm just confusing and frustrating myself and wasting your and Don's time with stupid questions. I've put the newest executable & source code at: (URL) (20 years ago, 25-Jun-04, to lugnet.cad)
 
  Re: Quick way to mirror-image a model?
 
(...) I've put the complete mirror.ini file here for now. (URL) (20 years ago, 2-Jul-04, to lugnet.cad)
 
  Re: Developing MLCAD plugins?
 
Don, "Don Heyse" <dheyse@hotmail.spam....away.com> schrieb im Newsbeitrag news:Hztzr8.y0t@lugnet.com... <SNIP> (...) That will be documented anyway - sure. But for that feature I have to think even more ... but I have already an idea how that could (...) (20 years ago, 4-Jul-04, to lugnet.cad, lugnet.cad.mlcad)

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