RE: Scripting: Closest Point On a Point Cloud?

2012-05-03 Thread Chris Chia
Of Bradley Gabe Sent: Thursday, May 03, 2012 2:22 AM To: softimage@listproc.autodesk.com Subject: Re: Scripting: Closest Point On a Point Cloud? Thanks Alan! You have officially leveled up and gained the title of SI Python Optimizer (Spo). I knew the math, but for some reason assumed that compiled

Re: Scripting: Closest Point On a Point Cloud?

2012-05-02 Thread Alan Fregtman
Hey Brad, I wondered if using math directly would be faster than working with XSIMath objects, so I tried. You probably knew this, but to get a distance between two 3D vectors the formula is quite easy: * d = √ (Ax-Bx)2 + (Ay-By)2 + (Az-Bz)2 * where A and B are two vectors to measure from.

Re: Scripting: Closest Point On a Point Cloud?

2012-05-02 Thread Steven Caron
sweet, i didn't know that either and was questioning it when reading your code. On Wed, May 2, 2012 at 11:00 AM, Alan Fregtman alan.fregt...@gmail.comwrote: ps: Friendly nod to Xavier for pointing out ** syntax does to the power of so I don't need to use math.pow() in my code.

Re: Scripting: Closest Point On a Point Cloud?

2012-05-02 Thread Bradley Gabe
Thanks Alan! You have officially leveled up and gained the title of SI Python Optimizer (Spo). I knew the math, but for some reason assumed that compiled Math functions would run faster than Python. That'll teach me. [?] Actually, thinking about it now, anything that has to repeated call the COM

Re: Scripting: Closest Point On a Point Cloud?

2012-05-02 Thread jo benayoun
def find_closest_point(obj, pos): x, y, z = pos points = obj.ActivePrimitive.Geometry. Points count = points.Count points = points.PositionArray xx, yy, zz = points delta = [((x-xx[i])**2 + (y-yy[i])**2 + (z-zz[i])**2) for i in xrange(count)] return

RE: Scripting: Closest Point On a Point Cloud?

2012-05-01 Thread Matt Lind
Can you use GetClosestVertex()? Matt From: softimage-boun...@listproc.autodesk.com [mailto:softimage-boun...@listproc.autodesk.com] On Behalf Of Bradley Gabe Sent: Tuesday, May 01, 2012 11:42 AM To: softimage@listproc.autodesk.com Subject: Scripting: Closest Point On a Point Cloud? For a

RE: Scripting: Closest Point On a Point Cloud?

2012-05-01 Thread Stephen Blair
: Scripting: Closest Point On a Point Cloud? I'm not finding that anywhere in the docs, is that available for Point Cloud Geometry? On Tue, May 1, 2012 at 2:44 PM, Matt Lind ml...@carbinestudios.commailto:ml...@carbinestudios.com wrote: Can you use GetClosestVertex()? Matt From: softimage

Re: Scripting: Closest Point On a Point Cloud?

2012-05-01 Thread Bradley Gabe
I was going by the following quote from the docs: Note: Point locators are currently only supported by NurbsSurfaceMeshfile:mill3d/server/apps/SOFTIMAGE/docs/softimage2012/en_us/sdkguide/si_om/NurbsSurfaceMesh.htmland

Re: Scripting: Closest Point On a Point Cloud?

2012-05-01 Thread Bradley Gabe
Nah, it was raising errors when I tried it before starting this thread, and it still is now [?]: # ERROR : 2028 - Traceback (most recent call last): # File Script Block , line 2, in module # obj.ActivePrimitive.Geometry.GetClosestLocations([0, 0, 0]) # File COMObject unknown, line 2, in

Re: Scripting: Closest Point On a Point Cloud?

2012-05-01 Thread Alan Fregtman
Care to share a sample snippet? Maybe there are even faster ways to approach it. On Tue, May 1, 2012 at 5:42 PM, Bradley Gabe witha...@gmail.com wrote: UPDATE: All things considered, it's not too horrible simply looping through every position from the Geometry.Points.PositionArray, and