closestPointOnCurve Node

Contents


User's Guide

The closestPointOnCurve node provides the same functionality for curves as Maya's closestPointOnSurface node does for surfaces. It lets you specify a curve and a point in space, from which it generates the coordinates and U parameter value of the point of the curve which is closest to the point in space. In addition, the distance between the point in space and the closest point on the curve is also calculated and made available.

A closestPointOnCurve node is created like any other node in Maya, using the createNode command. The example below creates a closestPointOnCurve node, a curve, and a locator. It then connects the locator's position and the curve to the closestPointOnCurve node, and retrieves the position, parameter value and distance between the locator and the curve.

    // Create the closestPointOnCurve node.
    createNode -name "cp" closestPointOnCurve;

    // Create the curve.
    curve -p -5 -5 0 -p -5 -4 0 -p -3 0 0 -p -2 1 0
          -p 2 0 0 -p 4 -1 0 -p 5 -3 0;

    // Create the locator and move it into position.
    createNode locator;
    move -r -5 5 0;

    // Connect the curve's worldSpace geometry and
    // the locator's position to the
    // closestPointOnCurve node
    connectAttr curve1.worldSpace cp.inputCurve;
    connectAttr locator1.translate cp.inPosition;

    // Retrieve the position of the point on curve1
    // which is closest to locator1.
    getAttr cp.position;
    // Result: -2.302124 0.4814418 0 //

    // Retrieve the point's U parameter value along
    // the curve.
    getAttr cp.parameterU;
    // Result: 1.606581 //

    // Retrieve the distance between locator1 and curve1.
    getAttr cp.distance;
    // Result: 5.26269 //

closestPointOnCurve example


Attribute Reference

attribute editor

Long (Short) Name Type Default
Value
Description
inputCurve (ic) nurbsCurve NULL The curve on which the closest point is to be found.
inPosition (ip) double3 0.0, 0.0, 0.0 The position in world space for which the closest point on inputCurve is to be found.
inPositionX (ipx)
distance 0.0cm X component of inPosition.
inPositionY (ipy)
distance 0.0cm Y component of inPosition.
inPositionZ (ipz)
distance 0.0cm Z component of inPosition.
result (r) compound n/a Container for all of the node's output values.
position (p)
double3 0.0, 0.0, 0.0 Position in world space of the point on inputCurve which is closest to inPosition.
positionX (px)
distance 0.0cm X component of position.
positionY (py)
distance 0.0cm Y component of position.
positionZ (pz)
distance 0.0cm Z component of position.
parameterU (u)
double 0.0 U parameter value of the point on inputCurve which is closest to inPosition.
distance (d)
distance 0.0cm Distance between inPosition and position.


Support & Copyright Information

The closestPointOnCurve node and its associated materials, which are collectively referred to as "this product", are copyright Gooroos Software, 1999-2004.

Gooroos Software provides this product as-is and assumes no liability for its use. You may freely redistribute it, but only in complete and unmodified form.

If you have any questions or problems with this product, please send email to support@gooroos.com. Because this product is made freely available, we cannot guarantee you a response, but we will try to get back to you as time permits.

For more information on Gooroos Software and our other products, please visit our web-site at www.gooroos.com.


Downloads

Plugin
Version
Maya
Version
Platform Size
1.2.36.5 (beta)Linux 29K Download
1.2.36.5 (beta)WinXP 509K Download
1.2.36.0Linux 29K Download
1.2.36.0WinXP 509K Download
1.2.35.0Linux 29K Download
1.2.35.0Win2000 279K Download
1.2.24.5Linux 73K Download
1.2.24.5Win2000 278K Download

Installation Instructions

Return to Products