mirror of
https://github.com/tengge1/ShadowEditor.git
synced 2026-01-25 15:08:11 +00:00
Vector2。
This commit is contained in:
parent
3b3c65cc9a
commit
e87f7343ab
12
THREE/Math/Matrix3.cs
Normal file
12
THREE/Math/Matrix3.cs
Normal file
@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
12
THREE/Math/Matrix4.cs
Normal file
12
THREE/Math/Matrix4.cs
Normal file
@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
12
THREE/Math/Plane.cs
Normal file
12
THREE/Math/Plane.cs
Normal file
@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
12
THREE/Math/Quaternion.cs
Normal file
12
THREE/Math/Quaternion.cs
Normal file
@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
12
THREE/Math/Ray.cs
Normal file
12
THREE/Math/Ray.cs
Normal file
@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
12
THREE/Math/Sphere.cs
Normal file
12
THREE/Math/Sphere.cs
Normal file
@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
12
THREE/Math/Spherical.cs
Normal file
12
THREE/Math/Spherical.cs
Normal file
@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
12
THREE/Math/Triangle.cs
Normal file
12
THREE/Math/Triangle.cs
Normal file
@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
140
THREE/Math/Vector2.cs
Normal file
140
THREE/Math/Vector2.cs
Normal file
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
12
THREE/Math/Vector3.cs
Normal file
12
THREE/Math/Vector3.cs
Normal file
@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
12
THREE/Math/Vector4.cs
Normal file
12
THREE/Math/Vector4.cs
Normal file
@ -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
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -49,6 +49,17 @@
|
||||
<Compile Include="Math\Interpolant.cs" />
|
||||
<Compile Include="Math\Line3.cs" />
|
||||
<Compile Include="Math\Math.cs" />
|
||||
<Compile Include="Math\Matrix3.cs" />
|
||||
<Compile Include="Math\Matrix4.cs" />
|
||||
<Compile Include="Math\Plane.cs" />
|
||||
<Compile Include="Math\Quaternion.cs" />
|
||||
<Compile Include="Math\Ray.cs" />
|
||||
<Compile Include="Math\Sphere.cs" />
|
||||
<Compile Include="Math\Spherical.cs" />
|
||||
<Compile Include="Math\Triangle.cs" />
|
||||
<Compile Include="Math\Vector2.cs" />
|
||||
<Compile Include="Math\Vector3.cs" />
|
||||
<Compile Include="Math\Vector4.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user