Conversation
|
This is pretty cool! Even as it is seems to work pretty well! |
|
@kk6mrp Thanks for trying it out. If you mirror arcs they will fail, at least in 3D. |
|
The 3D rotation seemed a little different than other objects rotate, not necessarily bad but just different. Is that because it isn't mirroring across anything? I'll have to test it out more tonight, last night I just tried out mirroring a rectangle and cube... |
It's mirroring across an invisible mirror plane. If you drag a point, the mirror plane is adjusted to that point and it's reflection are on opposite sides of the mirror. This means there are 3 degrees of freedom in the reflected part, not a full 6. When you do it in a 2D sketch, it will constrain the mirror to be perpendicular to the sketch plane so the reflected sketch elements are also in that plane. I plan to add an option so any 1,2, or 3 points selected (or ends of a selected line segment) will be constrained on the mirror, or rather the mirror will be constrained to pass through those points. Also hoping to constrain the mirror to a face if one is selected, which would just reflect a solid across that face and join the 2 together. Just have to get the basics working first! |
|
This is turning out to be hard. In EntityBase::NormalGetNum() for the mirrored normals... I'm also wondering if Quaternion.Mirror() is ever used and if we can change the definition so the resulting quaternion will have its RotationN() vector flipped, as that would be useful here. |
|
Is this what you were referring to that faces cannot be selected yet? I get an assert when selecting any face of the mirrored object or when selecting two faces of the mirror I get an assert. |
|
@kk6mrp Yes, that looks like an example. The latest version of this doesn't crash for me, but the faces don't highlight when hovering over them, and they don't do anything when clicked. I think it has to do with having consistent parameters passed to Remap and RemapFaces. I think something is missing like remapping the surfaces? |
|
@jwesthues Could you look at this? I'm not sure why the surfaces of a mirrored extrusion can not be selected. I've had trouble with that before. I might not be defining the new face entities correctly, or might not be doing something right with remap. Other entities are working now. Adding options (constraints) when creating the group will get added after the groups mirror correctly ;-) |
|
Very cool. It looks like you're aiming to create two copies of the original geometry, one unchanged with REMAP_BOTTOM and the other mirrored with REMAP_TOP? I don't immediately see anything wrong with your remapping, though perhaps it would make sense to make just one mirrored copy. If I understand correctly, you couldn't use your current implementation e.g. to create an extrusion of just the mirrored version of a plane sketch, since you'd have both copies in the resulting group. I do notice that you're setting timesApplied to 0 and 1 for the two copies (made with CopyEntity()) but never using it. That seems unnecessary but not harmful. The problem you note with the quaternion's n is fundamental--if we had an entity that generated points/curves lying outside the uv plane, then there would be nothing we could do with that quaternion to mirror that entity. But I think all entities defined in terms of quaternions lie entirely in the uv plane, so that's not actually a problem? If it were then we should hit that when mirroring by importing scaled by a negative number too, and I don't recall any trouble there. Have you tried graphically debugging the faces, like drawing the point and normal vector for each face in the group? I suspect that will be much easier than trying to get all the math right blind. |
|
I think making 2 copies in the new group is consistent with step-rotating and step-translating. That way after mirroring half of something to create a whole, the entire thing can be step-copied or rotated again. By setting timesApplied to 0 or 1 we have the option of making both copies copy-as mirror (the mirror math would only apply to one), but then I decided the first copy could just be a numeric copy, so that's redundant. Arcs seem to be defined by 3 points in 3D and a normal. In order to mirror an arc, I think the normals N vector has to flip. Negating U and V just rotated 180 degrees in the plane. That might need some more investigation. Text entities don't scale by -1 properly but they do mirror correctly. |
That's a good point. Perhaps then use the same flag that distinguishes start "with original" vs. "with copy #1" for translate/rotate, and make it user-selectable?
What fails in the text entities? I did a quick test, and they seem to work linking scaled by -1. The behavior of normals there is rather subtle and I can't immediately articulate why it works, but as far as I knew it did. |
|
The problem with selecting faces was sovled by adding the MIRROR type to the condition in Group::Activate which sets ShowFaces = true; Now they highlight when hovered and the "new" object faces can be clicked/selected. The original crashes when clicked. I've seen this before but don't recall what causes it ;-) more investigating.... |
Any news? "Mirror" feature is really needed to design various parts geometry features. |
|
Had to manually rebase changes on master. Did that in a new branch so closing this PR |
|
#1109 is the new pull request - just for historical cross linking. |

This is my 4th try at mirror groups. Face entites are not working, normals may not either. Other entities work. The shell works, but faces can not be selected yet. Plans are to include options to mirror the group across selected points and to have it work in 2D as well.
Shift->M will create the new group.