Before our algorithm branches, given a cookie shape, we determine whether
the corners of a shape are convex or concave. We first classify each
corner of the shape as either convex or concave. In order to do this,
our player traverses the vertices of the shape. During the traversal, the
interior of the polygon should remain on either the left or right side.
Likewise, if we form a triangle whose vertices are those of a corner,
upon a traversal of the triangle, we can determine if the interior of
the triangle stays on the left or right side. If the interiors of
the both the polygon and the triangle lie on different sides, then,
the angle is concave. Otherwise, the corner is convex.
Numerically, we can determine which the interior side by intergrating
at each vertex [Rusin1995]. The integral for a vertex,
, and polygon follow.
![]() |
(1) |
![]() |
(2) |
If the signs of differs from the
, then the
corner is concave. Otherwise, it is convex.
Furthermore, if all the corners of a shape are convex, we run our Convex
Shape Local Optimization algorithm. Otherwise, we apply the Concave
Shape routine on the given shape.