SRL Archive - Discussions and Debates

FindCompassAngle...


Negaal

2007-11-18 07:24:33

Tryed to post SRL bugs section but system kept telling me to choose bug type… there was no items to select in combobox

Put compass North as possible…

writeln(inttostr(findcompassangle));


debug box :
261


tried many-many angles:

Successfully compiled
261
Successfully executed
Successfully compiled
261
Successfully executed
Successfully compiled
95
Successfully executed
Successfully compiled
261
Successfully executed
Successfully compiled
261
Successfully executed
Successfully compiled
95
Successfully executed
Successfully compiled
261
Successfully executed


Used ScarScape Low-Detail… 32 bit true color
hmm…?

Wizzup?

2007-11-18 07:26:59

rs_GetCompassAngleDegrees.

Or:

Function GetCompassAngle: Extended;

Var
Compass: TPointArray;
Point: TPoint;

Begin
FindColorsTolerance(Compass, 1911089, 540, 2, 590, 40, 0);
If Length(Compass) < 1 Then
Exit;
Point := MiddleTPA(Compass);
Result := Degrees(ArcTan2(Point.Y - 20, Point.X - 561)) + 90;
If (Result < 0) Then
Result := Result + 360;
End;

Harry

2007-11-18 07:29:49

Yeah. MakeCompass('x') will never work for me :|

Negaal

2007-11-18 09:31:34

From: Wizzup?
rs_GetCompassAngleDegrees.



nah…:p

taken from srl library:
function FindCompassAngle: Integer;
By: Freddy1990
Description: returns degrees clockwise compass is rotated
returns -1 if compass angle not found
*******************************************************************************}

function FindCompassAngle: integer;

begin
Result := Round(rs_GetCompassAngleDegrees);
end;