Author Topic: [Axe] Dynamic 3D functions explorer thingy  (Read 4699 times)

0 Members and 1 Guest are viewing this topic.

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
[Axe] Dynamic 3D functions explorer thingy
« on: November 14, 2013, 01:34:43 pm »
Hey guys,

Seeing the challenge TheMachine02 shamelessly sent me (:P), I wanted to try and do some 3D, but this time without defining any vertex by advance. So this came out.

What it features :
  • 3D graphing of any function that only involves integer maths (8.8 maths are coming, maybe) on the [-6,6] range (13*9 = 117 dots)
  • Dynamic movement around the graphed function : translation, rotation around the Y axis and zooming in/out
  • Dots and grid view
  • Clipped line routine ! :D
  • Support for animated functions. More on that below
  • All of that in less than 2400 bytes of pure Axe !

So yeah, it's not really useful, but I found that it would be cool to try and do such program.

Small precision : the graphed function doesn't give exact results. I mean, there's no such thing as units. The only point of that is making good-looking results on-screen, it's not a mathematics tool.

How to use it : by default, prgmDOTSURF (Noshell executable) will graph the 2x² function. You can move around the graphed function with the arrows, zoom in with + and out with -, rotate left with [Y=] and rotate right with [graph], switch between dots and grid view with [mode] and exit with [clear].

You can also define your own function for the program to graph. To do that, just edit prgmFUNC3D. While I'm speaking about a "function", this is actually Axe code that you'll have to compile. I want to make this into a more user-friendly way, but I still have to figure how. Here're instructions on how you can define your function :
  • The graphed function is f(x,z) = y. X and Z of the current point are passed respectively in r2 and r3, from -6 to 6 and -4 to 4 respectively. You are free to use these, but they must remain the same value at the beginning and the end of your function. They are used for the drawing code. Also, store the resulting Y coordinate into r6. Do not use Return.
  • You cannot edit any of the following variables, meaning that they must have the same value before and after your function : r2, r3, r4, A, B, C, D, E, F, H, V, Y, Z, ?. Also, you can't use any of the bytes from L1 to L1+702, nor the 256 first bytes of L3.
  • If you want to use trig, do not use Axe's sin/cos functions, but type Sin() and Cos() instead. Those are way faster, LUT-based routines that I made. Remember that this will destroy r1, unless you call it with sub(Sin) or sub(Cos) and writing the value right before it. Those functions still returns the same output as Axe's ones. Also, Y holds the current Y rotation angle.
  • You can write animated functions : the O variable is a timer that gets incremented by 16 every frame. You are free to use it.

Remember that grid mode will lag a lot at 6MHz, since the program has to draw a line between each of the 117 dots.

So, I think that's all. For those who don't know Axe but want to try anyway, I give you some functions that you can copy in prgmFUNC3D (that will also be an example for those who want to write their own :) ) :

The default 2x² :
r2*r2*2?r6

One of my favourite functions (also, one that demonstrates well the clipped line routine), the good old x3 :
r2*r2*r2?r6

Some animated sinusoidal function :
Sin(r2*16+O)//4?r6

More animated sinusoidal function to demonstrate the use of both X and Z coordinates to generate Y :
Sin(r2*16+O)+Cos(r3*16+O)//4?r6

Here's a little screenshot that describes the process of drawing 2x² and navigating around the graphed function (at 6MHz of course) :



Don't be horrified by the how-so non-user-friendly interface, I'm working on it :P

prgmFUNC3D is the program you have to edit to write your own function, prgmSINE3D is the source to compile, and prgmDOTSURF is the executable (here, it contains the 2x² default function).

Feel free to make functions, share them with others if you want, and don't hesitate to ask if you have questions :)

Offline TheMachine02

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 452
  • Rating: +105/-0
  • me = EF99+F41A
    • View Profile
Re: [Axe] Dynamic 3D functions explorer thingy
« Reply #1 on: November 14, 2013, 01:46:17 pm »
Just    too    cool   :crazy:
AXE/asm programmer - unleash the power of z80 //C++//C

epic 3D things http://www.ntu.edu.sg/home/ehchua/programming/opengl/CG_BasicsTheory.html

Offline Eiyeron

  • Urist McEiyolobster
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1430
  • Rating: +130/-10
  • (-_(//));
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
Re: [Axe] Dynamic 3D functions explorer thingy
« Reply #2 on: November 14, 2013, 02:30:53 pm »
Idea: Try to collect data from TI variables (like lists or matrices), and parse them for a better experience. I would see a Basic routine that would make the data and the Axe one to show them!

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Axe] Dynamic 3D functions explorer thingy
« Reply #3 on: November 14, 2013, 02:38:58 pm »
Eiyeron not possible, because you can put everything Axe knows in prgmFUNC3D, since it's a part of the program. There is no data.

What I planned is a custom input routine that will parse the entry while the user is entering it. I think it's the most user-friendly way to do it.
« Last Edit: November 14, 2013, 02:40:13 pm by Matrefeytontias »

Offline Eiyeron

  • Urist McEiyolobster
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1430
  • Rating: +130/-10
  • (-_(//));
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
Re: [Axe] Dynamic 3D functions explorer thingy
« Reply #4 on: November 14, 2013, 02:40:28 pm »
Yes, but IF you manage to parse the data in a variable, you could avoid stocking pretederminated functions/results and rcompiling for each function!

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Axe] Dynamic 3D functions explorer thingy
« Reply #5 on: November 14, 2013, 02:49:59 pm »
Why are you talking about data ? There is not a single byte of data.

I think you didn't understand. I'm planning to write an input+interpret routine so that the user can input a function to graph by pressing a button when running prgmDOTSURF. prgmFUNC3D will be facultative.

Offline Eiyeron

  • Urist McEiyolobster
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1430
  • Rating: +130/-10
  • (-_(//));
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
Re: [Axe] Dynamic 3D functions explorer thingy
« Reply #6 on: November 14, 2013, 03:05:20 pm »
^That was I thought.

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: [Axe] Dynamic 3D functions explorer thingy
« Reply #7 on: November 14, 2013, 04:09:28 pm »
wha, that is looking awesome O.O

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

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
Re: [Axe] Dynamic 3D functions explorer thingy
« Reply #8 on: November 14, 2013, 10:32:50 pm »
Very good job Matrefeytontias. :) If you switch to 15 MHz projects one day, will Super Mario 64 be next? :trollface:

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: [Axe] Dynamic 3D functions explorer thingy
« Reply #9 on: November 16, 2013, 01:59:04 am »
If you switch to 15 MHz projects one day, will Super Mario 64 be next? :trollface:
I don't think he will ever switch to 15 MHz. Even if he got a 84+, all his classmates would still have 6 MHz calcs. And most of them don't even have 83+ calcs but 82 Stats.fr. This is why he ported JetPack 8x to the 82 Stats.fr I guess.

Anyway, that looks great indeed, nice work.
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

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
Re: [Axe] Dynamic 3D functions explorer thingy
« Reply #10 on: November 16, 2013, 02:02:47 am »
Yeah true lol. I wonder if in a few years his classes will ever switch to newer models, especially now that the 82 Stats.Fr got discontinued? The 83 Plus.Fr that is now sold in stores has 84+ hardware. Or does he live in a very poor area of France? Over here, when I went to hi school until 2003, many people still had TI-80s or the old rectangular TI-82's.

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Axe] Dynamic 3D functions explorer thingy
« Reply #11 on: November 16, 2013, 02:37:11 am »
If you switch to 15 MHz projects one day, will Super Mario 64 be next? :trollface:
I don't think he will ever switch to 15 MHz. Even if he got a 84+, all his classmates would still have 6 MHz calcs. And most of them don't even have 83+ calcs but 82 Stats.fr. This is why he ported JetPack 8x to the 82 Stats.fr I guess.

The part about Jetpack and not switching to 15MHz is true, but it has nothing to do with my classmates. It's just that I think that using Full is a lazy alternative to optimizing, so instead I optimize (see IkarugaX).

DJ_O I don't think TI-82 stats.fr are discontinued ...

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Axe] Dynamic 3D functions explorer thingy
« Reply #12 on: November 16, 2013, 07:04:39 am »
Bump :

Who said it was hard to write an equation parser ? :P

This is 6MHz :



And this is 15MHz :



I don't release anything for now because I want to get number parsing working first.

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: [Axe] Dynamic 3D functions explorer thingy
« Reply #13 on: November 16, 2013, 07:06:40 am »
looking awesome, reminds me of Graph3D :)

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Matrefeytontias

  • Axe roxxor (kinda)
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1982
  • Rating: +310/-12
  • Axe roxxor
    • View Profile
    • RMV Pixel Engineers
Re: [Axe] Dynamic 3D functions explorer thingy
« Reply #14 on: November 16, 2013, 07:08:28 am »
Well, it does the same thing but less good :P