Point Position From Intersection

803 views
Skip to first unread message

Dilen Shah

unread,
Jan 18, 2016, 11:15:36 AM1/18/16
to Python Programming for Autodesk Maya
Hey guys,

I am trying to get the position of the all the red marked points from the image.

So there are 2 meshes, one the plane which is like the grid and the other mesh is inside the grid.

Is there a way to get the positions of all the red marked points from these 2 meshes. I tried using MfnMesh.allintersection method but it gives me the exact position of the grid points not the point position of the red marked points.

Any ideas would be helpful.

Thank you.

D.
Screenshot.png

Marcus Ottosson

unread,
Jan 18, 2016, 11:40:41 AM1/18/16
to python_in...@googlegroups.com
Very interesting questions, Dilen. :) It's the kind of low-level things that make you appreciate Softimage's ICE, Houdini's VEX or Fabric Engine. I don't have an answer for you, but if you have the opportunity, it sounds like there's a better tool for the job out there than Maya.

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/e2d32034-fe61-484e-8511-e0d86d071b38%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Marcus Ottosson
konstr...@gmail.com

Dilen Shah

unread,
Jan 18, 2016, 12:05:24 PM1/18/16
to Python Programming for Autodesk Maya
Thanks for the reply but i am looking for something in Maya. Thanks.


On Monday, January 18, 2016 at 5:40:41 PM UTC+1, Marcus Ottosson wrote:
Very interesting questions, Dilen. :) It's the kind of low-level things that make you appreciate Softimage's ICE, Houdini's VEX or Fabric Engine. I don't have an answer for you, but if you have the opportunity, it sounds like there's a better tool for the job out there than Maya.
On 18 January 2016 at 16:15, Dilen Shah <dilen...@gmail.com> wrote:
Hey guys,

I am trying to get the position of the all the red marked points from the image.

So there are 2 meshes, one the plane which is like the grid and the other mesh is inside the grid.

Is there a way to get the positions of all the red marked points from these 2 meshes. I tried using MfnMesh.allintersection method but it gives me the exact position of the grid points not the point position of the red marked points.

Any ideas would be helpful.

Thank you.

D.

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.



--
Marcus Ottosson
konstr...@gmail.com

Roy Nieterau

unread,
Jan 18, 2016, 3:45:35 PM1/18/16
to Python Programming for Autodesk Maya
So this will either require some math (Line/Line intersections) but it would be harder for doing it with a curve of a degree higher than 1.
Though I remembered maya had a split by curve tool so I had a quick look for you.

The steps are to "project the curve" onto the mesh and then "split the mesh by projected curve".
This creates a polyProjectCurve node and a polySplit node. The interesting bit here is that the PolySplit node "splits" based on a predefined set of information for where to split.
As such this information must be provided (in some way) by the polyProjectCurve node for it to work.

Next step would be to investigate a bit into what's connected between the two nodes, where the critical information is in the curvePoints compound attributes.
There it's stored as a set of "split points" that represent the "face id", "triangle id" and the "barycentric coordinate".
Unfortunately there doesn't seem to be information on the node that just gives an "edge id" and a percentage along that edge... but it might get you closer?

Just thought I'd share this to see if it helps in any way. It's not necessarily trivial to go from there, but it shouldn't be impossible either.
The nice thing by using the project curve method it allows you to do it using any degree of curve and all of the functionality Maya provides along with it.

Node that the polySplit will always create a vertex on the edge, but might also create more... maybe there's a way to set it up so it only creates points on the edges or query that easily, but I didn't investigate that further.
Hope it helps.

Jiet Shern Neo

unread,
Jan 18, 2016, 7:47:35 PM1/18/16
to Python Programming for Autodesk Maya
I assume the grid you are using is always going to be flat. You can try this. Gather all the edge info for the grid and form an array of line segment per edge.
You should then use the inner line curve to form an extruded polygon strip (extended in both direction perpendicular to the grid). Now perform line segment/polygon face intersection test to using each line segment against all the polygon faces. You should then be able to find the red points by using barycentric coordinates then.
Hope this help. :)
Reply all
Reply to author
Forward
0 new messages