Community
Maya Programming
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya SDK topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

get curve intersection in world space

2 REPLIES 2
Reply
Message 1 of 3
coeuscreative
637 Views, 2 Replies

get curve intersection in world space

Is there any way to get the intersection of two curves in world space?

 

I can only think of a really convoluted way of doing it as follows. (Which wouldn't really be quick enough for my use case, anyway)

  1. Use cmds.curveIntersect to find the point along the curve that they intersect
  2. Create a curve animation using one of the curves and dummy object
  3. Use the animation to move the dummy object to the intersection point.
  4. Query the position of the dummy object toget the world coordinates.

Surely there must be a better way than that!

Thanks in advance
 

 

2 REPLIES 2
Message 2 of 3
mcw0
in reply to: coeuscreative

I believe the curveIntersect function creates locators on each of your curves.  Just query the worldPosition of the locators.  I used this recently.

Message 3 of 3
olarn
in reply to: coeuscreative

Not any less convoluted but with the API:

  1. Get MFnNurbesCurve from Curve 1
    https://help.autodesk.com/view/MAYAUL/2020/ENU/?guid=Maya_SDK_MERGED_cpp_ref_class_m_fn_nurbs_curve_...
  2. Get MFnNurbesCurve from Curve 2, sample it to arbitrary precision using getPointAtParam (worldspace)
  3. At arbitrary tolerance, test all sampled points with B's closestPoint, see if any hits (worldspace)

Another way would be to use curveIntersect node directly to find location of intersection on each curve, if any.

https://help.autodesk.com/cloudhelp/2020/ENU/Maya-Tech-Docs/Nodes/curveIntersect.html

Then use getPointAtParam (worldspace) to find the actual point

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report