PDA

View Full Version : Select similar polygons


SGIFreak
06-06-2012, 08:29 PM
Any expert to write the code?

rgkovach123
06-06-2012, 09:28 PM
What do you mean by select similar polygons?
Take a look at Select Using Constraints under the Select Menu.
It's a bit overwhelming at first, but once you get the hang out of it, it is very powerful.

SGIFreak
06-07-2012, 05:52 AM
What do you mean by select similar polygons?
Take a look at Select Using Constraints under the Select Menu.
It's a bit overwhelming at first, but once you get the hang out of it, it is very powerful.

Select Using Constraints is too slow to me.

Look at this:

http://www.youtube.com/watch?feature=player_detailpage&v=GCHXIGoWi_w#t=355s

Nyro
06-07-2012, 11:28 AM
*Ahem*

So basically you're asking for someone to write a script/plugin that can do that, when asked what exactly, you point out an existing (!) plugin that can do just that.

So I ask you: why not just buy NEX? You want someone else to code it so you get it for free?

rgkovach123
06-07-2012, 02:38 PM
Selecting polygons with similar topological neighbors is not trivial, but if you want to select nodes of similar type to the current selection, that is fairly easy with a little bit of scripting.


import maya.cmds as cmds
selection = cmds.ls(sl=True)
nodeTypes = []
for x in selection:
nodeTypes.append(cmds.nodeType(x))
similarNodes = cmds.ls(type=nodeTypes)
cmds.select(similarNodes, add=True)


Needs some validation and error checking, but there's the rough idea.

gtbull80
06-07-2012, 10:48 PM
Yeah...the devil is always in the details...in this case, it's the word "similar".

def FindSimilar():
someObj = selected()[0]
similarObj = FindSimilarObjs(someObj)

The fun part is defining 'FindSimilarObjs'. Definitely not trivial stuff...

bk3d
06-08-2012, 12:32 AM
you could compare vert count associated with a face. surface area of a face (maybe with some buffer space) . maybe compare center of face.

not sure how much you would have to compare to get an accurate result.

SGIFreak
06-08-2012, 06:01 AM
a little help: http://www.youtube.com/watch?v=QS0tSrkUtiY

bk3d
06-08-2012, 06:13 AM
a little help: http://www.youtube.com/watch?v=QS0tSrkUtiY

very cool. i might just take a stab at this this weekend.

rgkovach123
06-08-2012, 02:12 PM
Tha video is helpful, however polygons in Maya don't come with nice labels, A, B, C, D, E etc... to base comparisons on - figuring out how to map each vertex on 1 face to a vertex on the other face - that is tricky part (for me at least).

SGIFreak
06-08-2012, 02:38 PM
@rgkovach123

Show your talent.

A question:
Need maya a new modern API to show the labels of each face?

meuH
06-08-2012, 03:31 PM
@rgkovach123
Show your talent.


ahah really? :shrug:

what we're talking about here is comparing topology of faces, relative distance and layout of components etc...
to make a proper computation for that will require many operations. To keep it at an interactive performance level this is probably not something you want to do with scripting except for the very most basic cases.

and this has nothing to do with maya needing a new api for that. Just people having the time to figure out how to do it efficiently, which is a very rare commodity.

SGIFreak
06-08-2012, 03:49 PM
@meuH
Thanks for the info.

What is the best solution for this? mel, python or c++

meuH
06-08-2012, 04:19 PM
there's no best solution, there's only the solution that you're comfortable with and which works for your context.
mel is perfectly capable of it, you'll just hit the performance wall much much sooner.

as was said earlier, the issue is the algorithm not necessarily the language (even if you're going to have easier/more elegant solutions with python or c++).

zoharl
06-08-2012, 05:16 PM
Chris, you are not SMSing, so don't be shy to elaborate and talk freely.

If you need performance use C++, else python is enough (IMO don't touch mel).

If your only objective in life is to detect exact similar polygons (as opposed to differential shape operator, or minimizing the Dirichlet energy), then just use brute force (and I assume you refer to planar polys). Namely use two canonical loops - O(n^2) - and compare all the polys to all the polys. The comparison would start by the poly degree, and then ccw compare angles (use dot product) for each starting point (there are as many starting points as the poly degree).

Good luck.

SGIFreak
06-15-2012, 10:31 AM
@zoharl

Thanks for the declaration.

I wish i understand all the programming languages. little mel is ok but I'm just a novice in complex programming like this. maybe i should learn to advance scripting. any good python book for this?

zoharl
06-15-2012, 07:33 PM
If you have some mel background, then:

http://forums.cgsociety.org/showthread.php?t=1044538

Start with a basic loop that goes over the mesh faces, and an inner loop that go over each face vertices, and I'll help you from there.

CGTalk Moderation
06-15-2012, 07:33 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.