JuicyGraphics/src/JuicyGraphics/math/radian.cs

70 lines
1.8 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace JuicyGraphics.Mathematics {
struct radian {
private double _radian;
public radian(double radians) {
_radian = radians %= (2.0 * Math.PI);
}
public double val {
get {
return _radian;
}
set {
_radian = value;
_radian %= (2.0 * Math.PI);
}
}
public static radian operator +(radian left, double right) {
return new radian(left.val + right);
}
public static radian operator -(radian left, double right) {
return new radian(left.val - right); ;
}
public static radian operator -(radian me) {
return new radian(me.val + Math.PI);
}
public static radian operator +(radian me) {
return me;
}
//public static bool operator <(vec2 v1, vec2 v2) {
// return v1.sumComponentSqrs() < v2.sumComponentSqrs();
//}
//public static bool operator >(vec2 v1, vec2 v2) {
// return v1.sumComponentSqrs() > v2.sumComponentSqrs();
//}
//public static bool operator <=(vec2 v1, vec2 v2) {
// return v1.sumComponentSqrs() <= v2.sumComponentSqrs();
//}
//public static bool operator >=(vec2 v1, vec2 v2) {
// return v1.sumComponentSqrs() >= v2.sumComponentSqrs();
//}
//public static bool operator ==(vec2 v1, vec2 v2) {
// return
// v1.x == v2.x &&
// v1.y == v2.y;
//}
//public static bool operator !=(vec2 v1, vec2 v2) {
// return !(v1 == v2);
//}
}
}