default
This commit is contained in:
@@ -1,22 +1,24 @@
|
||||
using StgSharp.Math;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Common;
|
||||
using System.Text;
|
||||
|
||||
namespace StgSharp.Vector
|
||||
{
|
||||
public struct Vec2D:IEquatable<Vec2D>
|
||||
{
|
||||
float X;
|
||||
float Y;
|
||||
float Direction;
|
||||
float Length;
|
||||
public float X;
|
||||
public float Y;
|
||||
public float Direction;
|
||||
public float Length;
|
||||
|
||||
public Vec2D(float x,float y)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
Direction = 0;
|
||||
Direction = Calc.ATan(X,Y);
|
||||
Length = Calc.Sqrt(X * X + Y * Y);
|
||||
}
|
||||
|
||||
public bool Equals(Vec2D other)
|
||||
@@ -77,6 +79,24 @@ namespace StgSharp.Vector
|
||||
return new Vec2D(vec1.X + vec2.X, vec1.Y + vec2.Y);
|
||||
}
|
||||
|
||||
public static
|
||||
public static float operator *(Vec2D vec1, Vec2D vec2)
|
||||
{
|
||||
return vec1.X * vec2.X + vec1.Y*vec2.Y;
|
||||
}
|
||||
|
||||
public static Vec2D operator *(Vec2D vec, float x)
|
||||
{
|
||||
return new Vec2D(vec.X * x, vec.Y * x);
|
||||
}
|
||||
|
||||
public static Vec2D operator /(Vec2D vec, float x)
|
||||
{
|
||||
return new Vec2D(vec.X/x, vec.Y/x);
|
||||
}
|
||||
|
||||
public float x(Vec2D others)
|
||||
{
|
||||
return this.X * others.Y - this.Y * others.X;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user