Pairing face problem
-
When I say face in this instance I'm speaking of the side of a bounding box and not a SU face. My problem stems from a naive assumption on my part, that the closest pair of faces of two objects would be what I think of as 'opposing', i.e. right with left, top with bottom and so on. Only a second or two of visualization would show that this is not so. Right may easily pair with front, rear with left and similar. Needless to say this does not lead to good result.
So the obvious solution is to rotate the object into 'paired' alignment. My problem is that I'm having trouble thinking of such a solution. Clearly the un-aligned would have to be rotated to match the target but what does that imply? I mean it is obvious that right would have to rotate to become rear in order to match up with front...and I suppose that means a rotation around the z-axis assuming normal orientation. Seems like it would always be a single 90Β° right or left(around the given axis).
So the sledgehammer approach is to map out each possible rotation and apply it. Which leads me to ask is the a better solution?
-
So you would like to specify the "face" on the "moved" object which is to be "paired" with a specified face on the "fixed" object?
-
@sdmitch said:
So you would like to specify the "face" on the "moved" object which is to be "paired" with a specified face on the "fixed" object?
Pretty much. As part of the existing code I already know the orientation of the two object BB faces. And have written code for opposite? so I know when things are amiss. The rotate90 code is also written. I'm now pondering the code between. And wondering if rotation will always be positive.
-
@hsmyers said:
@sdmitch said:
So you would like to specify the "face" on the "moved" object which is to be "paired" with a specified face on the "fixed" object?
Pretty much. As part of the existing code I already know the orientation of the two object BB faces. And have written code for opposite? so I know when things are amiss. The rotate90 code is also written. I'm now pondering the code between. And wondering if rotation will always be positive.
No, it can be negative. The sign of 'z' of the product of the two vectors you are using to determine the angle_between should be the sign of the angle of rotation.
-
@sdmitch said:
No, it can be negative. The sign of 'z' of the product of the two vectors you are using to determine the angle_between should be the sign of the angle of rotation.
Very good to know. I just built a 3d grid of nine boxes to see how many bad pairs I can find. Anything on a diagonal path is bad so far. That arrangement seems like it should be all of the possible pairings but I'm not yet confident enough to bet the farm on it.
-
@hsmyers said:
@sdmitch said:
No, it can be negative. The sign of 'z' of the product of the two vectors you are using to determine the angle_between should be the sign of the angle of rotation.
Very good to know. I just built a 3d grid of nine boxes to see how many bad pairs I can find. Anything on a diagonal path is bad so far. That arrangement seems like it should be all of the possible pairings but I'm not yet confident enough to bet the farm on it.
As always, posting a model or pictures will help us better understand what it is you are trying to accomplish.
As for bounding boxes, their orientation never changes regardless of what you do to the component or group. corner(0) will always be xmin,ymin,zmin and corner(7) will always be xmax,ymax,zmax of the entity in its present orientation.
-
You know, I've yet to solve the problem of adding an image to a post? Never-mind...it pays to actually look at the screen staring you in the face...doh!! These are all individual groups. Here is a correctly paired and moved (face center to face center) pair followed by an incorrect pairing...Ignore the purple dot and odd selection coloring, they are not germane.
Thus far I've found 13 pairings that fail for obvious reasons:
- Bottom, Left"
- Bottom, Right"
- Front, Bottom"
- Front, Left"
- Front, Right"
- Front, Top"
- Rear, Bottom"
- Rear, Left"
- Rear, Right"
- Rear, Top"
- Top, Left"
- Top, Right"
I will continue to test at least until I figure a way to code, detect and fix.
-
What defines a good or bad pairing?
-
@sdmitch said:
What defines a good or bad pairing?
No overlap when moved center to center. Where 'center' is center of paired face.
Advertisement