How to calculate the 3D line segment of two rectangles?

You'll need to combine three common 3D operations: Turn the two rectangles into two planes (just take three of the four vertices and build the plane from that) Intersect the two planes to get an infinite line (see here ) Intersect this line with the bounding lines of the first rectangle. You should get two intersections which are the end points of the line segment you seek.

You'll need to combine three common 3D operations: Turn the two rectangles into two planes (just take three of the four vertices and build the plane from that). Intersect the two planes to get an infinite line (see here). Intersect this line with the bounding lines of the first rectangle.

You should get two intersections which are the end points of the line segment you seek.

I believe this computes intersection of the first rectangle with the plane that contains the second rectangle. And 2. Might yield a plane instead of a line (the case when both rectangles are in the same plane).

– RafaÅ‚ Dowgird Nov 9 '09 at 11:28 @RafaÅ‚ Dowgird: You're right about 2. One should first check if the rectangles are parallel (through their normals) before trying to find an intersection. – Ivan Nov 9 '09 at 11:41 The intersection algorithm will tell you when the planes are coplanar (see the link I posted for the test).

– Aaron Digulla Nov 9 '09 at 12:45 Perhaps I don't understand 3. What do "the lines" in "Intersect the lines" refer to? – RafaÅ‚ Dowgird Nov 9 '09 at 14:03 Oops ... fixed.It's the line which you get from step #2.

Your 3D library should come with helper methods that implement all of these operations. – Aaron Digulla Nov 9 '09 at 14:45.

Based on Aaron's answer, which I believe contains an error: Turn the two rectangles into two planes (just take three of the four vertices and build the plane from that). Intersect the two planes to get an infinite line (*). Intersect this line with the bounding lines of the first rectangle.

Intersect result of 3 with the bounding lines of the second rectangle. If you omit step 4, then you get a false intersection when first rectangle intersects the second rectangle's plane but not the rectangle itself. Example: rectangle1=(-1,-1,0),(-1,1,0),(1,1,0),(1,-1,0) rectangle2=(0,50,50),(0,50,40),(0,40,40),(0,40,50) Plane1 is z=0, plane2 is x=0, their intersection is the y axis, which intersects rectangle1 at 1 and -1.

The rectangles do not intersect, though. (*) If the planes overlap, the rectangles' intersection can still be a line, but it's a rather nasty case.

Turn the two rectangles into two planes (just take three of the four vertices and build the plane from that). Intersect the two planes to get an infinite line (*). Intersect this line with the bounding lines of the first rectangle.

Intersect result of 3 with the bounding lines of the second rectangle. If you omit step 4, then you get a false intersection when first rectangle intersects the second rectangle's plane but not the rectangle itself. Plane1 is z=0, plane2 is x=0, their intersection is the y axis, which intersects rectangle1 at 1 and -1.

The rectangles do not intersect, though. (*) If the planes overlap, the rectangles' intersection can still be a line, but it's a rather nasty case.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions