Re: Geometry problem (slightly OT)
Re: Geometry problem (slightly OT)
- Subject: Re: Geometry problem (slightly OT)
- From: Glenn Andreas <email@hidden>
- Date: Tue, 21 Sep 2004 10:13:14 -0500
At 12:59 AM +1000 9/22/04, Graham Cox wrote:
On 22 Sep 2004, at 12:26 am, Nicko van Someren wrote:
The knowns are:
* A single point representing the centre of the intersection -
both rects are centred widthwise at this point.
* The angle between the rects and their angles on the plane
* The widths of both rects, which can differ
This is easy. Given the way you have described the rectangles they
can each be considered to consist of two parallel sides which are
important and two ends which are unimportant. If the first
rectangle has important sides A and B and the second has important
sides C and D then the vertices of your rhomboid are the
intersection point AC, AD, BC and BD.
Yes, this is easy ;) However, they aren't really rectangles, they're
lines that go off for a long way and in fact are part of a curve,
but in the local intersection area they can be considered to be
rectangles. Given this, I don't have the points A B C and D, I only
have the specific information listed above. Generating the points A
B C D from this information is as difficult as the solution I'm
looking for it seems. Normally trigonometry is not something I have
a problem with, but in this case I haven't been able to come up with
a geometric construction that yields readily to being worked on with
trig functions. Intuitively I can see that I have all the info I
need to solve the problem, but deriving the solution with only that
info is proving a bit tough. Maybe I'm just too tired...
Maybe I'm missing something, but isn't this just the case of
intersect two lines with two other lines and use those points?
So you start with two "fat" lines, which gets transformed into two
sets of two mathematical lines parallel to each other (probably by
offsetting the original line by half the width perpendicular to the
line itself).
You then use standard line intersection routines to find where each
of those lines intersects with the other, and boom, there are your
corners.
Or rougly, if you've got a line A-B, and C-D with width W, you make
four new points for each line:
A1 = A offset by W/2 perpendicular to A-B
B1 = B offset by W/2 perpendicular to A-B
A2 = A offset by -W/2 perpendicular to A-B
B2 = B offset by -W/2 perpendicular to A-B
(similarly for C1,C2, D1,D2)
Line A1-B1 is then the "left" edge of A-B, A2-B2 is the "right" edge of A-B.
Then you get four corners:
X1 = intersection of A1-B1 and C1-D1
X2 = intersection of A1-B1 and C2-D2
X3 = intersection of A2-B2 and C1-D1
X4 = intersection of A2-B2 and C2-D2
--
Glenn Andreas email@hidden
<http://www.gandreas.com/> oh my!
Mad, Bad, and Dangerous to Know
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden