diff --git a/THREE/Math/Matrix3.cs b/THREE/Math/Matrix3.cs new file mode 100644 index 00000000..c3f12777 --- /dev/null +++ b/THREE/Math/Matrix3.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace THREE.Math +{ + class Matrix3 + { + } +} diff --git a/THREE/Math/Matrix4.cs b/THREE/Math/Matrix4.cs new file mode 100644 index 00000000..452af0c3 --- /dev/null +++ b/THREE/Math/Matrix4.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace THREE.Math +{ + class Matrix4 + { + } +} diff --git a/THREE/Math/Plane.cs b/THREE/Math/Plane.cs new file mode 100644 index 00000000..90c31191 --- /dev/null +++ b/THREE/Math/Plane.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace THREE.Math +{ + class Plane + { + } +} diff --git a/THREE/Math/Quaternion.cs b/THREE/Math/Quaternion.cs new file mode 100644 index 00000000..a922bf0b --- /dev/null +++ b/THREE/Math/Quaternion.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace THREE.Math +{ + class Quaternion + { + } +} diff --git a/THREE/Math/Ray.cs b/THREE/Math/Ray.cs new file mode 100644 index 00000000..057a7e93 --- /dev/null +++ b/THREE/Math/Ray.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace THREE.Math +{ + class Ray + { + } +} diff --git a/THREE/Math/Sphere.cs b/THREE/Math/Sphere.cs new file mode 100644 index 00000000..6292315a --- /dev/null +++ b/THREE/Math/Sphere.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace THREE.Math +{ + class Sphere + { + } +} diff --git a/THREE/Math/Spherical.cs b/THREE/Math/Spherical.cs new file mode 100644 index 00000000..8ae253b4 --- /dev/null +++ b/THREE/Math/Spherical.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace THREE.Math +{ + class Spherical + { + } +} diff --git a/THREE/Math/Triangle.cs b/THREE/Math/Triangle.cs new file mode 100644 index 00000000..6b29e487 --- /dev/null +++ b/THREE/Math/Triangle.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace THREE.Math +{ + class Triangle + { + } +} diff --git a/THREE/Math/Vector2.cs b/THREE/Math/Vector2.cs new file mode 100644 index 00000000..14388152 --- /dev/null +++ b/THREE/Math/Vector2.cs @@ -0,0 +1,140 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace THREE.Math +{ + public class Vector2 + { + public double x = 0; + public double y = 0; + + public Vector2(double x = 0, double y = 0) + { + this.x = x; + this.y = y; + } + + public double width + { + get + { + return this.x; + } + set + { + this.x = value; + } + } + + public double height + { + get + { + return this.y; + } + set + { + this.y = value; + } + } + + public bool isVector2 = true; + + public Vector2 Set(double x, double y) + { + this.x = x; + this.y = y; + return this; + } + + public Vector2 SetScalar(double scalar) + { + this.x = scalar; + this.y = scalar; + return this; + } + + public Vector2 SetX(double x) + { + this.x = x; + return this; + } + + public Vector2 SetY(double y) + { + this.y = y; + return this; + } + + public Vector2 SetComponent(int index, double value) + { + switch (index) + { + case 0: + this.x = value; + break; + case 1: + this.y = value; + break; + default: + throw new Exception($"index is out of range: {index}"); + } + + return this; + } + + public double GetComponent(int index) + { + switch (index) + { + case 0: + return this.x; + case 1: + return this.y; + default: + throw new Exception($"index is out of range: {index}"); + } + } + + public Vector2 Clone(Vector2 v) + { + this.x = v.x; + this.y = v.y; + + return this; + } + + public Vector2 Add(Vector2 v, Vector2 w = null) + { + if (w != null) + { + // console.warn('THREE.Vector2: .add() now only accepts one argument. Use .addVectors( a, b ) instead.'); + return this.AddVectors(v, w); + } + + this.x += v.x; + this.y += v.y; + + return this; + } + + public Vector2 AddScalar(double s) + { + this.x += s; + this.y += s; + + return this; + } + + public Vector2 AddVectors(Vector2 a, Vector2 b) + { + this.x = a.x + b.x; + this.y = a.y + b.y; + + return this; + } + } +} diff --git a/THREE/Math/Vector3.cs b/THREE/Math/Vector3.cs new file mode 100644 index 00000000..c6e0f4a8 --- /dev/null +++ b/THREE/Math/Vector3.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace THREE.Math +{ + class Vector3 + { + } +} diff --git a/THREE/Math/Vector4.cs b/THREE/Math/Vector4.cs new file mode 100644 index 00000000..a00299b1 --- /dev/null +++ b/THREE/Math/Vector4.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace THREE.Math +{ + class Vector4 + { + } +} diff --git a/THREE/THREE.csproj b/THREE/THREE.csproj index 0636ae63..d2d09bcf 100644 --- a/THREE/THREE.csproj +++ b/THREE/THREE.csproj @@ -49,6 +49,17 @@ + + + + + + + + + + +