# Shape rendering problem.

## Recommended Posts

soivex    122
Hello. Guys, i need some help here. So, i have a random shape (can be convex or non convex form). Actually this shape is a connected spline. I'm talking about 2D shapes. So, i need to conver it to the 3D space (it's simple, just adding z coordinate) and put some texture on it. The main problem for me - how to render it using just one call to DrawPrimitives. In general i need to split my shape (even in 2D) into number of small triangles. I have'nt see any problems for convex shape. But i DON'T know how to deal with non convex shapes. May be there is some common way to solve this issue for convex and non convex shapes? Please, help. Thanks!

##### Share on other sites
I'm a little slow understanding, so let me reformulate. You have a spline (a contour) defined by some points, it's 2D, and you want to fill it. Right ? Since your spline is 2D, you don't need to add points inside the shape : you can fill it with polygons (triangles) going through the contour nodes. This process is called tessellation or polygon triangulation, and there are glu-commands to deal with it. You can also split your shapes into triangles yourself, there are plenty of algorithms available. Example :

http://www.gamedev.net/reference/articles/article408.asp

I use another algorithm that detects the sharpest convex angle of the contour and puts a triangle there, then goes on to the next sharpest angle of the remaining shape, and so on. Things are only getting a little more complicated when your shape has holes in it.

##### Share on other sites
soivex    122

Just imagine that my shape is a jigsaw puzzle piece.
And just need to render it avoiding any masks creation etc..
Just a number of points converted to a number of triangles (here comes my troubles with non-convex shapes) and so on...
I don't actually know how to create this triangles!

Thanks!

##### Share on other sites
As I said, look for "polygon triangulation" on the net, and you'll find plenty of stuff. Most of the algorithms deal with non-convex polygons.

soivex    122
Thanks a lot!

##### Share on other sites
jwal    122
I have a question regarding 3d modelling software in general. I work in a work working facility, we do a lot of custom work. I want to do up some basic drawings and make it easy enough for people in sales to change lengths. ideally would be for them to click on the length and enter a new number in. i know in solid edge this will work, are there any other 3d modelling software where this can be done easily? and what does it cost for a license?