On May 10, 4:04 pm, "Roger Stafford"
<ellieandrogerxy...@mindspring.com.invalid> wrote:
> "Lucas campos" <campos.lu...@gmail.com> wrote in message <hs7tnq$lr...@fred.mathworks.com>...
> > Hi Everybody,
>
> > Could anyone tell me how to find the tangent between a point and a polygon?
>
> > Thanks
>
> > Lucas
>
>       
> The notion of a line being tangent to a polygon is alien to the very nature of polygons. You force me to speculate about what you really must mean.
>
> My guess is that you want to find a line which runs through a given point and is tangent, ideally to a given perfectly smooth curve, except for the fact that the curve is being approximated by a discrete set of points and line segments connecting them and therefore forming a polygon. Do I guess correctly?
>
> Provided your curve has a welldefined equation y = f(x) where f(x) can be differentiated, your line can be determined as the solution to an equation:
>
> (f(x)y0)/(xx0) = f'(x) ,
>
> where (x0,y0) is the given point, where (x,f(x)) is the point of tangency on the curve y = f(x), and where f'(x) is the derivative of f(x) with respect to x. When you find a solution x to this equation, you have found a point of tangency for a line from the point.
>
> How you solve the equation depends much on the nature of f(x).
>
> If you have no such equation y = f(x), then it becomes a matter of finding three consecutive points (x1,y1), (x2,y2), (x3,y3), on the polygon for which
>
> (y1y0)/(x1x0)((y2y0)/(x2x0)
>
> and
>
> (y2y0)/(x2x0)((y3y0)/(x3x0)
>
> are of opposite sign. Where this happens you can consider a line from (x0,y0) as approximately "tangent" at the point (x2,y2).
>
> Roger Stafford
Alternatively, Roger, I speculate that the OP means normal, not
tangent.
That's the only thing that makes sense to me.
