Ok Numsgil. What do you mean by test cases? Would they require programming to create? If not I could try to help with those.
If you can figure out the coding, great. If not, I can do the coding myself and it'd still save some time. But you still probably need a basic idea of what I'm doing to help build the tests.
Right now I'm working on something called a
Straight skeleton. I have a few test cases I'm failing right now, and I'm working on fixing those. But there's probably quite a few cases I'm missing.
The input would be a simple polygon (possibly with holes), which would be a list of vertex positions in 2D. The output is a list of edges (that is, connections between two of the vertices). If you come up with test cases yourself that would be great, but it's actually pretty difficult. If you could find a working implementation of a straight skeleton online and feed in the input, and get back the output, and parse it in a way I can use for my own tests, that could be quite helpful. I think there's a Java implementation floating around the internet, for instance.
I have the easy ones right now (triangle, square, rectangle). But I'm missing any complicated convex polygon test cases. That would be a good place to start. Imagine the silhouette a potato would make, for instance. Also, regular polygons, (triangles, squares, octahedrons, etc.) are tricky problems because all the edges meet at a single interior point. I only have a up to something that looks like a prism or pencil shape right now. A full octahedron would be a good test case. A hybrid between a potato and a regular polygon would also be a good test case.
Check out
this file. Look for the second "public void Triangle()"
It looks like this:
public void Triangle()
{
var vertices = new PerforatedPolygon(new SimplePolygon(new Vector[]
{
new Vector(0, 0),
new Vector(1, 0),
new Vector(0.5, Math.Sqrt(3)/2),
}));
var expectedStraightSkeleton_AdditionalVerts = new Vector[]
{
new Vector(0.5, Math.Sqrt(3)/6),
};
var expectedStraightSkeleton_AdditionalEdges = new int[]
{
0, 3,
3, 1,
3, 2,
};
var straightSkeleton = StraightSkeleton.BuildStraightSkeleton(vertices);
CheckSimilarity(straightSkeleton,
vertices,
expectedStraightSkeleton_AdditionalVerts,
expectedStraightSkeleton_AdditionalEdges);
}
The "vertices" are the vertices in the initial polygon. The "_AdditionalVertices" are vertices created by the straight skeleton. The "_AdditionalEdges" are edges created by the straight skeleton. The first integer is the index of the first vertex, and the second integer is the index of the second vertex, assuming counting starts at 0, and the additional vertices get added to the end of the original vertices.
...
If you can write me some new tests using the above as a template, that would be great! If not, don't worry about it. There are some other areas that need tests, too, that might be a bit easier to do (things like testing rays for collision, that sort of thing).