Concave to Convex

Hi,

I’m just about to start having a go at some functions to identify if a poly is concave or not and if so split it up into convex parts.

Is there already some features built in already?

Cheers!

non maniifold

API ?

bpy.ops.mesh.select_non_manifold()
Select all non-manifold vertices or edges

or the oppsosite!

happy 2.5

I’ve just added a default plane, a skewed plane and a poly slightly shaped like the blender logo, each one selects all vertices when I click ‘Select’ -> ‘non-manifold’.

I thought that was used to find edges which faced the wrong way to the rest???

Cheers!

http://wiki.blender.org/index.php/Doc:Reference/Glossary/Non-Manifold_Mesh

found a script for it

http://wiki.blender.org/index.php/Extensions:2.5/Py/Scripts/Modeling/Select_nonmanifold_edges

tested the non manifold script and seems it is not working anymore

may be because of addon changes at beginning

sorry no time this night toahave a look
may be tomorrow or if you have time this night have fun

and re issue it in python forum so other peoples can have it or sent message to Meta androco so it will change it in wiki page !

have fun with non manifold edges ect…

happy 2.5

Cheers!

Looking through the non-manifold script and I saw this line:


# edge is shared by more than 2 faces? it's non-manifold!

Which I believe describes the issue of non-manifold edges succinctly. So I don’t think this is what i’m after after all!

Oh, I tested the script on a couple of solids and it worked as expected.

could not wokr

did you do any changes ?

also found this
http://wiki.blender.org/index.php/Doc:Manual/Modeling/Meshes/Selecting/Edges

work only in edge mode !

but could not make it work in 2.5 viewport

did you do it in viewport ?

well if this can find edge non manifold i think it is good
but also how about this bpy ops non manifold
that one is not for edge i think !

happy 2.5

happy 2.5

I can select edges etc, i’m after a quick way of knowing if the polyline is concave or convex.

something to do with angle between the normals?
change from convex to concave happens when angle between normals changes from “positive” to “negative”?

bpy.ops.mesh.select_similar(type=‘NORMAL’, threshold=0…)
doesn’t do it but maybe something related?

just ideas!

Hi rarebit,

As far as I know there is no function in the API for testing if a polygon is concave/convex. Unfortunately non-manifold is something different to what you want. In terms of writing a script to check if a poly is concave/convex, one way is to do the following;

  • Pick a starting point on your poly (call it v1)
  • Pick a vertex connected to v1 by an edge and call it v2. Find the vector R = (v2.co - v1.co)
  • Now for all the other points in the order that they’re connected (v3 connected to v2 by an edge etc) calculate the angle between their position from v1 (e.g. (v3.co-v1.co)) and the vector R.
  • If each angle is always larger than the previous one, the polygon is convex, if not it is concave.

Cheers,
Truman

wow. i have a pretty fast way

  • select your concave / non concave polyline

  • convert it to a curve ( it will retain jaggyness )

  • set the curve mode to 2d, this fills in the boy of the polygon

  • convert the curve back to a mesh

  • now you have faces you can intersect a ray with :slight_smile:


it even does ‘poly surfaces’ with holes :slight_smile:

there is an old script to find non manifold mesh in blender

find ‘boundary.py’

but you will have to update to 2.5
is very handy for identifying non-manifold portions of your mesh !

http://www.ualberta.ca/~cwant/blender/python/
let us know if you update it
happy 2.5

@Trueman, my limited math knowledge was going to check all were over or under 180 degrees (because of not knowing which way round i’d be going, without a couple of extra calculations), but I like the sense in yours and will probably try it as well.

@zeffii, ingenious, it may even order the indices at the same time! :smiley:

i found an old script to convert concave objects to convex objects

hope this one helps more

Convex1.blend (615 KB)
happy 2.5

can you upload this file for manifold
i was not able to make it work in 38308
at least that one would work ok

i can see the script name in edge menu but it’s whithish
so it does not work but don’t get any error !

thanks
happy 2.5

Cheers, i’ve not looked yet, but…

As for the non-manifold script I downloaded it from your link here. But after reading it I tried the pre-installed one.

Try this, add a cube, go into Edit Mode and select an edge and do an extrude. Next deselect everything, then run select non-manifold using ‘Shift Ctrl Alt M’, you should get a result with that.

where do you find the pre installed one ?

thanks

I didn’t, I just used it from the menu!

But a quick grep:


grep -n "manifold" * */* */*/* */*/*/*
addons/space_view3d_spacebar_menu.py:972:                layout.operator("mesh.select_non_manifold",
addons/object_fracture/fracture_ops.py:231:         # This checks whether returned shards are non-manifold.
addons/object_fracture/fracture_ops.py:232:         # Problem is, if org mesh is non-manifold, it will always fail (e.g. with Suzanne).
presets/keyconfig/maya.py:308:kmi = km.keymap_items.new('mesh.select_non_manifold', 'M', 'PRESS', shift=True, ctrl=True, alt=True)
startup/bl_ui/space_view3d.py:527:                layout.operator("mesh.select_non_manifold", text="Non Manifold")
Binary file startup/bl_ui/__pycache__/space_view3d.cpython-32.pyc matches

Indicates that ‘fracture.py’ may have something in it which does the job.

To do it yourself shouldn’t be hard though,

edge is shared by more than 2 faces? it’s non-manifold!

I believe an edge with 0 faces is also considered non-manifold too.

well i ran it and get this in menu


i did remove the addons at the beginning
but that should not change anything i think

but even with it it does not work get same error in menu

any idea why ?

thanks

I’m lost?