Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

Splines and implementation in engine


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 phayer   Members   -  Reputation: 141

Like
0Likes
Like

Posted 07 July 2012 - 10:13 AM

Hi

So I'm making my own game engine for educational purpose mostly, but also for using to make games.
After reading a couple of books and looking on how to implement animation, networking, and path finding I decided that splines would be nice to have implemented before heading in.

So I've created a couple of examples of splines, but here is my show stopper. How should splines be implemented? Should there be a Spline-class and then have different types of splines inherit it? Should results be cached and re-cached every time a point or detail bias changes?

Generally asking for how other people have done it, and tips for how I can do it.

Sponsor:

#2 Acotoz   Members   -  Reputation: 73

Like
0Likes
Like

Posted 07 July 2012 - 10:16 PM

If I were you I would keep it simple. One class and that's it, specifying the type of spline on the constructor. As far as I know, splines are just a bunch of points, so it shouldn't be that complicated, I think you don't even need something such as "spline type"


But that's just me.

#3 h4tt3n   Members   -  Reputation: 560

Like
0Likes
Like

Posted 07 July 2012 - 11:31 PM

I agree, keep it simple and don't worry too much about wether one implemention might be better than another. Too much of this and you'll never get anything done.

#4 Hodgman   Moderators   -  Reputation: 13534

Like
1Likes
Like

Posted 08 July 2012 - 12:23 AM

So I've created a couple of examples of splines, but here is my show stopper. How should splines be implemented? Should there be a Spline-class and then have different types of splines inherit it? Should results be cached and re-cached every time a point or detail bias changes?

That entirely depends on the problem you're trying to solve.
A bunch of free-functions (not class members), which can evaluate different spline formulas, plus a Point structure to be used as inputs into those functions, is probably all you need.

#5 phayer   Members   -  Reputation: 141

Like
0Likes
Like

Posted 08 July 2012 - 06:04 AM

If I were you I would keep it simple. One class and that's it, specifying the type of spline on the constructor. As far as I know, splines are just a bunch of points, so it shouldn't be that complicated, I think you don't even need something such as "spline type"


But that's just me.


Well, this lead to a switch(this->m_iType)... So I went with a namespace for splines inside my math namespace. Just a bunch of free functions.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS