I would suggest starting by checking object's distance based on their
shape's bounding box extents as opposed to the whole object. With nurbs
curves you wind up with pivots being far from where the actual curve is,
sometimes they lie at the origin no matter where the actual cvs of  the
curve lie. You can then use the nearestPointOnCurve for each curve you want
to evaluate against, then check teh distances for each closest point on
curve to find the closest one.

Also, if you skip finding the closest curves first you cut out an entire
step. Just checking each one iterates that curve to begin with.
In the end it is probably faster just to get the nearestPointOnCurve for
each curve then check it's distance, then keep the closest distance within
your range. maya has a node already called nearestPointOnCurve.

-Damon

On Mon, May 14, 2012 at 6:56 AM, simon payne <[email protected]> wrote:

> I need to write something to find the nearest curve to specific cv's
> on another curve, within a given limited distance. So far, the only
> idea I have is to write a plugin to evaluate the nearestPoint on
> curve, for every single one of hundreds of curves, just to find out
> the nearest one to the target vertex.
>
> Ideally, I'd have something that simply looks for any objects within a
> given distance, decides if it is a nurbsCurve, and then finds its
> nearest point/u-parameter. Does anyone know if there is anything
> already in the API somewhere that would produce an efficient solution?
>
> Thanks
>
> --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe
>

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to