From: Bruce S. <Bru...@nc...> - 2008-07-13 13:42:55
|
In the case of spheres this is pretty easy already: if mag(r-c.pos) < c.radius: print "inside". It's certainly more difficult with other objects. What non-sphere objects did you have in mind? Bruce Sherwood Nathan Moore wrote: > I'm playing around with a complicated (boundary) in a Laplace equation > problem, in vpython. It would be nice to know if a point is inside of > another object within the program, ie, > > r=vector(1,1,1) > s=vector(0,0,0) > > c = sphere(pos=(0,0,0),radius=0.75) > > I want to know if r, or s are in the object c. > > I've worked out some functions in longhand, but I figure an included > function might be faster... > > Nathan > |