SRL Archive - Help and Support

Extreme Idea!


skilld u

2008-05-08 16:51:47

I was thinking about this yesterday and was wondering if it would be possible; and if so, how would I go about doing it?

My idea is to find a specific color of a tree and draw a line threw it, like so:


And then look for another pixel in a different area of the tree and draw a line threw that as well:


Next it will find where the lines meet:


It will move the mouse there and then check for up-text and then click the mouse.

Is this even remotely possible?

HyperSecret

2008-05-08 17:07:21

incorporate it with Ed's idea here

http://www.srl-forums.com/forum/intersect-t32408.html

definitely possible

possibly having 1 tpoint from an array stored and another point from a 2nd tpointarray and find where the intersect…

skilld u

2008-05-08 17:08:09

thats where i got the idea from. :p

but i was just wondering how I would go about doing it.

Sir R. M8gic1an

2008-05-08 17:08:30

it is possible but you have a couple of problems there.
to draw a line you need 2 points.

i'm glad this is basic 2D math and not 3D

actually instead of writing out a whole post have a look at Special Ed's Intersect function. (either in test corner or new functions forum here in membs)

if you use his function you will only need to find 4 points, 2 for each line. but i think that what would suit you best is not only the intersection of the lines, but two lines that go through each other and all axis are of 90º, i do not know the name for them in English.

remember that the lines might actually cross each other outside of the tree or you may be getting the points from two different trees. i like your idea :)

good luck ;)

edit: hyper beat me to mentioning Ed >.>

~RM

skilld u

2008-05-08 17:20:50

but how would i go about drawing the lines?

Killerdou

2008-05-08 17:22:27

uhm if the lines are diagonal and horizontal, the coords would
point1.x, point2.y (or point2.x, point1.y) if they dont, markus made a solver somewhere, that should work :)

HyperSecret

2008-05-08 17:33:10

you could also add in some type of distance search between point1 and the intersecting point, and point2 and the intersecting point…and if the distance is farther than a certain distance (depending on tree type) you would know then if its from the same tree or not

Cazax

2008-05-08 17:46:10

Easier:
Find the colors and store them in a TPA.
Sort them in a T2DPointArray.
Then you just middle one by one and move the mouse checking the up text and the distance between ATPA's.

ShowerThoughts

2008-05-08 17:54:23

From: Cazax
Easier:
Find the colors and store them in a TPA.
Sort them in a T2DPointArray.
Then you just middle one by one and move the mouse checking the up text and the distance between ATPA's.


Right.

R0b0t1

2008-05-08 19:27:29

You can find the (two) point(s) those lines intersect at by using one's x co-ord and one's y co-ord.

No, you do not need a separate TPA for each line, just the point. The line comes from leaving out either the x, for a vertical line, or the y for a horizontal line (IDK if I got that backwards). But anyway, you can then access any x/y point a horizontal/vertical line.

Special Ed

2008-05-08 20:30:59

From: Rasta Magician
it is possible but you have a couple of problems there.
to draw a line you need 2 points.

i'm glad this is basic 2D math and not 3D

actually instead of writing out a whole post have a look at Special Ed's Intersect function. (either in test corner or new functions forum here in membs)

if you use his function you will only need to find 4 points, 2 for each line. but i think that what would suit you best is not only the intersection of the lines, but two lines that go through each other and all axis are of 90º, i do not know the name for them in English.

remember that the lines might actually cross each other outside of the tree or you may be getting the points from two different trees. i like your idea :)

good luck ;)

edit: hyper beat me to mentioning Ed >.>

~RM


Perpendicular Bisectors, Rasta. Also FloodFill / FindColorsTolerance?

R0b0t1

2008-05-08 20:39:53

You still only need two points…. unless you want the length of the line.

Macrosoft

2008-05-08 20:53:57

If im correct, you want the first point to make a horizontal line and the 2nd point to make a vertical line and then find the intersection?

simple, use the y coord of the first point and the x coord of the 2nd point

I think i misunderstood…someone would have said this…

Edit: you wouldn't be drawing lines, you would be writing equations for them and finding values for x and y so that both equations work with the same values of x and y. Has your school covered systems of linear equations yet?

Edit 2: Im not sure you benefit from finding objects this way…

Bobarkinator

2008-05-08 21:22:03

Question, if you found the point on the tree in the first place, why don't you move your mouse to that point and save yourself the coding?

skilld u

2008-05-08 21:26:16

idk. i was just thinking about this and it sounded like a good idea :p

but i guess not.

R0b0t1

2008-05-08 21:43:20

Macrosoft, I did say that ;)

Macrosoft

2008-05-08 23:10:53

sry r0b0t1

Sir R. M8gic1an

2008-05-09 05:13:13

actually just as a small conclusion i think Robot's idea was the best

two points: (x1, y1) (x2, y2)
they will intesect at (x1, y2) and (x2, y1) how to choose the points i'd say FindColorsSpiralTolerance.

but then again i think this would be way less efficient than TPAs. but it got us thinking which is fun :)

~RM

Negaal

2008-05-09 09:39:28

Mhm, can someone please tell me what's the point of this? Randomizing?

skilld u

2008-05-09 16:00:40

i was just trying to think of a unique way to find the tree. :p

the scar noob

2008-05-09 16:01:10

From: Special Ed
Perpendicular Bisectors, Rasta. Also FloodFill / FindColorsTolerance?


Floodfill. Does anyone has got the balls to make a function for this? hmm Ray and pwnaz0r were working on it, but still didn't finished it:rolleyes:

-Tsn.

Killerdou

2008-05-09 16:05:13

From: Rasta Magician
actually just as a small conclusion i think Robot's idea was the best

two points: (x1, y1) (x2, y2)
they will intesect at (x1, y2) and (x2, y1) how to choose the points i'd say FindColorsSpiralTolerance.

but then again i think this would be way less efficient than TPAs. but it got us thinking which is fun :)

~RM


Sure, Robot's idea:eek: , it was mine first:fiery: lol thanks for saying its a good idea though:)

R0b0t1

2008-05-09 23:23:10

It was? Didn't see post by you about it…


But, actually, I'm pretty sure mine would be faster anyway, even without actually having to test them.

Mine:

* 1 call to a findcolor function.
* About 5 movement of data, at the most, being generous.
* Return two points or four longs.


With TPA's:

* At least 1 call to a findcolor, maybe more.
* Array allocation.
* Variable allocation.
* Moving information.
* Some array functions (remove duplicates or w/e)
* Multiple for loopage, which probably includes more array functions. (BIG CHUNK OF TIME)
* I'm pretty sure it requires some cascading 'if..then' statements.
* Return the result, which is a TPA, and most likely has over 100 elements.

mixster

2008-05-10 05:58:20

function FindColorIntcptTol(var x, y: Integer; color, xs, ys, xe, ye, Tolerance: Integer): boolean;
var
pts: TPointArray;
i: Integer;
begin
Result := False;
Result := FindColorsTolerance(pts, color, xs, ys, xe, ye, Tolerance);
if Length(pts) = 0 then
Result := False;
if not Result then exit;
x := pts[0].x;
for i := 0 to High(pts) do
if pts[i].y > y then
y := pts[i].y;
end;

That should work as you wanted - Finds the highest point (which luckily enough is the first found for FindColorsTolerance) then goes through all the points looking for the highest y point and it then uses that along with the first x to return the intercept point. It also returns false if FindColorsTolerance fails or it returns 0 points.All you then have to do is move the mouse and check the UpText and it will be as you wished it worked 100% as I just provide the main part ;)