Author Topic: Graphics Test #3D - are you certifiable?  (Read 2793 times)

0 Members and 1 Guest are viewing this topic.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Graphics Test #3D - are you certifiable?
« on: December 19, 2021, 11:53:34 am »
3D very popular these days, try a cube of cubes:
 
3D render #3 Cube of cubes step 1.PNG

 
3D render #3 Cube of cubes step 2.PNG
« Last Edit: December 21, 2021, 05:29:32 pm by bplus »

Offline _vince

  • Seasoned Forum Regular
  • Posts: 422
    • View Profile
Re: Graphics Test #3 - are you certifiable?
« Reply #1 on: December 21, 2021, 04:54:08 pm »
I'll leave this relic from that gem of a thread.  Can I get a free pass?

Code: QB64: [Select]
  1. dim shared pi, sw, sh
  2. pi = 4*atn(1)
  3. sw = 640
  4. sh = 480
  5.  
  6. rr = 500
  7. h = 1200
  8.  
  9.  
  10.         for t=0 to h step 10
  11.                 cls
  12.                 hyperb rr, t, 0, 0
  13.  
  14.                 _display
  15.                 _limit 100
  16.         next
  17.  
  18.         for b=0 to 0.80*pi/2 step 0.008
  19.                 cls
  20.                 hyperb rr, h, b, 0
  21.  
  22.                 _display
  23.                 _limit 100
  24.         next
  25.  
  26.         _delay 0.5
  27.  
  28.         for rot = 0 to 0.9*pi/2 step 0.01
  29.                 cls
  30.                 hyperb rr, h, 0.80*pi/2, rot
  31.  
  32.                 _display
  33.                 _limit 100
  34.         next
  35.  
  36.         _delay 0.5
  37.  
  38.         for i=0 to 1 step 0.005
  39.                 cls
  40.                 hyperb rr, h, (1 - i)*0.80*pi/2, (1 - i)*0.9*pi/2
  41.  
  42.                 _display
  43.                 _limit 100
  44.         next
  45.  
  46.         for t=0 to h step 10
  47.                 cls
  48.                 hyperb rr, h-t, 0, 0
  49.  
  50.                 _display
  51.                 _limit 100
  52.         next
  53.  
  54. 'radius, height, twist, rotate
  55. sub hyperb (r, h, b, rot)
  56.         a = 0
  57.         x = r*cos(a - b)
  58.         z = r*sin(a - b)
  59.         y = -h/2 + 200
  60.  
  61.         yy = y*cos(rot) - z*sin(rot)
  62.         zz = y*sin(rot) + z*cos(rot)
  63.         y = yy
  64.         z = zz
  65.  
  66.         ox = x
  67.         oz = z
  68.         oy = y
  69.  
  70.  
  71.         x = r*cos(a + b)
  72.         z = r*sin(a + b)
  73.         y = h/2 + 200
  74.  
  75.         yy = y*cos(rot) - z*sin(rot)
  76.         zz = y*sin(rot) + z*cos(rot)
  77.         y = yy
  78.         z = zz
  79.  
  80.         oxx = x
  81.         oyy = y
  82.         ozz = z
  83.  
  84.  
  85.         for a = 2*pi/30 to 2*pi step 2*pi/30
  86.                 x = r*cos(a - b)
  87.                 z = r*sin(a - b)
  88.                 y = -h/2 + 200
  89.  
  90.                 yy = y*cos(rot) - z*sin(rot)
  91.                 zz = y*sin(rot) + z*cos(rot)
  92.                 y = yy
  93.                 z = zz
  94.  
  95.                 pset  (sw/2 + ox*700/(oz + 2500), sh/2 - 50 + oy*700/(oz + 2500))
  96.                 line -(sw/2 +  x*700/( z + 2500), sh/2 - 50 +  y*700/( z + 2500))
  97.  
  98.                 ox = x
  99.                 oy = y
  100.                 oz = z
  101.  
  102.  
  103.                 x = r*cos(a + b)
  104.                 z = r*sin(a + b)
  105.                 y = h/2 + 200
  106.  
  107.                 yy = y*cos(rot) - z*sin(rot)
  108.                 zz = y*sin(rot) + z*cos(rot)
  109.                 y = yy
  110.                 z = zz
  111.  
  112.                 line -(sw/2 +   x*700/(  z + 2500), sh/2 - 50 +   y*700/(  z + 2500))
  113.                 line -(sw/2 + oxx*700/(ozz + 2500), sh/2 - 50 + oyy*700/(ozz + 2500))
  114.  
  115.                 oxx = x
  116.                 oyy = y
  117.                 ozz = z
  118.         next
  119.  

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Graphics Test #3D - are you certifiable?
« Reply #2 on: December 21, 2021, 05:29:18 pm »
Hi @_vince

Yeah! I saved that with a number of your posts, great stuff!

I hope folks don't mind if we drag it out to show again, maybe with a new mod or twist...

Bring your 3d experiments here :)