Re: How to compute triangle base/altitude intersection
- From: Richard Heathfield <invalid@xxxxxxxxxxxxxxx>
- Date: Wed, 30 Aug 2006 20:50:31 +0000
goose said:
<snip>
Correct up to here I think.
Yes. But my "solution" then made the assumption that C1C2 would be
perpendicular to AB, which needn't be true.
Draw segment AB at 0 on the y-axis
with C being a positive on the y axis (anywhere, doesn't really
matter) and *then* apply the above steps.
After doing so, you should have C1 and C2 (as Richard said).
The X component of either C1 or C2 (should be equal to each
other) is the X component of point D; the y component of D
is, of course, 0.
As long as you are allowed to have AB parallel to the x-axis
that should work.
I don't think we can realistically make that assumption, though, or the OP
presumably would have specified it.
If AB can be a vector with any coordinates
relative to the x-axis it gets a little harder (you'd then
have to translate the basis so that AB is parallel to x-axis,
perform the aforementioned steps and then translate back).
No, you don't have to do that. You can simply calculate the gradient of AB,
and divide it into -1 (i.e. get the negative of its reciprocal) to get the
gradient of a line perpendicular to it. You can now work out the equation
of the line of that gradient that passes through C1, and simultaneous
equations give you point D1. Point D2 can be found similarly.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
.
- References:
- How to compute triangle base/altitude intersection
- From: Balabek
- Re: How to compute triangle base/altitude intersection
- From: Richard Heathfield
- Re: How to compute triangle base/altitude intersection
- From: goose
- How to compute triangle base/altitude intersection
- Prev by Date: Re: Fibonacci implementation
- Next by Date: Re: Fibonacci implementation
- Previous by thread: Re: How to compute triangle base/altitude intersection
- Index(es):