Converts MIDI files into music box scores that are ready to print.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

86 lines
1.4 KiB

using System;
namespace SBRL.Utilities
{
/// <summary>
/// Represents a single point in 2D space.
/// May also be used to represent a direction with a magnitude.
/// </summary>
/// <version>v0.1</version>
/// <changelog>
/// v0.1 - 1st April 2017
/// - Added this changelog
/// </changelog>
public struct Vector2
{
/// <summary>
/// A Vector 2 with all it's proeprties initialised to zero.
/// </summary>
public static Vector2 Zero = new Vector2() { X = 0, Y = 0 };
/// <summary>
/// The X coordinate.
/// </summary>
public float X { get; set; }
/// <summary>
/// The Y coordinate.
/// </summary>
public float Y { get; set; }
public Vector2(float x, float y)
{
X = x;
Y = y;
}
public Vector2 Add(Vector2 b)
{
return new Vector2(
X + b.X,
Y + b.Y
);
}
public Vector2 Subtract(Vector2 b)
{
return new Vector2(
X - b.X,
Y - b.Y
);
}
public Vector2 Divide(float b)
{
return new Vector2(
X / b,
Y / b
);
}
public Vector2 Divide(Vector2 b)
{
return new Vector2(
X / b.X,
Y / b.Y
);
}
public Vector2 Multiply(float b)
{
return new Vector2(
X * b,
Y * b
);
}
public Vector2 Multiply(Vector2 b)
{
return new Vector2(
X * b.X,
Y * b.Y
);
}
public override string ToString() {
return $"[Vector2 {X}, {Y}]";
}
}
}