maya api closet location equivalent?

Forum for users who have migrated or are migrating to Maya
anhungxadieu
Posts: 175
Joined: 17 Apr 2014, 10:39
Skype: nguyenvuducthuy

maya api closet location equivalent?

Post by anhungxadieu » 09 Sep 2017, 10:35

Hi everyone?
Sorry to asks this? :) but if someone already know maya api, can give me some idea regarding "closet location"?
thanks in advantage!

User avatar
rray
Moderator
Posts: 1552
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany

Re: maya api closet location equivalent?

Post by rray » 10 Sep 2017, 13:26

Maya's closest location function is inside the plugin called "nearestPointOnMesh".
It's one of the plugins that likes to turn itself off quite often and you have to go to your plugin list to enable it.
Also it only works when your scene units is meters...
All that taken care of I think you pass the function (which is also called nearestPointOnMesh same as the plugin I think) a mesh and a 3d position vector, and get back a 3d position back that's on the mesh. It's rather slow btw not being multithreaded like the ICE version.
"as a maya discussion grows longer, the probability of a suggestion involving deleting the preferences approaches one"

softimage resources section (formerly known as rray.de/xsi) updated May 30 2018

anhungxadieu
Posts: 175
Joined: 17 Apr 2014, 10:39
Skype: nguyenvuducthuy

Re: maya api closet location equivalent?

Post by anhungxadieu » 11 Sep 2017, 11:39

Thank for the reply rray,
But i want to get the "location" or another attribute inside the mesh.

User avatar
rray
Moderator
Posts: 1552
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany

Re: maya api closet location equivalent?

Post by rray » 11 Sep 2017, 11:43

I don't think that's possible without custom coding ~o)
"as a maya discussion grows longer, the probability of a suggestion involving deleting the preferences approaches one"

softimage resources section (formerly known as rray.de/xsi) updated May 30 2018

anhungxadieu
Posts: 175
Joined: 17 Apr 2014, 10:39
Skype: nguyenvuducthuy

Re: maya api closet location equivalent?

Post by anhungxadieu » 11 Sep 2017, 12:59

recently, i start to learn c++ maya api. If you already familiar with it, please point me some direction! :-B

User avatar
rray
Moderator
Posts: 1552
Joined: 26 Sep 2009, 15:51
Location: Bonn, Germany

Re: maya api closet location equivalent?

Post by rray » 11 Sep 2017, 15:13

I'm not familiar but I'm guessing there's no such concept as locations.

You might have to do actual coordinate comparisons to find the closest triangle to your point, get its 3 points, 3 attributes values from those points, and interpolate these after that, depending on the exact position of your lookup point on the triangle.

If you're not using accelerating data structures you can expect that to be like a 100 times slower than ICE.

If there's something in Maya's API to look up closest UV that would help a lot. Bake your attribute to a texture then and look that up. You could start with looking for that.
"as a maya discussion grows longer, the probability of a suggestion involving deleting the preferences approaches one"

softimage resources section (formerly known as rray.de/xsi) updated May 30 2018

anhungxadieu
Posts: 175
Joined: 17 Apr 2014, 10:39
Skype: nguyenvuducthuy

Re: maya api closet location equivalent?

Post by anhungxadieu » 11 Sep 2017, 18:29

rray wrote:
11 Sep 2017, 15:13
I'm not familiar but I'm guessing there's no such concept as locations.

You might have to do actual coordinate comparisons to find the closest triangle to your point, get its 3 points, 3 attributes values from those points, and interpolate these after that, depending on the exact position of your lookup point on the triangle.

If you're not using accelerating data structures you can expect that to be like a 100 times slower than ICE.

If there's something in Maya's API to look up closest UV that would help a lot. Bake your attribute to a texture then and look that up. You could start with looking for that.
Thanks rray, i will research in that way!

User avatar
myara
Posts: 357
Joined: 28 Sep 2011, 10:33

Re: maya api closet location equivalent?

Post by myara » 26 Oct 2017, 14:50

I haven't used nearestPointOnMesh but, you I guess it does the same as Open Maya's getClosestPoint.

I used this method to calculate the distance between a point and segment, so it's more 2D, but it could give you an idea. I don't know, maybe using the cross of 2 vectors.
https://nodedangles.wordpress.com/2010/ ... e-segment/

This link is pretty interesting too.
http://paulbourke.net/geometry/pointlineplane/
M.Yara
Character Modeler | Softimage Generalist (sort of)