Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Point Polygon Tangent

Subject: Point Polygon Tangent

From: Lucas campos

Date: 10 May, 2010 03:15:06

Message: 1 of 4

Hi Everybody,

Could anyone tell me how to find the tangent between a point and a polygon?

Thanks

Lucas

Subject: Point Polygon Tangent

From: Roger Stafford

Date: 10 May, 2010 04:04:22

Message: 2 of 4

"Lucas campos" <campos.lucas@gmail.com> wrote in message <hs7tnq$lrl$1@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 well-defined equation y = f(x) where f(x) can be differentiated, your line can be determined as the solution to an equation:

 (f(x)-y0)/(x-x0) = 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

 (y1-y0)/(x1-x0)-((y2-y0)/(x2-x0)

and

 (y2-y0)/(x2-x0)-((y3-y0)/(x3-x0)

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

Subject: Point Polygon Tangent

From: TideMan

Date: 10 May, 2010 04:30:02

Message: 3 of 4

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 well-defined equation y = f(x) where f(x) can be differentiated, your line can be determined as the solution to an equation:
>
>  (f(x)-y0)/(x-x0) = 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
>
>  (y1-y0)/(x1-x0)-((y2-y0)/(x2-x0)
>
> and
>
>  (y2-y0)/(x2-x0)-((y3-y0)/(x3-x0)
>
> 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.

Subject: Point Polygon Tangent

From: Roger Stafford

Date: 10 May, 2010 04:46:03

Message: 4 of 4

"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <hs80k6$oh6$1@fred.mathworks.com>...
> .........
> 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
>
> (y1-y0)/(x1-x0)-((y2-y0)/(x2-x0)
>
> and
>
> (y2-y0)/(x2-x0)-((y3-y0)/(x3-x0)
>
> 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

  Added note: I would prefer to have written those last two expressions in the more robust form:

 (y1-y0)*(x2-x0)-(y2-y0)*(x1-x0)

and

 (y2-y0)*(x3-x0)-(y3-y0)*(x2-x0)

should be of opposite signs for (x2,y2) to be a point of "tangency".

Roger Stafford

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us