🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

How to implement a function graph in C++ based on a function?

Started by
3 comments, last by dgi 6 years, 1 month ago

I am trying to build a particle system for unity based on "Destiny particle architecture " released in Siggraph.

I encounter a problem in trying to understand how they iterated this:

p1.jpg.d799ec7fc47d54d271250b1eac52172f.jpg

p2.jpg.1fc9f23a25d5dacec77f673e42e0d33a.jpgConverted to spline function and the result is

p3.jpg.36156dcca7334e6848c420e3bc4e14dd.jpg

i wanted to know how did they converted the function in the editor to represent the graph ??

 

Advertisement

You mean Google "approximating points by a spline" ?

Gives me https://www.encyclopediaofmath.org/index.php/Spline_approximation

and http://folk.uio.no/in329/nchap5.pdf

as first two hits.

I think you have some confusion - the 3rd image you have here is *not* the result of converting the textual expression from the 1st image into a spline.

Hey

If you ask how they managed to draw the thing in the text editor :

You need an expression parser , its like parsing math expression in any general purpose language compiler. I suggest you read about lexers and parsers. And ones you have the Expression tree or so called (AST) you give values to these variables like (game_time and random)  and you generate points on the "Y" axis . And you connect those points . And for the spline there is basically a few types of splines so everything is in normal code with variables there is no parsing and of course the rendering is the same you generate a lot of points to make it look like a curve and not "boxy" looking.

 

But if you ask how they took this text and draw a graph from it ... yea you have to parse it to expression tree.

Search for parser generators.

 

dgi

This topic is closed to new replies.

Advertisement