Add pretty colors and new functions into the math types.
This commit is contained in:
parent
a50650e54a
commit
2e07b0ffc9
@ -130,6 +130,15 @@ namespace Quik
|
||||
A = (byte)((hexCode >> 0 ) & 0xFF);
|
||||
}
|
||||
public QuikColor(int hexCode) : this((uint)hexCode) { }
|
||||
|
||||
public static readonly QuikColor Black = new QuikColor(0, 0, 0, 255);
|
||||
public static readonly QuikColor Red = new QuikColor(255, 0, 0, 255);
|
||||
public static readonly QuikColor Green = new QuikColor(0, 255, 0, 255);
|
||||
public static readonly QuikColor Blue = new QuikColor(0, 0, 255, 255);
|
||||
public static readonly QuikColor Yellow = new QuikColor(255, 255, 0, 255);
|
||||
public static readonly QuikColor Cyan = new QuikColor(0, 255, 255, 255);
|
||||
public static readonly QuikColor Magenta = new QuikColor(255, 0, 255, 255);
|
||||
public static readonly QuikColor White = new QuikColor(255, 255, 255, 255);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -214,9 +223,17 @@ namespace Quik
|
||||
{
|
||||
float T = 1 - t;
|
||||
return
|
||||
(
|
||||
3 * T * T * (ControlA - Start) +
|
||||
6 * T * t * (ControlB - ControlA) +
|
||||
3 * t * t * (End - ControlB);
|
||||
3 * t * t * (End - ControlB)
|
||||
).Normalize();
|
||||
}
|
||||
|
||||
internal QuikVec2 GetBezierNormal(float t)
|
||||
{
|
||||
QuikVec2 tangent = GetBezierTangent(t);
|
||||
return new QuikVec2(-tangent.Y, tangent.X);
|
||||
}
|
||||
}
|
||||
|
||||
@ -249,6 +266,16 @@ namespace Quik
|
||||
End.X = endX;
|
||||
End.Y = endY;
|
||||
}
|
||||
|
||||
public QuikVec2 Normal()
|
||||
{
|
||||
QuikVec2 tangent = Tangent();
|
||||
return new QuikVec2(-tangent.Y, tangent.X);
|
||||
}
|
||||
public QuikVec2 Tangent()
|
||||
{
|
||||
return (End - Start).Normalize();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user