Author Topic: 3-D Cube Rotating  (Read 5742 times)

0 Members and 1 Guest are viewing this topic.

Offline bfr

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 819
  • Rating: +4/-0
    • View Profile
    • bfr's website
3-D Cube Rotating
« on: October 12, 2006, 10:08:00 am »
If you thought the 3-D environment was cool, I made a program that lets the user rotate a 3-D cube vertically and horizontally, all in pure TI-BASIC (which required a lot of mathematics).  B)cool.gif

Here's a screenshot of it running on a regular TI-83+ (and note that it is unoptimized):

user posted image

I'll try to get a download link up soon.


Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
3-D Cube Rotating
« Reply #1 on: October 13, 2006, 12:57:00 am »
hmm i wonder if this could be used in a isometric game with rotating map/camera? not in basic tho but prbly in C

CureDesu

  • Guest
3-D Cube Rotating
« Reply #2 on: October 14, 2006, 02:08:00 am »
 O_Oshocked2.gif That must have taken a LOT of math knowledge.

Offline bfr

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 819
  • Rating: +4/-0
    • View Profile
    • bfr's website
3-D Cube Rotating
« Reply #3 on: October 14, 2006, 02:30:00 am »
Yeah, it involved quite a bit of mathematics.    

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
3-D Cube Rotating
« Reply #4 on: October 14, 2006, 02:36:00 am »
could you post the formula/code?

Offline bfr

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 819
  • Rating: +4/-0
    • View Profile
    • bfr's website
3-D Cube Rotating
« Reply #5 on: October 14, 2006, 03:33:00 am »
Here is the source code that SourceCoder genereated (and remeber, it's unoptimized):

QuoteBegin-"Basic Code"+-->
QUOTE ("Basic Code")
::
:1→Xmin
:95→Xmax
:1→Ymin
:63→YMax
:Radian
:40,40,60,40,60,20,40,20,40,40,60,40,60,20,40,20→L1
:(√(800)π)→A
:(7/8)A,A/8,A/8,A/8,A/8,(7/8)A,(7/8)A,(7/8)A,(5/8)A,(3/8)A,(3/8)A,(3/8)A,(3/8)A,(5/8)A,(5/8)A,(5/8)A→L2
:(2π)/(π√(800))→R
:√(800)/2→Q
:Lbl R
:ClrDraw
:iPart(Q(sin(RL2))+40→L1
:For(A,1,5,2
:Line(L1(A),L1(A+1),L1(A+2),L1(A+3)
:End
:Line(L1(7),L1(8),L1(1),L1(2)
:For(A,9,13,2
:Line(L1(A),L1(A+1),L1(A+2),L1(A+3)
:End
:Line(L1(15),L1(16),L1(9),L1(10)
:For(A,1,7,2
:Line(L1(A),L1(A+1),L1(A+8),L1(A+9)
:End
:Repeat G
:getKey→G
:End
:If G=26
:Then
:For(A,1,15,2
:L2(A)+1→L2(A)
:End
:End
:If G=24
:Then
:For(A,1,15,2
:L2(A)-1→L2(A)
:End
:End
:If G=25
:Then
:For(A,2,16,2
:L2(A)+1→L2(A)
:End
:End
:If G=34
:Then
:For(A,2,16,2
:L2(A)-1→L2(A)
:End
:End
:Goto R
Generated by http://www.cemetech.net/projects/basicelite/sourcecoder.php,

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
3-D Cube Rotating
« Reply #6 on: October 14, 2006, 03:35:00 am »
it just ask me to open a file o.oblink.gif

Offline bfr

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 819
  • Rating: +4/-0
    • View Profile
    • bfr's website
3-D Cube Rotating
« Reply #7 on: October 14, 2006, 03:39:00 am »
I fixed my post :)smile.gif

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
3-D Cube Rotating
« Reply #8 on: October 14, 2006, 03:47:00 am »
square roots and all *gasp* x.x hopefully maybe one day I'll get the hang of it O_Oshocked2.gif

sound cool tho  

Offline bfr

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 819
  • Rating: +4/-0
    • View Profile
    • bfr's website
3-D Cube Rotating
« Reply #9 on: October 14, 2006, 05:22:00 am »
Yeah.  There's this one line of code that is really important, and determines the coordinates of the points in terms of radian angles:

c1-->
CODE
ec1:iPart(Q(sin(RL2))+40→L1c2
ec2

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
3-D Cube Rotating
« Reply #10 on: October 14, 2006, 05:26:00 am »
hmm I c, I should try to study some 3d stuff a bit more in case i decided to do some 3d prog in the future on PC or if I ever learned a language faster than TI-BASIC

Offline Radical Pi

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1143
  • Rating: +5/-2
    • View Profile
    • RealityRevolution
3-D Cube Rotating
« Reply #11 on: October 14, 2006, 08:36:00 am »
Basic can get so complicated...

I'm not impressed by the video or that it constantly redraws, but the mere fact that you did it in Basic is lolzomgwtfzorsinmypants. And like you said, it can probably get alot faster.
Good job.
One of these days I'll get a sig I'm really proud of.

Offline JincS

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 191
  • Rating: +0/-0
    • View Profile
3-D Cube Rotating
« Reply #12 on: October 14, 2006, 11:15:00 am »
Looks pretty cool! Kudos.

I have a n00b question: I know when programming in C/C++, you can write screen data to a buffer before you send it to the screen, which increases frame rate and reduces flicker. Is there a way to do that in BASIC?

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
3-D Cube Rotating
« Reply #13 on: October 14, 2006, 11:21:00 am »
in pure basic, no. WIth xLIB commands you can choose to send it immediately or just save it to graph buffer. It's cool cuz then I ended up being able to make a DDR clone with animated background with arrows moving up