Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function GetCompassAngle(AsDegrees:Boolean=True): Extended;
- var
- north,south: TPoint;
- M:TPoint = [561,20];
- TPA:TPointArray;
- begin
- FindColorsTolerance(TPA, 1911089, 545,4,576,36, 20);
- FilterPointsDist(TPA, 8,15, M.x,M.y);
- north := MiddleTPA(SplitTPA(TPA,3)[0]);
- south := RotatePoint(north,PI, M.x,M.y);
- FindColorsTolerance(TPA, 920735, 545,4,576,36, 20);
- FilterPointsDist(TPA, 0,6, south.x,south.y);
- SortTPAFrom(TPA,M);
- Result := FixRad(ArcTan2(TPA[high(tpa)].y-M.y, TPA[high(tpa)].x-M.x) - (PI/2));
- if AsDegrees then
- Result := Degrees(Result);
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement