Two Plus Two Older Archives  

Go Back   Two Plus Two Older Archives > 2+2 Communities > Other Other Topics
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-15-2005, 01:04 AM
thirddan thirddan is offline
Senior Member
 
Join Date: Nov 2003
Location: San Francisco CA
Posts: 849
Default 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...
Reply With Quote
  #2  
Old 04-15-2005, 01:08 AM
The Goober The Goober is offline
Senior Member
 
Join Date: Oct 2004
Location: I am the threadkiller
Posts: 164
Default Re: Programming Question

huh?
Reply With Quote
  #3  
Old 04-15-2005, 01:10 AM
TimM TimM is offline
Senior Member
 
Join Date: Jan 2004
Location: New York
Posts: 147
Default Re: Programming Question

[ QUOTE ]
huh?

[/ QUOTE ]
Reply With Quote
  #4  
Old 04-15-2005, 01:10 AM
fluxrad fluxrad is offline
Senior Member
 
Join Date: Sep 2004
Location: The Peruvian highlands.
Posts: 1,169
Default 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.
Reply With Quote
  #5  
Old 04-15-2005, 01:10 AM
mason55 mason55 is offline
Senior Member
 
Join Date: Sep 2004
Location: All Sin Begins With Emotion
Posts: 801
Default 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?
Reply With Quote
  #6  
Old 04-15-2005, 01:17 AM
thirddan thirddan is offline
Senior Member
 
Join Date: Nov 2003
Location: San Francisco CA
Posts: 849
Default 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))>&gt);

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
Reply With Quote
  #7  
Old 04-15-2005, 01:23 AM
fluxrad fluxrad is offline
Senior Member
 
Join Date: Sep 2004
Location: The Peruvian highlands.
Posts: 1,169
Default Re: Programming Question

i have no idea how to do what you're asking. the equation was completely fake.
Reply With Quote
  #8  
Old 04-15-2005, 01:26 AM
The Goober The Goober is offline
Senior Member
 
Join Date: Oct 2004
Location: I am the threadkiller
Posts: 164
Default 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?
Reply With Quote
  #9  
Old 04-15-2005, 01:32 AM
thirddan thirddan is offline
Senior Member
 
Join Date: Nov 2003
Location: San Francisco CA
Posts: 849
Default 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))>&gt);

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?
Reply With Quote
  #10  
Old 04-15-2005, 01:33 AM
TimM TimM is offline
Senior Member
 
Join Date: Jan 2004
Location: New York
Posts: 147
Default 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
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:47 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.