Jump to content
Sign in to follow this  
Midoge

Looking for an elegant way to store coordinates

Recommended Posts

Midoge

Hi,

i got a bunch of coords that need to be saved/callable and im pretty unsure which method would be best to work with. May you have some ideas for me? Ill scribe what the data looks like:

-- resolution: 640,480
-- -- fx1: 100,100
-- -- fx2; 178,178
-- -- fx_n_incremented; somenumber,somenumber
-- resolution: 1336,1338
-- -- fx1: 0,0
-- -- fx_n_incremented: 999.999

There are like 200 f(x,y) to be solved per minute, writing them to an array results the script to look pretty unreadable. WWYD? ;D

Share this post


Link to post
Share on other sites
Clark

Personally, I would just use an array. Not sure why you are saying the script becomes unreadable though.

Share this post


Link to post
Share on other sites
Midoge

it just lacked my knowledge to create it readable, sry^^. anyway, as the data should be changable/saveable by user, it would be better to have some modifiable container

Share this post


Link to post
Share on other sites
Xandy

Array example using stored x and y coords to draw lines all over the place in paint

msgbox(0, "", "don't touch the mouse or keyboard", 2)
$xymax= 2000;0..1999 is 2000
$xydatamax= 2;0..1 is 2
dim $xy[$xymax][$xydatamax]; this creates a 2 dimension array 0-1999 rows with 2 data members each
;loop fills the array with random values, your user could input them manualy too
for $i= 0 to $xymax-1
   $xy[$i][0]= random(100, @desktopwidth-100, 1);random x coord
   $xy[$i][1]= random(100, @desktopheight-100, 1);random y coord
next
;fun with paint
run("mspaint");open the paint
;winwaitactive("untitled - Paint");halt till paint active - I removed this in favor of sleep
sleep(400);sleep might be better language compatibly issues and all
send("^e");send resize surface command
;winwaitactive("Attributes");halt till resize canvas window open - removed in favor of sleep; seriously I never get sleep
sleep(300);wait till size window open
send(@desktopwidth&"{tab}"&@desktopheight&"{enter}");send new paint canvas size information to paint dialog
for $i= 0 to $xymax-1;this loop will draw lines to all the coords in $xy[][] array
   mousedown("left");we draw lines by holding down the left mouse button then moving the mouse
   mousemove($xy[$i][0], $xy[$i][1], 0);move mouse
   $cursor= mousegetpos();we wouldn't want to use $cursor undeclared
   while $cursor[0]<> $xy[$i][0] and $cursor[1]<> $xy[$i][1];halt while cursor moves (if not instant)
      $cursor= mousegetpos();get the mouse cursor position to test if it's reached it's destination xandy coord
   wend
next
mouseup("left");let the mouse button go
;pretty cool enjoy

Posted Image

run time about 25seconds

on a 8year old AMD Athlon 64 X2 4200+ 2.21 GHz

Edited by Xandy

Share this post


Link to post
Share on other sites
jchd

It all depend on what you call "a bunch" and what exactly you intend to do with those coordinates...

What is your usage context?

Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×