<< NL_F_Pairs NL_F: Function NL_F_RandDistribution >>

NARVAL >> NL_F: Function > NL_F_PointOfPolygon

NL_F_PointOfPolygon

Determine if a point belongs to a polygon.

Calling Sequence

[b,x1,y1,x2,y2] = NL_F_PointOfPolygon(P,x,y,d)

Arguments

P :

Polygon.

x :

x-coordinate of the point.

y :

y-coordinate of the point.

d :

Precision.

b :

Boolean.

x1 :

x-coordinate of the first point of the segment.

y1 :

y-coordinate of the first point of the segment.

x2 :

x-coordinate of the second point of the segment.

y2 :

y-coordinate of the second point of the segment.

Description

NL_F_PointOfPolygon determines if the point of coodinates (x,y) belongs to the polygon P=(P1x P1y P2x P2y ... Pnx Pny) defined by the list of its successive points' coordinates. The point N (x,y) is assumed to be part of a segment between the point N1 (x1,y1) and the point N2 (x2,y2) if the distance between (N1,N2) is egal to the sum of the distances between (N,N1) and (N,N2). As we get some issues due to calculation precision, we also consider the precision d ((N1,N2)=(N,N1)+(N,N2)+d). If the point belongs to the polygone, b=%T. Else b=%F and the parameters (x1,y1,x2,y2) are empty.

Examples

P=[100 100 900 100 900 900 100 900];
x=400;
y=100;
d=0.01;
[b,x1,y1,x2,y2]=NL_F_PointOfPolygon(P,x,y,d);//application of NL_F_PointOfPolygon

Dependency

NL_F_DistanceSiDj

Report an issue
<< NL_F_Pairs NL_F: Function NL_F_RandDistribution >>