# [Bf-committers] Bevel function

Laurence Bourn bf-committers@blender.org
Mon, 8 Dec 2003 11:46:22 +0100

```>=20
> Should there be any questions about the algorithm itself,
> here's the basic way it works (developped in a sleepless
> night :)
>=20
> 1. Split all faces so that they are "floating" unconnected
>=20
> 2. Search for edges that lie exactly on top of each other.
>    Make a quad between them.
>=20
> 3. Search for more than 2 vertices which lie exactly on
>    the same point. Make lists of lists of these.
>=20
> 4. Shrink all original faces (i.e., excluding the new quads)
>    using an algorithm that moves a face's edge towards the
>    face's center independantly of the shape of the face.
>    This algorithm has originally been inspired by #math on
>    Dalnet, theeth has later integrated a simpler, faster
>    version.
>=20
> 5. Take the list of lists of vertices, and make n-gons between
>    each of the "clusters".
>    n-gons are made by calculating the Boundbox and extruding
>    all outer edges towards the center, merging in the middle.
>=20
> Any questions on this wonderful algo? ;-)
>=20
Fantastic algorithm and a nice clear description - thanks.
I have not reviewed your implementation so the following is just based =
on the above text.

Maybe you have missed a few steps out for clarity? It seems to me that =
the above algorithm will always introduce new polygons even if the input =
polygons are coplanar. The bevel polygons between the coplanar region =
are just flat and add nothing.

One way to get round this is to restrict your searching for interesting =
edges (Step 2) to edges whose polygons are greater than some angle. =
(Blender draws these feature edges iif you use wire-frame rendering in =
object mode).=20

Since you are now only bevelling specific edges, you will also have to =
modify the shrink function (Step 4) to only move vertices from those =
edges in the plane of the polygon and perpendicular to the edge.

Cheers,
Laurence.

```