Sign in to follow this  
Tree Penguin

Volume of a parabole function with 3 axis? (4-dimensional volume)

Recommended Posts

Hi, I'm trying to figure out the formula for calculating the volume of part of a 3-axis parabole, with different lengths on each axis, but starting on (0,0,0). My maths isn't that strong (especially terminology), so I have no idea what to google for, and please forgive me if I'm sounding like a noob, because I am ;). Anyway, what I have been able to figure out are the calculations for the volume of the parabole when I use the same maximum value (m) for each axis: 1 axis: (m*m)/3 * m 2 axes: (m*m)/3 * m * (2*m) 3 axes: (m*m)/3 * m * (2*m) * (1.5*m) or simply m^5... Any ideas on how to make different maximum values for x, y and z possible? By the way: the formula for the parabole is simply x*x, (x*x+y*y), (x*x+y*y+z*z). An example of what I'd like to do: The volume of the graph (4-dimensional) in range (0,0,0) to (12,7,31) where w = (x*x+y*y+z*z). Brute-forcing this answer seems to give a value somewhere above 1,000,000. Thanks! [Edited by - Tree Penguin on August 14, 2009 6:33:19 AM]

Share this post


Link to post
Share on other sites
Right, I had a collegue of mine crack this down, and he did it :] . The code is below for anyone who might need it for any reason.


inline float fabc(float a, float b, float c)
{
return (a*a*a * b * c + a * b*b*b * c + a * b * c*c*c)/3.0f;
}

float fXXYYZZ(float x1, float x2, float y1, float y2, float z1, float z2)
{
return ((fabc(x2,y2,z2) - fabc(x1,y2,z2)) - (fabc(x2,y1,z2) - fabc(x1,y1,z2))) -
((fabc(x2,y2,z1) - fabc(x1,y2,z1)) - (fabc(x2,y1,z1) - fabc(x1,y1,z1)));
}




Where (x1, y1, z1) to (x2, y2, z2) is a box in the 3d coordinate space of the graph.

EDIT: forgot some parenthesis.

[Edited by - Tree Penguin on August 14, 2009 10:43:53 AM]

Share this post


Link to post
Share on other sites

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

Sign in to follow this