Quadrics, by any other name…
Posted: November 23, 2011 Filed under: Uncategorized 1 CommentWhy do we have to have funny names for standard things? The Quadrics, you know; cone(cylinder), ellipsoid (sphere), paraboloid, hyperboloid, and disk.
These are pretty cool math constructs. One thing is they are all BiParametric. That means that they can all be rendered using the same basic BiParametric object. The only thing you need to do is supply the correct parametric equation. For example, for the paraboloid, the code looks like this:
function shape_paraboloid.GetVertex(self, u, w)
local phi = u * self.PhiMax
local z = w*(self.ZMax-self.ZMin)
local r = self.RadiusMax * math.sqrt(z/self.ZMax)
local x = r * math.cos(phi)
local y = r * math.sin(phi)
return {x,y,z}
end
That’s it. You can pull such code straight out a text book, plug it in, and suddenly you’ve got nifty things going on.
In the case of the cone, paraboloid, and hyperboloid, we need to be able to close their ends, using a disk. Luckily, we have the disk object, so the’s not a problem. The disk is kind of interesting. You can specify an inner radius, and get what’s known as a anulus.
So, a good time was had by all, and the number of core objects in the library is multiplying like rabbits.
I would like to see what can be done with that RubberSheet object though. And if I had CSG operations, I’d just pee my pants I think.
There are just so many ways to learn math! Appreciate the post.