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
"""
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 delta.index(min(d
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 l
"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."
Ok, that's my day made worthwhile!
On 2 May 2012 19:00, Alan Fregtman wrote:
> Hey Brad,
>
> I wondered if using math directly would be faster than working with
> XSI
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 wrote:
>
>
> 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.
>
>
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.
Howe
Sure, have at it:
def FindClosestPoint( inObj, inPos):
dist = 1
ID = -1
Pos = XSIMath.CreateVector3()
PosArr = inObj.ActivePrimitive.Geometry.Points.PositionArray
for index in range(inObj.ActivePrimitive.Geometry.Points.Count):
Pos.Set(
PosArr[0][index],
PosArr[1][index],
PosArr[2][index]
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 wrote:
> UPDATE:
>
> All things considered, it's not too horrible simply looping through every
> position from the Geometry.Points.PositionArray, and comparing the dista
UPDATE:
All things considered, it's not too horrible simply looping through every
position from the Geometry.Points.PositionArray, and comparing the distance
in order to find the closest point in the cloud. So far, that technique is
faster than anything else I've attempted to cook up.
-Bradley
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 "
I was going by the following quote from the docs:
Note: Point locators are currently only supported by
NurbsSurfaceMeshand
> PolygonMeshobjects.
But I'll still give it a shot...
On Tue, May 1, 2012 at 2:54 PM, Stephen Blair wrote:
> But doesn't a PointCloudGeometry support GetClosestLocations
image-boun...@listproc.autodesk.com] On Behalf Of Bradley Gabe
Sent: Tuesday, May 01, 2012 11:49 AM
To: softimage@listproc.autodesk.com
Subject: Re: 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:4
ubject: Re: 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
mailto:ml...@carbinestudios.com>> wrote:
Can you use GetClosestVertex()?
Matt
t; *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?
>
> ** **
>
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
For a current tool, I need to get the closest point ID in a particle
cloud to a global position.
I'm familiar with using Geometry.GetClosestLocations(pos) which would
accomplish this if I were targeting a polygon mesh. Is there an analogue
that would work for a Point Cloud?
I do have another trick
16 matches
Mail list logo