Sign in to follow this  
  • entries
    570
  • comments
    2427
  • views
    216045

Untitled

Sign in to follow this  
Mushu

43 views

Please kill me. Please... [headshake]

I think I'm done with this parser nonsense. Variables were pie to fix. Then I started adding in the stuff for unary operaters (basically, trig functions, inverse trig functions and log).

So I do a test.

INPUT: cos0
OUTPUT: 1


And I suddenly feel really really happy because omg it was working!

And how wrong I was. If we illustrate this with a picture of a tree...



This isn't what we want - the value of cos is being calculated based on the default value (0), not on the actual input. ARRGH! This took me some brain bashing to fix. For reference, we want it too look like this -



The actual solution doesn't look like that though, but it almost does. Almost. Its a little messier [headshake]



Well, I guess it doesn't make that much of a difference. It looks pretty messy in code though:
void apply( unsigned int op, IEvalable< T, V >* expr ) {
if ( op == OP_SIN ||
op == OP_COS ||
op == OP_TAN ||
op == OP_LOG ||
op == OP_ASIN ||
op == OP_ACOS ||
op == OP_ATAN ) {

splice< OP_ADD >( expr );
append( op );
}
else {
splice( op, expr );
}
}

But yeah. Hopefully there are no big oversights. There are still some bugs, like OP_LOG doesn't work for shit. But I don't care at this point.

Tommorrow I'm going to write some rendering functions and we can start rendering single-variable graphs. Then after that I'll implement an OGL renderer and we can play with MULTIVARIABLE GRAPHS :D :D

And then I'm throwing this project into the fucking portfolio. Because that's the only reason I chose to do it... grr. Bad idea.
Sign in to follow this  


2 Comments


Recommended Comments

HAHAHAHAHAHAHAHA

oh man that is like a mirror image of parts of our old scripting engine, the bugs were rampant, better test well, eesh. =)

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now