Friend Functions

Oct 13, 2009 21:41

When I was young, there was a program on our Macintosh LC computer called “Biorhythm II.” It was filed underneath the Games folder, but it really wasn’t a game by any means. In fact, it was little more than an intellectual curiosity, but for some reason it appealed to me, and I frequently opened up the application. The theory behind it was to ( Read more... )

Leave a comment

kotukawi October 14 2009, 20:21:00 UTC
The procedural generation here is actually pre-generation in the case that our tools are generating the actual content dynamically and creating the actual geometry for the game, not something like Spore where the game is doing it all on the fly. So in this case, having the 100% solution wasn't out of play, even if it was a little trickier to figure out at Tools-runtime what with calculus and all.

The end decision came about in determining the most sensible parameters to expose in order to control the shape of the curve in question. Using the catenary required a "tension"-like parameter (specifically, horizontal tension per unit weight), whereas the parabola parameters included the amount of dip (height difference between the lower pole and the vertex) and to determine if the vertex should be between the poles or outside the poles.

Because the tension could be applied uniformly across a series of power line segments, we chose to go that route instead. Even though the specific effects of the "tension" parameter aren't inherently intuitive to an artist, it is nevertheless quite clear that large values make it less saggy while smaller values make it more saggy, and from there they can play with the parameters to their hearts content.

For curiosity, the equation for the catenary is as follows:

f(x) = [cosh((x - x0) / a) - 1] / a + y0, where (x0, y0) is the to-be-calculated vertex, and a is the "tension" parameter.

Reply


Leave a comment

Up