Rigging

Rigging101 » Rigging128

Finding the closest CV to a point (3 posts)

About This Topic

Tags

No tags yet.

  1. Andimation

    offline
    Member
    Posted 8 years ago
    #

    Hey

    I have the need to find the closest CV on a nurbs surface to a point on the surface. I am using the Maya API (MPxNurbsSurface) to get a point on the surface, as well as the U&V value of that point. Now I want an efficient way to find the nearest CV, without having to iterate over every CV and do a distance check.

    Was wondering if anyone knows a better way?

    Thanks

    Andy

  2. scroll_lock

    offline
    Member
    Posted 8 years ago
    #

    > without having to iterate over every CV and do a distance check.

    hm... that should be interesting. My thoughts go to some kind of tree algorithm, but I don't think any of that exists in Maya already, so you have to program it first.... May I ask why you don't need to check every CV ?

  3. Andimation

    offline
    Member
    Posted 8 years ago
    #

    As part of a plugin I am shooting a ray onto a nurbs surface. If it intersects then I get the returned hit point and the UV values of that on the surface. Now I need to find the ID of the CV nearest to that point.

    With a polygon mesh you can just return the hit face and query the points that make up that face. So you have (commonly) 4 vertices to check against. But I don't have that option with the nurbsSurface as I can't do that with a patch.

    It is possible to use an octree or bsp tree, but I think I would have to implement that. Need to look into it more.

    Edit: It is possible -

    http://data-tribe.net/wework4her/index.php?entry=entry080414-194625

Reply

You must log in to post.

Rigging101 » Rigging128
1,099 posts in 307 topics over 110 months by 188 of 8,226 members. Latest: fashionpvp, d2q4p5z2j, gasheldonl