Getting Started - aarondandy/vertesaur GitHub Wiki
Vertesaur is delivered in package format from NuGet. Please be aware that any release before version 1.0 is to be considered under heavy modification and development.
The Vertesaur Core package contains data structures and algorithms primarily dealing with System.Double. This is the best package to start with.
The package contains the following builds:
- .NET 4.0 (Client)
- Silverlight 5
- Silverlight 4
- Windows 8
- Windows Phone 8
- Windows Phone 7.1
The Vertesaur Generation package contains additional functionality that allows for run-time code generation and generic algorithms and data structures. This package is being driven in its early phases by a run-time compiling map projection system. Note however that this package is highly experimental.
The package contains the following builds:
- .NET 4.0 (Client)
- Silverlight 5
- Windows 8
- Windows Phone 8
NOTE: Because this package makes heavy use of run-time code generation and JIT compilation it will be incompatible with iOS platforms.
I have not had access to a distributed build system in a while so Mono has not been tested recently. I would assume that Vertesaur.Core would work fine on Mono though. Let me know if you can run the tests on there.
- You will need NuGet
- VS 2012 may ship with NuGet
- Some may need to install NuGet
- Use the NuGet package manager to find and add Vertesaur as a dependency
- That is all there is to it...
After referencing Vertesaur you are all ready to go.
using System;
using Vertesaur;
using Vertesaur.PolygonOperation;
class Program
{
static void Main(string[] args) {
// make a square from 0,0 to 1,1
var square = new Polygon2(new [] {
new Point2(0,0),
new Point2(1,0),
new Point2(1,1),
new Point2(0,1)
}, hole: false);
// make a triangle that will slice it in half
var triangle = new Polygon2(new[] {
new Point2(0.5, -0.5),
new Point2(1,2),
new Point2(0,2)
}, hole: false);
// subtract the triangle shape from the square shape
var result = (Polygon2)new PolygonDifferenceOperation().Difference(square, triangle);
for (int ringIndex = 0; ringIndex < result.Count; ringIndex++) {
var ring = result[ringIndex];
Console.WriteLine("ring: {0} hole: {1}", ringIndex, ring.Hole);
foreach (var point in ring)
Console.WriteLine("\t{0}", point);
}
Console.ReadKey(); // wait to close the window
}
}
See the API Docs for details on other data structures and algorithms.