PDA

View Full Version : Simplify This:



Art
- 29th December 2009, 11:50
Hi Guys,
I wanted to make this less time consuming:


lonwork = limit_left
latwork = limit_top

WHILE lonwork < displon
lonwork = lonwork + zoom
xxx++;
WEND

WHILE latwork > displat
latwork = latwork - zoom
yyy++
WEND


It's all about incrementing xxx & yyy the correct number of times.
The first while loop can be replaced with this:


temp var word
temp = displon - limit_left
xxx = temp / zoom


I can't work out the second while loop.
Any help appreciated.
Cheers, Art.

Acetronics2
- 29th December 2009, 13:48
Hi, Art

Did you notice PBP , as well as C, offers the WHILE/WEND commands ...

supposing your release is not too old ... ( 2.60 for the Day )


Reducing time for adjusting could show some ... dichotomy algorithm ...

Just for the end ... shouldn't the ZOOM value be different for the two loops ??? ( Zoomlon and zoomlat ... i.e )

Alain

Art
- 29th December 2009, 20:19
I have since solved this.


Did you notice PBP , as well as C, offers the WHILE/WEND commands ...

In C, I use:



while (lonwork < displon) {lonwork+= zoom; xxx++;}