X,Y coordinate arrays
Author Message
X,Y coordinate arrays

Hello I'm a new member here. I'm an Art student in the Netherlands.
Started with QBASIC something like a month ago. I'm woking on a
project to print computer generated designs for correspondence paper.
It is real big fun but also pretty difficult once in a while (Now at
this moment, for example).

OK this is what I got.

I have all my generated text blocks.

But I want to:

- give X,Y coordinates to each character of text block A
- give X,Y coordinates to each character of text block B
(this part I have already almost fixed)

put the X,Y coordinates of blok A & B together. Sort them. So the
coordinates will be ordered from row 1 (Y coord) and colum 1(X coord)
to row 100 to column 50.
(Uuuuuuuuuhhhmmmmmmmmm...?)

Than the sorted  X,Y values have to  one by one send to the LOCATE
(LOCATE Y%, X%) function.
And then be LPRINTED.
(That's easy. Also got that one. Something like this:
A loop as big as all the characters with LOCATE Y%, X%; LPRINT
A&Bcombined\$
next i..... bla bla)

So the difficult part for me is put the A & B text blocks together.

Do I have to use array's (DIM). One or Two Dimensional or even three
A(1,1,A)???????

You see, I have kind of lost it here at this point. I hope somebody
can give me some clues.

Thanks and everyone BEST WISHES!!

Marco

Mon, 21 Jun 2004 00:28:30 GMT
X,Y coordinate arrays

Note: Use cross-posting (=sending _one_ message to _multiple_ newsgroups)
next time.

Quote:
> Hello I'm a new member here. I'm an Art student in the Netherlands.
> Started with QBASIC something like a month ago. I'm woking on a

Mon, 21 Jun 2004 04:51:20 GMT
X,Y coordinate arrays
I think you want to sort the coordinate pairs by their Y coordinate and then
sort all points with the same Y coordinate by their X coordinates.

Each block can be separate since each block will have greater or lessor Y
coordinates than any other block. In other words if the order of the blocks
is known then there is less sorting to do.

Mon, 21 Jun 2004 06:18:25 GMT
X,Y coordinate arrays
Hi there,

Thanks for the replies on my earlier question. It helped a lot.
As you can see below.
The "XY Coord DIM" workes fine now.

However!!!!!!! Only with small INDEXES like 30 (=900 char)
Now I want to print a whole sheet of paper with all the characters
in the "XY Coord DIM".  Thats about 9000 characters.

BUT when I made DIM  textlist(80, 80).  (= 6400 char)
instead of textlist(30, 30)  it said "OUT OF RANGE" or
"OUT OF STRINGSPACE"

I tried to make subroutines (See code below) but that didn't help.

I thought.... Quote;"Valid index values range from -32,768 to 32,767."
SO how can I make the array smaller.!
I mean what's the problem there anyway!

:-(

Thanks
Marco

CLS
' NOTE: There are ONLY TWO TEXTBLOCKS NR 2, NR 3!!!

'--------------------DATA-----------------------------------------
tekst2\$ = "Aufwiedersehen"
'Text two
tekst3\$ = "ALOHAAA"
'Text three

DIM SHARED textlist(1 TO 81, 1 TO 81) AS STRING         ' init 2D
array textlist

yy% = 0                                ' y variable in "leegtevullen"
subroutine
yyy% = 0                              ' y variable in "printlist"
subroutine

xtekst2% = 15                        ' starting X coord of text two
ytekst2% = 2                         ' starting Y coord of text two
kolomlengte2% = 6                  ' the width of the text block
(>6...= return)

xtekst3% = 3                          ' starting X coord of text three
ytekst3% = 1                          ' starting Y coord of text three
kolomlengte3% = 5                   ' the width of the text block
(>5...= return)

uu% = 0                               ' variable used in subroutine
"vultext2" for MID\$....
udrie% = 0                            ' variable used in subroutine
"vultext3" for MID\$....

'---------------------METHODS----------------------------------

FOR k% = 0 TO 6399                 ' Giving all the X,Y coord a "."
character
???GOSUB leegtevullen
NEXT k%

tekst2: 'Locating the X,Y coor of text two +
FOR x2% = 1 TO 80 ' giving the X,Y the right char of text
two
????????GOSUB vultext2 ' see subroutine "vultext2"
NEXT x2%

tekst3: ' Same for text three as text two
FOR xdrie% = 1 TO 80
????????GOSUB vultext3
NEXT xdrie%

FOR i% = 1 TO 6399 'Put all the all the values of textlist
???????GOSUB printlist ' together and print them in a \$
variable
NEXT i% ' called "totaaltext\$"
PRINT totaaltext\$;
END
'----------------------SUBROUTINES-----------------
leegtevullen:
????????yy% = yy%
????????xx% = xx% + 1
????????m = k% MOD 80
????????IF m = 0 THEN
????????xx% = 1
????????yy% = yy% + 1
????????END IF
???????'**************HERE IT SAYS "OUT OF**************
?textlist(yy%, xx%) = "."          '****** STRINGSPACE"*********

RETURN

vultext2:
teller2% = x2% + (kolomlengte2% - 1)
B = teller2% MOD kolomlengte2%
IF B = 0 THEN
xtekst2new% = xtekst2%
ytekst2new% = (ytekst2% + (teller2% / kolomlengte2%)) - 1
ELSE
xtekst2new% = xtekst2new% + 1
ytekst2new% = ytekst2new%
END IF
uu% = (uu% + 1)
textlist(ytekst2new%, xtekst2new%) = MID\$(tekst2\$, uu%, 1)
RETURN

vultext3:
tellerdrie% = xdrie% + (kolomlengte3% - 1)
bb = tellerdrie% MOD kolomlengte3%
IF bb = 0 THEN
xtekst3new% = xtekst3%
ytekst3new% = (ytekst3% + (tellerdrie% / kolomlengte3%)) - 1
ELSE
xtekst3new% = xtekst3new% + 1
ytekst3new% = ytekst3new%
END IF
udrie% = (udrie% + 1)
textlist(ytekst3new%, xtekst3new%) = MID\$(tekst3\$, udrie%, 1)
RETURN

printlist:
yyy% = yyy%
xxx% = xxx% + 1
n = i% MOD 80
IF n = 0 THEN
xxx% = 1
yyy% = yyy% + 1
END IF
totaaltext\$ = totaaltext\$ + textlist(yyy%, xxx%)
RETURN

Thu, 24 Jun 2004 03:35:33 GMT

 Page 1 of 1 [ 4 post ]

Relevant Pages