예제 #1
0
파일: Vector2f.cs 프로젝트: jonwa/CSharp
        public static void Normalize(Vector2f v)
        {
            var magnitude = InternalMagnitude(v);
            var normalized = v / magnitude;

            InternalSet(v, normalized._x, normalized._y);
        }
예제 #2
0
파일: Vector2f.cs 프로젝트: jonwa/CSharp
 private static void InternalSet(Vector2f v, float x, float y)
 {
     v._x = x;
     v._y = y;
 }
예제 #3
0
파일: Vector2f.cs 프로젝트: jonwa/CSharp
 private static double InternalMagnitude(Vector2f v)
 {
     return Math.Sqrt((v._x * v._x) + (v._y * v._y));
 }
예제 #4
0
파일: Vector2f.cs 프로젝트: jonwa/CSharp
 public static void Set(Vector2f v, float x, float y)
 {
     InternalSet(v, x, y);
 }
예제 #5
0
파일: Vector2f.cs 프로젝트: jonwa/CSharp
 public static float ReadY(Vector2f v)
 {
     return v._y;
 }
예제 #6
0
파일: Vector2f.cs 프로젝트: jonwa/CSharp
 public static float ReadX(Vector2f v)
 {
     return v._x;
 }
예제 #7
0
파일: Vector2f.cs 프로젝트: jonwa/CSharp
 public static double Magnitude(Vector2f v)
 {
     return InternalMagnitude(v);
 }