CodePudding user response:
Find that point recently, according to the origin and the point recently a sine value, according to the origin and the point that you point a sine value, and then compareCodePudding user response:
1, line charts are made by the worksheet of x, y array,2, by the origin (x1, y1) x1 value, in the array of the worksheet, found that point vertical line and the line intersection point, the corresponding work table on the left side of the nearest point (xl, y |) and the nearest point on the right (xR, yR),
3, from the above two points, it is concluded that the line of the midpoint (x0, y0) value,
4, y1 & gt; Y0 points above the line, y1=y0 point on the line, y1 & lt; Y0 beneath the point on the line,
CodePudding user response:
Can you point in detail? Such as line is S type, then, any point is given, and judgment on what side of the s-shaped line of this pointCodePudding user response:
Can according to the above line to create a Region, judging PtInRegion have not suddenly come out?CodePudding user response:
This is the problem of analytic geometry, the same is true of S curve, according to my method, mathematical model is set up, can solve,CodePudding user response:
Here is whether a point in a polygon code, with IndexOfPolygon,Type
TPointX=record
X: double;
Y: double;
end;
TPointList=Array of TPointX;
TPolygonInfo=record
Indx: Byte;
PCount: Word;
P: TPointList;
end;
TLineSegment=record
Pt1: TPointX;
Pt2: TPointX;
end;
The function Multiply (const p1, p2, p0: TPointX) : Double;
The function IsOnline (P: TPointX; The Line: TLineSegment) : Boolean;
The function InPolygon (const PolygonInfo: TPolygonInfo; P: TPointX) : Integer;
The function intersects (const L1 and L2: TLineSegment) : Boolean;
Const
INFINITY e10=1.5;
ESP=1.5 e-5;
MAX_N=1000;
The function Multiply (const p1, p2, p0: TPointX) : Double;
The begin
Result:=((p1) X-ray p0) x) * (p2) y - p0) y) - (p2) X-ray p0) x) * (p1) y - p0) y));
end;
//determine whether line segment contains some point
The function IsOnline (P: TPointX; The Line: TLineSegment) : Boolean;
The begin
Result:=((Abs (Multiply (Line. Pt1, Line pt2, P)) & lt; ESP) and
((P.x - Line. Pt1. X) * (P.x - Line. Pt2. X) & lt;=0) and
((P.y - line. Pt1. Y) * (P.y - line. Pt2. Y) & lt;=0));
end;
//determine point in polygon
The function InPolygon (const PolygonInfo: TPolygonInfo; P: TPointX) : Integer;
Var
N: Integer;
I, the count: Integer;
Side of the Line: TLineSegment;
The begin
//int n=polygon. The size ();
N:=PolygonInfo. PCount;
Count:=0;
Line. Pt1:=P;
Line. Pt2. : y=P.y;
Line. Pt2. : x=- INFINITY;
Do the for I:=0 to n - 1
The begin
//get a side of the polygon
Side. Pt1:=PolygonInfo. P [I];
Side. Pt2:=PolygonInfo. P [(I + 1) mod N];
If IsOnline (P, side) then
The begin
Result:=1;
end;
//if the side parallel x don't consider to
If (Abs (side. Pt1. Y - side. Pt2. Y) & lt; ESP) then
The begin
continue;
end;
If IsOnline (side. Pt1, line) then
The begin
If (side. Pt1. Y & gt; Side. Pt2. Y) then
Inc (Count);
End
The else
If IsOnline (side. Pt2, line) then
The begin
If (side. Pt2. Y & gt; Side. Pt1. Y) then
Inc (Count)
End
The else
If intersects (line, side) then
The begin
Inc (count);
end;
end;
If (count mod 2)=1 then
Result:=0
The else
Result:=2;
end;
//determine line segment intersection
The function intersects (const L1 and L2: TLineSegment) : Boolean;
The begin
Result:=((Max (L1. Pt1. X, L1. Pt2. X) & gt;=min (L2) pt1) x, L2. Pt2. X)) and
(Max (L2) pt1) x, L2. Pt2. X) & gt;=min (L1. Pt1. X, L1. Pt2. X)) and
(Max (L1. Pt1. J y, L1. Pt2. Y) & gt;=min (L2) pt1) y, L2. Pt2. Y)) and
(Max (L2) pt1) y, L2. Pt2. Y) & gt;=min (L1. Pt1. J y, L1. Pt2. Y)) and
(Multiply (L2) pt1, L1. Pt2, L1. Pt1) * Multiply (L1. Pt2, L2. Pt2, L1 pt1) & gt;=0) and
(Multiply (L1) pt1, L2. Pt2, L2. The pt1) * Multiply (L2. Pt2, L1. Pt2, L2 pt1) & gt;=0));
end;
The function IndexOfPolygon (const APoint: TPointX; Const AreaInfoList: TPolygonInfoList) : Boolean;
The begin
Flag:=InPolygon (AreaInfoList,; APoint) : Integer;
If Flag<=1 then
The begin
Result:=True;
Exit;
end;
end;
CodePudding user response:
1, line charts are made by the worksheet of x, y array,2, by the origin (x1, y1) x1 value, in the array of the worksheet, found that point vertical line and the line intersection point, the corresponding work table on the left side of the nearest point (xl, y |) and the nearest point on the right (xR, yR),
3, from the above two points, it is concluded that the line of the midpoint (x0, y0) value,
4, y1 & gt; Y0 points above the line, y1=y0 point on the line, y1 & lt; Y0 beneath the point on the line,
Didn't quite understand
CodePudding user response:
To take to the first line array in recent distance of the line segment, then use vector cross product judgment came outCodePudding user response:
To take to the first line array in recent distance of the line segment, then use vector cross product to judge came outThe vertical distance is to point to the line?
CodePudding user response: