Project Description
Spectral is a generic mathematics library for .NET.

Spectral allows generic arithmetic through the use of IL. The Spectral.Operations assembly has methods which are rewritten after compilation.

The majority of the types in this library are implemented as structs.

Usage
To declare a vector type, use the following syntax.
// Declares a 2-dimensional vector.
var vector = new Vector2<float>(0.1f, 2.0f);

To declare a matrix type, use the following syntax.
// Declares a 2x2 matrix.
var matrix = new Matrix2x2<float>(2.1f, -0.1f, 1.0f, 3.5f);

Spectral also provides some creational methods to bypass the generic syntax, ex:
// Declares a 2-dimensional vector.
var vector = Vector.Create(0.1f, 2.0f); // Much better...

Operators have been implemented where applicable.
var vector1 = Vector.Create(2, 3);
var vector2 = Vector.Create(2, 6);
var vector3 = vector1 + vector2; // {4, 9}
var dot = vector1.Dot(vector2); // Dot product.

Vector and Matrix sizes range from 2 to 4.

Features
  • Current
    • Vectors
    • Matrices
    • Quaternions
    • Rectangles
    • Colors
  • Planned
    • Geometric Primitives (Box, Sphere, Plane, Line, etc.)

Last edited Aug 15, 2011 at 3:08 PM by YellPika, version 10