[Numpy-discussion] Re: Newbie: Matrix form of segment-sphere intersection?
Ryan Krauss
ryanlists at gmail.com
Fri Mar 24 12:54:01 CST 2006
I would first do this in python without ufuncs and see if it is slow
before going through the extra effort to put it in a ufunc.
I think if you play with array broadcasting, you will be quite happy
with the results for doing calculations on lots of points. Numpy
operates on an element-by-element basis by default. So, for example
x=arange(0,10,0.1)
y=x**2
will create a vector x and then a vector of y with the elements of x
squared. This sort of math on arrays I think does what you want
unless there is some math function in your algorithm that doesn't take
vector inputs. In that case you might need to write your own function
for that.
Does this help or am I missing something important?
Ryan
On 3/24/06, Jim Carroll <jimpy at oublic.org> wrote:
>
> > On Thu, 23 Mar 2006, (UTC) Jim Carroll apparently wrote:
> > > Where can I find applicable tutorials or recipies?
> >
> > Don't know the lit, but noticed this:
> > http://www.olympus.net/personal/7seas/contain.html
> >
>
> Interesting... but it doesn't show the how the points are formatted in the
> matricies, or how a more complicated algebraic function would be done...
>
> The sphere intersection 3 step algorithm defines some values up front, then
> finds the discriminant, then uses the discriminant to caluclate the intersection.
>
> I'm wondering if I'd be crazy if I coded the algorithm in a C ufunc:
> for a table where each row has x1, y1, z1, x2, y2, z2, radius if my ufunc
> would return a table that's got just three columns: x3, y3, z3 representing the
> sphere intersection. (asuming the input is translated so the sphere is at the
> origin.)
>
> Does anyone do this kind of things with ufuncs? Am I on the right track, but
> there's an easier way to do it? Or, is there a geometric math library that does
> this kind of thing? (I found one a year ago, but can't remember if it's this
> sophisticated.)
>
> Thanks,
> -Jim
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting language
> that extends applications into web and mobile media. Attend the live webcast
> and join the prime developer group breaking into this new coding territory!
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>
More information about the Numpy-discussion
mailing list