Complex polygon shape design or import

Typically: "How do I... ", "How can I... " questions
Post Reply
zhy149
Posts: 132
Joined: 14 Apr 2021, 20:18

Complex polygon shape design or import

Post by zhy149 »

Hello,

I want to do some grasping on some shapes like pentagons, hexagons, etc which don't belong to primitive shapes. Is making these shapes from external resources and importing mesh the only way or I can make these shapes inside the cop-Elia simulator? I imported some shapes from outside but their physics behavior is not very stable so I'd prefer internal shapes if possible. Any advice is appreciated! Thank you!

coppelia
Site Admin
Posts: 10375
Joined: 14 Dec 2012, 00:25

Re: Complex polygon shape design or import

Post by coppelia »

Hello,

in general, primitive shapes and/or convex shapes perform best. So if you import a shape, its icon in the scene hierarchy tells you whether it is convex or not. If it is not convex, then you can generate a convex shape from it with [Menu bar --> Edit --> Morph selection into convex shapes].

In a similar way you can take, e.g. a cuboid, duplicate it, and rotate the copy, and repeat. This way you can obtain a specific type of polygon. You can either group those primitive shapes (best), or use them to generate a convex polygon in the same way as described above.

Cheers

zhy149
Posts: 132
Joined: 14 Apr 2021, 20:18

Re: Complex polygon shape design or import

Post by zhy149 »

coppelia wrote: 07 Sep 2022, 07:52 Hello,

in general, primitive shapes and/or convex shapes perform best. So if you import a shape, its icon in the scene hierarchy tells you whether it is convex or not. If it is not convex, then you can generate a convex shape from it with [Menu bar --> Edit --> Morph selection into convex shapes].

In a similar way you can take, e.g. a cuboid, duplicate it, and rotate the copy, and repeat. This way you can obtain a specific type of polygon. You can either group those primitive shapes (best), or use them to generate a convex polygon in the same way as described above.

Cheers
Hello,

What about the density of overlap part and non-overlap if I group duplicates of a rotated cuboid? Another question is I don't know how to adjust friction coefficient properly, is there a tutorial or an example scene talking about this? Thank you!

zhy149
Posts: 132
Joined: 14 Apr 2021, 20:18

Re: Complex polygon shape design or import

Post by zhy149 »

coppelia wrote: 07 Sep 2022, 07:52 Hello,

in general, primitive shapes and/or convex shapes perform best. So if you import a shape, its icon in the scene hierarchy tells you whether it is convex or not. If it is not convex, then you can generate a convex shape from it with [Menu bar --> Edit --> Morph selection into convex shapes].

In a similar way you can take, e.g. a cuboid, duplicate it, and rotate the copy, and repeat. This way you can obtain a specific type of polygon. You can either group those primitive shapes (best), or use them to generate a convex polygon in the same way as described above.

Cheers
Hello, how can I generate polygon convex shapes by rotating a cuboid? They don't seem to be convex shapes tho.

fferri
Posts: 1229
Joined: 09 Sep 2013, 19:28

Re: Complex polygon shape design or import

Post by fferri »

The convex hull of a shape is always convex, by definition.

fferri
Posts: 1229
Joined: 09 Sep 2013, 19:28

Re: Complex polygon shape design or import

Post by fferri »

What Coppelia meant is to copy/paste cuboids so that their convex hull is exactly the shape you need.
Here I used one cuboid, and an additional dummy (parent) to use as rotation center, copy/paste, rotate \(i\)th dummy by \(2\pi\frac{i}{n}\), group, and use the function "Morph selection into convex shapes".
You can put all these operations in a customisation script, that dynamically regenerates the convex shape based on params (e.g. number of sides, radius, etc...).

Image

Alternatively, you can get a similar result by programmatically generating all the vertices, and triangulating those, then using sim.createMeshShape

zhy149
Posts: 132
Joined: 14 Apr 2021, 20:18

Re: Complex polygon shape design or import

Post by zhy149 »

fferri wrote: 08 Sep 2022, 12:07 What Coppelia meant is to copy/paste cuboids so that their convex hull is exactly the shape you need.
Here I used one cuboid, and an additional dummy (parent) to use as rotation center, copy/paste, rotate \(i\)th dummy by \(2\pi\frac{i}{n}\), group, and use the function "Morph selection into convex shapes".
You can put all these operations in a customisation script, that dynamically regenerates the convex shape based on params (e.g. number of sides, radius, etc...).

Image

Alternatively, you can get a similar result by programmatically generating all the vertices, and triangulating those, then using sim.createMeshShape
Hello, this sounds exactly what I need, may I ask how to write this script like how to rotate with respect to which frame etc? Thank you!

Post Reply