#1
|
|||
|
|||
Programming Question
anybody out there know how to write the equation for a vector that will represent a spherical volume of radius r with center point at (x, y, z) ???
thanks... |
#2
|
|||
|
|||
Re: Programming Question
huh?
|
#3
|
|||
|
|||
Re: Programming Question
[ QUOTE ]
huh? [/ QUOTE ] |
#4
|
|||
|
|||
Re: Programming Question
[ QUOTE ]
anybody out there know how to write the equation for a vector that will represent a spherical volume of radius r with center point at (x, y, z) ??? [/ QUOTE ] f(x)=xE(3y/z^x)sub3(sin(z^y) If that doesn't work, let me know. |
#5
|
|||
|
|||
Re: Programming Question
(4/3) (pi) r^3 like i said i'm drunk please ignore that.
i'm drunk but i think that's what you want? |
#6
|
|||
|
|||
Re: Programming Question
sorry, im kinda a novice script writer...this is for a 3d application that will basically fill a sphere volume with particles based on a fractal...in order for the fractal to keep within the sphere i have to limit it...
i have to do this with different shapes in 3d space... here is the box equation - vector $p = 1 * (rand(<<($cubeX - ($cubeWidth / 2)),($cubeY - ($cubeHeight / 2)), ($cubeZ - ($cubeWidth / 2))>>, <<($cubeX + ($cubeWidth / 2)),($cubeY + ($cubeHeight / 2)), ($cubeZ + ($cubeWidth / 2))>>); basically the $cubeX/Y/Z are user defined to represent the center of the box while height is height and width is width... could you explain your equation? thanks |
#7
|
|||
|
|||
Re: Programming Question
i have no idea how to do what you're asking. the equation was completely fake.
|
#8
|
|||
|
|||
Re: Programming Question
what language is that? What exactly are your inputs and outputs here? Are you looking for a function that will generate points randomly distributed inside a sphere?
|
#9
|
|||
|
|||
Re: Programming Question
the language is MEL (maya embedded language) its for a 3d application called Maya, its similar to C...
i have a fractal function that will sample different points within space and if the fractal returns a value within a certain threshhold it will create a particle (a dot) at that point, if it is outside the thres it will move to another point without creating anything... vector $p = 1 * (rand(<<($cubeX - ($cubeWidth / 2)),($cubeY - ($cubeHeight / 2)), ($cubeZ - ($cubeWidth / 2))>>, <<($cubeX + ($cubeWidth / 2)),($cubeY + ($cubeHeight / 2)), ($cubeZ + ($cubeWidth / 2))>>); this takes a random point along a vector...this vector is for a box shape, the first point along the vector is denoted as <<x, y, z>> and the second is <<x1, y1, z1>> meh...does this make any sense or too hard to do over the internet? |
#10
|
|||
|
|||
Re: Programming Question
Ok now I think I understand what you are asking. I don't know the application specific stuff, but here is the math stuff.
If the center is x0,y0,z0 and the radius r, for any point x,y,z to be inside the sphere, the following equation must be true: sqrt((x - x0)^2 + (y - y0)^2 + (z - z0)^2) < r |
|
|