> it makes no sense to talk about anything being
perpendicular to a point. perpendicularity is a property of two
lines.
I have two points: P along a curve, targetP. For each P I
have an already determined tangent in the form of an angle, in
degrees. I think what I really want to know is which P's tangent is
closest to intersecting targetP. It's really hard to explain...
take a look at this illustration:
http://abeall.com/files/temp/perpendicular.gif
The red lines represent my P tangents. targetP is fixed, and
notice how Pn is clearly the only point which is "perpendicular" to
the targetP, or whose tangent intersects targetP, or whatever that
should be called. I can solve for as many P along the curve as I
need, I need to know which of them is Pn.
The curve is a cubic bezier, incidentally. My curve function
is attached.
Now, I don't want to dilute the issue, which at its core is
finding what P is closest to having its tangent intersect targetP,
but the added challenge is this: to begin with, I have no points,
and I solve the bezier curve for one point at one end, 0.1
time(time ranges from 0-1), and see how "perpendicular" it is.
Then, I solve at 0.2 time, and so forth, incrementing by 0.1 until
I can see that I've overstepped the perpendicular point. So say I'm
at 0.4 and it is almost perpendicular, and 0.5 is a little passed
perpendicular -- perpendicular must be betweeon 0.4 and 0.5. Right
now I'm relying on a negative-positive switch, ie a little before
perpendicular is a small positive number, a little past
perpendicular is a small negative number. Then I repeat the process
between 0.4 and 0.5, incrementing by 0.01 this time. I repeat the
process recursively several decimal points to achieve adaptive
accuracy. Where I'm having a problem with the method I came up with
is that I can't accurately tell when I've overstepped
"perpendicularity" (because there isn't always a
negative-to-positive or positive-to-negative switch when
overstepping) and so I effectively can't find Pn at all.
Don't let it distract you too much, but I've also attached
the [not-working] method I have to find Pn.
Thanks.