|
-
Apr 3rd, 2003, 01:21 AM
#1
I cant figure out this algorithm
I have a funtion drawing() like this:
Code:
private sub drawing()
max = calculate_max() 'determine max hight
min=calculate_min() 'min height
Me.ScaleHeight = (2.2 * (max - min))
me.refresh
vertical_coordinates <-----problem
draw things here.....
end sub
Eash time user puts a new terrain point (distance and height) in a Flexgrid and press ENTER this function is executed to resize and redraw.
Vertical Coordinates are the Y coordinates of the draw, that is
enclosed in a square i draw that is almost half the size of the screen. Look:
IMAGE LINK
Well, I cant show good coordinates where it says "here!"
I mean: there coord shoud be like 5 - 10 - 15 etc..
or 10-20-30. .etc
but with some numbers im getting somethig like:
21- 42- 63 (1 each 20).
OR: 547- 637- etc..
I need this coordinates to be rounded numbers like:
10, 15, 20... or 100, 200, 300.....or 540, 560, 580, etc
im trying something like:
Code:
dim hight as double
dim number as long
hight = max-min
do while max/10 <>int(max/10) 'is max divisible per 10
max=max+1
loop
hight=max-min 'recalculate
number=hight/10
do while min/10 <>int(min/10) 'is min divisible per 10
min=min-1
loop
hight=max-min 'recalculate
number=hight/10
now number has the distance between coordinates and I can
do something like this with each label:
Label1.Top = -min - number * 1 '
Label1.Caption = Str(min + number * 1)
.....
'(with each label)
'Here I use -min to start just
'in the bottom of the square, where the min is, and values are
'negative cause thats the way to go up in my form (incresing
'negative values
This is not working, im getting bad coordinates, like i said before.
Any idea about an algorithm to do this???
Thanks!
JCI
Last edited by jcis; Apr 3rd, 2003 at 10:50 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|