• Print

Author Topic: 3d graphing  (Read 147 times)

23452

  • Jr. Member
  • **
  • Posts: 72
    • Email
3d graphing
« on: December 24, 2012, 04:40:04 PM »
 Does anyone know how to effectively graph in 3d ??? I have an idea using ray casting, but it seems like a really round about way to do it.

Dark Star

  • Hero Member
  • *****
  • Posts: 532
Re: 3d graphing
« Reply #1 on: December 24, 2012, 04:54:27 PM »
Can you explain a little more about what you mean by graphing?  If you're just serving up coordinates, you only need (X,Y,Z) where (0,0,0) is the center of a cube.  For that I would use 3 signed _INTEGER64's.

23452

  • Jr. Member
  • **
  • Posts: 72
    • Email
Re: 3d graphing
« Reply #2 on: December 24, 2012, 05:05:52 PM »
display might be a better word.
I have the starting point, the angles that it is getting wider/taller by, and a lot of x,y and z's.

LeChuck

  • Hero Member
  • *****
  • Posts: 895
  • 18 * 37
Re: 3d graphing
« Reply #3 on: December 25, 2012, 11:56:11 AM »
Hey 23452,

I suggest you take some code of one of the guides and try to work with that.

http://www.petesqbsite.com/sections/tutorials/tutorials/tutor2.htm

http://petesqbsite.com/sections/tutorials/zines/qbtimes/2-3d.html
Code: [Select]
'http:// Ajust this value to load larger models or save memory
CONST numberOfPoints = 100
'http:// Ajust this value to zoom in or out on the object
CONST zoomLevel = 0

TYPE ThreeDeePoint
X AS SINGLE
Y AS SINGLE
Z AS SINGLE
END TYPE

'http:// Set up an array of 3D points
DIM MyArray(1 TO numberOfPoints) AS ThreeDeePoint

'http:// Load a model into the array


'http:// Draw all the points
FOR pointIdx = 1 TO numberOfPoints
'http:// Do not draw points that are behind the screen
IF MyArray(pointIdx).Z + zoomLevel > 0 THEN
'http:// Translate points
flatX = MyArray(pointIdx).X * 256 / (MyArray(pointIdx).Z + zoomLevel)
flatY = MyArray(pointIdx).Y * 256 / (MyArray(pointIdx).Z + zoomLevel)
'http:// Plot a white dot at the point's translated coordinates
PSET (flatX, flatX), 15
END IF
NEXT

Check 3d gfx: http://petesqbsite.com/sections/tutorials/graphics.shtml#5
Two or more, use a FOR!

23452

  • Jr. Member
  • **
  • Posts: 72
    • Email
Re: 3d graphing
« Reply #4 on: December 25, 2012, 03:36:01 PM »
Thinks so much for the links they made my life so much easier. ;D
 

  • Print