Qbasicnews.com
July 03, 2020, 08:04:51 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Realy need help with 3D rotation...  (Read 2598 times)
Yosuke_
Member
*
Posts: 29


« on: October 22, 2004, 11:30:09 AM »

Hi!
Well I read the 3D tutorial and I only understand how to zoom line etc... But I don't understand the 3D rotation!!! Can you please show me an example code that is as much simple as posible without any data 1,1,1,1 stuff that will rotate one line?  I know that I ask too much, but I realy need to understand it. I wan't to make simple 3D game soo much!!! Please! I realy don't get the rotation! Please help me!!! Thank you!!!  :cry:
Logged
Radical Raccoon
I hold this place together
*****
Posts: 914



WWW
« Reply #1 on: October 22, 2004, 04:02:24 PM »

Quote from: "Yosuke_"
Hi!
Well I read the 3D tutorial and I only understand how to zoom line etc... But I don't understand the 3D rotation!!! Can you please show me an example code that is as much simple as posible without any data 1,1,1,1 stuff that will rotate one line?  I know that I ask too much, but I realy need to understand it. I wan't to make simple 3D game soo much!!! Please! I realy don't get the rotation! Please help me!!! Thank you!!!  :cry:


One way is to be calm and patient. The knowledge you seek will come in time.

I just copy code for rotations out of books. I think I understand them :Huh:
I made alot of 3D programs long ago without knowing this stuff. You just need to know what they do, and you can working on understanding them later while you use them. Smiley
Logged

Meg
Ancient QBer
****
Posts: 483


« Reply #2 on: October 22, 2004, 04:13:25 PM »

Yosuke, do you have a solid understanding of trigonomoetry?  This will help greatly in doing rotations.
Logged
Yosuke_
Member
*
Posts: 29


« Reply #3 on: October 22, 2004, 04:24:21 PM »

Quote from: "Meg"
Yosuke, do you have a solid understanding of trigonomoetry?  This will help greatly in doing rotations.

I dont think so! Sad
I found an example how to rotate pixel, but its very hard to understand how pixel is rotating, and I can't find it anymore!!! I need a rotating line, then I can read the source and figure out everything how it works!! Can you please help me! I don't have much time, I am very busy! Can you please give me an example source!!? Thats all I am asking!! Please!!!
Logged
Meg
Ancient QBer
****
Posts: 483


« Reply #4 on: October 22, 2004, 05:45:52 PM »

To write 3D rotation programs, it is important that you first understand basic trig and then 2D rotations.  I'd start there.

Here's a bit of code I wrote which I lifted off the programming help forum and edited a bit.  It spins one circle around the center of the screen.

Code:
SCREEN 12                'graphics mode: 640x480
CLS                      'clear the screen

radius.center% = 100     'how far from the center the circle spins

DO

'cycle through the 360 degrees of angles
FOR degree.angle% = 0 TO 359

     'convert angle from degrees to radians
     radian.angle! = degree.angle% * (3.14159# / 180)

     'calculate coordinates of circle
     circle.x% = 320 + radius.center% * SIN(radian.angle!)
     circle.y% = 240 - radius.center% * COS(radian.angle!)

     'draw the circle
     CIRCLE (circle.x%, circle.y%), 10, 15

     'pause a moment
     FOR t& = 1 TO 10000: NEXT t&

     'erase the circle
     CIRCLE (circle.x%, circle.y%), 10, 0

NEXT degree.angle%

'quit program when a key is hit
LOOP UNTIL INKEY$ <> ""

SYSTEM


similarly, you can draw a circle using points:

Code:
SCREEN 12                'graphics mode: 640x480
CLS                      'clear the screen

radius.center% = 100     'radius of the circle

'cycle through the 360 degrees of angles.  360 degrees = a full circle.
FOR degree.angle! = 0 TO 359 STEP .05

     'convert angle from degrees to radians.  why?
     'because SIN() and COS() only accept angles in radians
     'note: 2*pi radians = 360 degrees, so ratio is pi/180

     radian.angle! = degree.angle! * (3.14159# / 180)

     'calculate coordinates of the point
     'note: (320, 240) is the center of the screen
     'y value get subtracted because we're used to larger y values being
     'at the top of an X-Y graph.  but on the screen, larger y values are at
     'the bottom of the screen.

     point.x% = 320 + radius.center% * SIN(radian.angle!)
     point.y% = 240 - radius.center% * COS(radian.angle!)

     'draw the point (white)
     PSET (point.x%, point.y%), 15

NEXT degree.angle!

SYSTEM


There, the comments in that one are better.

*peace*

Meg.
Logged
Yosuke_
Member
*
Posts: 29


« Reply #5 on: October 23, 2004, 05:19:25 AM »

Thank you very much!!! I will try that out!!! Thank you!!! Smiley
Logged
Yosuke_
Member
*
Posts: 29


« Reply #6 on: October 23, 2004, 06:03:22 AM »

It looks like 2D rotation! As far as I know 3D rotation has x,y,z and xrotated, yrotated, zrotated. Can you please give me a example how to 3D rotate a line!!! Thank you!
Logged
citpes
Guru
**
Posts: 254


« Reply #7 on: October 23, 2004, 10:50:31 AM »

if you go to the main page of this site, you'll see some articles written by RelSoft.  he's pretty much explained what you want there and in great detail.  check it! Cheesy
Logged
Yosuke_
Member
*
Posts: 29


« Reply #8 on: October 23, 2004, 12:20:39 PM »

Woohoo!!!
About 2 hours I try'd to understand how it works and now I do!!! Thank you!
Logged
citpes
Guru
**
Posts: 254


« Reply #9 on: October 23, 2004, 05:41:13 PM »

Thats cool!  Well done man.  Rel's done some pretty amazing stuff in QB!  Those tuts are kickass.

PS Rel, im thinking of doing some more qb stuff (with RelLib of course :lol: ), i think i saw the latest ver of the lib was in like 5 point something!  Iv  only got 3.6!!  When i get some more time online i check out your site though.
Logged
relsoft
*/-\*
*****
Posts: 3927



WWW
« Reply #10 on: October 25, 2004, 04:41:32 AM »

Cool!!! Waiting for it. :*)  I'm also adding some stuff on rellib mostly bugfixes and gfx efx.


Yosuke:

http://www.petesqbsite.com/sections/express/issue2/index.html#3d

read from chap 1 to 5 in that order. :*)
Logged

y smiley is 24 bit.


Genso's Junkyard:
http://rel.betterwebber.com/
Pieslice Productions
Member
*
Posts: 47


« Reply #11 on: November 11, 2004, 07:05:26 PM »

2d rotation is same as 3d rotation around z axis while the z axis is considered as a normal of the screen plane...
Logged

ll formed pragma
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!