SRL Archive - SRL Archives

FindColorCircle2 - by n3ss3s


n3ss3s

2007-08-02 15:12:37

Yea, well I was bored and I made a FindColorCircle, but the difference is that it searches from out to in, and very useful for walking if we wouldnt have radial walk, because it would take as long steps as possible.

EDIT: One thing, could someone tell me how to add radial search for it? I mean to search for the color like RadialWalk does?


function FindColorCircle2(var Cx2, Cy2: Integer; Color, MidX, MidY, StartDist,
MinDist, Tol: Integer): Boolean;
var
Dx, Dy, Dist: Integer; // Its ready here since global x and y will be removed
begin
for Dist := StartDist downto MinDist do
begin
if(FindColorCircleTolerance(Dx, Dy, Color, MidX, MidY, Dist, Tol))then
begin
if(Distance(Dx, Dy, MidX, MidY) = Distance(MidX, MidY, MidX + Dist,
MidY)) then
begin
Cx2 := Dx;
Cy2 := Dy;
Result := True;
end else
begin
Status('Distance is now ' + IntToStr(Dist - 1));
end;
end;
end;
end;

Santa_Clause

2007-08-02 19:18:31

I love FindColorCircle!

Smartzkid

2007-08-02 19:42:12

Isn't the original built into SCAR? Thus this would be pretty slow?

mastaraymond

2007-08-02 19:46:43

From: Smartzkid
Isn't the original built into SCAR? Thus this would be pretty slow?
1 point for SmartzKid :spot:. Someday you will become superman!

~Raymond

WhiteShadow

2007-08-02 21:41:53

var
x, y, fx, fy:integer;

function FinderoftheMM(var dx, dy: integer; colorDUR, myTol, s, e: integer): boolean;
var
x1, y1, i, Radius, dTol: integer;
begin
dTol := myTol;
repeat
for i := s to e do
begin
x1 := Round(Radius * Sin(i)) + MMCx;
y1 := Round(-Radius * Cos(i)) + MMCy;
if (FindColorTolerance(x, y, colorDUR, x1 - 1, y1 - 1, x1 + 1, y1 + 1, dTol)) then
begin
Result := true;
dx := x;
dy := y;
end;
end;
Radius := Radius + 5;
until (Radius >= 70) or (result)
end;

begin
if FinderoftheMM(fx, fy, 5832335, 50, 0, 360) then
Writeln('we didn''t failz0r. ');
end.

//.Quickly wrote this based off my other functions. Ask, if you have any questions about it. :]

n3ss3s

2007-08-03 04:51:21

Okay, first of all, what does sin and cos do?

Pentti

2007-08-03 04:59:15

From: n3ss3s
Okay, first of all, what does sin and cos do?

Muahha. Dont you know nothing about math? :D

(mitä ne sulle siel koulus oikee opettaa :rolleyes: ) :D

n3ss3s

2007-08-03 05:13:37

(mitä ne sulle siel koulus oikee opettaa )

Ei mitää mut mun isoisä on matikan proffa :)
voit arvella milt selitys "Hyperboliselle Cotangentille" kuulostaa :P

Miitchyy

2007-08-03 05:57:13

Sine and Cosine are Trigonometrical ratios, You can use them to get the coordinates of a certain angle from a certain radius of a circle though

n3ss3s

2007-08-03 06:18:25

Sine and Cosine are Trigonometrical ratios, You can use them to get the coordinates of a certain angle from a certain radius of a circle though


ok ty

Miitchyy

2007-08-03 06:46:13

function FindColorCircle2(var Cx2, Cy2: Integer; Color, MidX, MidY, StartDist,
MinDist, StartDeg, EndDeg, Tol: Integer): Boolean;
var
Dx, Dy, Dist, I, X1, Y1: Integer; // Its ready here since global x and y will be removed
begin
for Dist := StartDist downto MinDist do
begin
for I := Max(StartDeg, EndDeg) downto Min(StartDeg, EndDeg) do
begin
X1 := Round(Dist * Sin(I * pi /180)) + MidX;
Y1 := Round(-Dist * Cos(I * pi /180)) + MidY;
if(FindColorTolerance(Dx, Dy, Color, X1, Y1, X1 + 1, Y1 + 1, Tol))then
begin
if(Distance(Dx, Dy, MidX, MidY) = Distance(MidX, MidY, MidX + Dist, MidY)) then
begin
Cx2 := Dx;
Cy2 := Dy;
Result := True;
end else
begin
Status('Distance is now ' + IntToStr(Dist - 1));
end;
end;
end;
end;
end;

Is that what your trying to do?

n3ss3s

2007-08-03 06:50:12

Looks like, thx.

I just wonder why there isnt FindRadialColorCircle??

Miitchyy

2007-08-03 07:03:10

I'm not 100% sure but I think it would be FindDegreeColorCircle, But I'm not sure, I'm most likely wrong.
Because I think the Radial is to do with the Radius but like I said, now that I think about it yea I think im wrong.

I forgot what a degree was

n3ss3s

2007-08-03 07:07:20

lawl :D plz dont post here anymore, I made new thread with my 2 new functions, plz go post there instead , because otherwise when this gets bumped ppl wont see the other one.. Its also in the new functions.
(its the "my 2 new..")