coupla more questions if you guys don't mind...... thanks

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
smudge
Newbie
Posts: 9
Joined: Sun Jun 08, 2008 9:28 pm

coupla more questions if you guys don't mind...... thanks

Post by smudge »

I have a few things figured out now...just having trouble with these questions... ANY help you can provide is greatly appreciated. thanks liz


1) The statements: 100 VIEW (0,0) ? (100,100)
110 WINDOW (100,100) ? (150,150) would associate the physical coordinates (100,100) with the world coordinates ANSWER (150,100) - WHY??????

2) A viewport has been created whose corners are at 920,10), (16,10) (60,50) and (20,50). The statement that assigns the world coordinates (1,0) to the lower left corner and (10,100) to the upper right corners is ? ANSWER: WINDOW (1,0) ? (10,100)???

What is the difference between world and physical coordinates?


100 SCREEN 1,0 : CLS : KEY OFF : COLOR 1,0
120 DIM ARRAY .OF. PIXELS (114)
130 LINE (0,0) ? (40,40), 3, BF
140 GET (1,)) ? (40,40), ARRAY .OF. PIXELS

3) The instruction in line 130 will draw a A FILLED RECTANGLE 41 PIXELS WIDE AND 11 PIXELS HIGH ? WHY?????

4) The instruction in line 140 WILL STORE THE PIXELS OF THE RECTANGLE IN AN ARRAY ? WHY???

5) If the following lines were added: (TO ABOVE STATEMENT):

150 PUT (0,0), ARRAY OF PIXELS
160 PUT (10,10) ARRAY OF PIXELS

The program would MOVE THE SAME RECTANGLE DOWN AND TO THE RIGHT ? WHY??????

6) To draw a semicircle of radius 10 with coordinate (60,60) as the center, you would use the statements 110 CF = 2 * PI/360 ? ANSWER - 120 CIRCLE (60,60),10,CF*180,CF*360 WHY?


7) 20 CLS: KEY OFF
30 COLOR 1,0
40 LINE (20,20) ? (40,40) B
50 CIRCLE (30,30),1,3
60 PAINT (32,32),1,3
70 PAINT (22,22),2,3


8) Line 50 would draw a circle with a ANSWER: 5 PIXEL RADIUS INSIDE OF THE BOX ??
WHY IS THIS CIRCLE ONLY 5 PIXELS? WHERE DID THIS FIGURE COME FROM????

any help you can give me would be great. thanks liz
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

The viewable area is the world and the object may go beyond that area.

If the window area is smaller than the total object, portions will be out of view. Try expanding the view area to see more of an object.

Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
smudge
Newbie
Posts: 9
Joined: Sun Jun 08, 2008 9:28 pm

Post by smudge »

thanks so much burger! i really appreciate the help.

Why is the circle drawn only 5 pixels? - thanks liz
MystikShadows
Veteran
Posts: 703
Joined: Sun Nov 14, 2004 7:36 am
Contact:

Post by MystikShadows »

Because the last parameter of the CIRCLE statement here is 3 which means a radius of 3 pixels starting from the middle pixel gives a diameter of 5 pixels.
When God created light, so too was born, the first Shadow!

MystikShadows

Need hosting? http://www.jc-hosting.net

Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

As to the number of pixel counts, write the series 0 to 10. You can then count the numbers and you end up with 11.

In your mind, you try to subtract 0 from 10 and get 10. Always add 1 if you use subtraction first. Just like QB code (whatever that is) would do it.

boxpixels = (40 - 0) + 1 returns the actual number of pixels from 0 to 40.

Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
smudge
Newbie
Posts: 9
Joined: Sun Jun 08, 2008 9:28 pm

Post by smudge »

thanks so much guys!!!!!! you are really helpful.

-liz
Post Reply