예제 #1
0
 public static FixTrans2 MakeScale(FixVec2 scale)
 {
     return(new FixTrans2(
                scale.X, 0, 0,
                0, scale.Y, 0
                ));
 }
예제 #2
0
 public static FixTrans2 MakeTranslation(FixVec2 delta)
 {
     return(new FixTrans2(
                1, 0, delta.X,
                0, 1, delta.Y
                ));
 }
예제 #3
0
 public FixTrans2 Scale(FixVec2 scale)
 {
     return(new FixTrans2(
                _m11 * scale.X, _m12 * scale.X, _m13 * scale.X,
                _m21 * scale.Y, _m22 * scale.Y, _m23 * scale.Y
                ));
 }
예제 #4
0
 public FixTrans2 Translate(FixVec2 delta)
 {
     return(new FixTrans2(
                _m11, _m12, _m13 + delta.X,
                _m21, _m22, _m23 + delta.Y
                ));
 }
예제 #5
0
        public FixTrans2(FixVec2 position, FixVec2 scale, Fix rotation)
        {
            Fix cos = FixMath.Cos(rotation);
            Fix sin = FixMath.Sin(rotation);

            _m11 = cos * scale.X; _m12 = -sin * scale.X; _m13 = position.X;
            _m21 = sin * scale.Y; _m22 = cos * scale.Y; _m23 = position.Y;
        }
예제 #6
0
        public FixTrans2(FixVec2 position, FixVec2 scale, Fix rotation)
        {
            Fix cos = FixMath.Cos(rotation);
            Fix sin = FixMath.Sin(rotation);

            _m11 = cos * scale.X; _m12 = -sin * scale.X; _m13 = position.X;
            _m21 = sin * scale.Y; _m22 = cos * scale.Y; _m23 = position.Y;
        }
예제 #7
0
 public override bool Equals(Object obj)
 {
     //Check for null and compare run-time types.
     if ((obj == null) || !this.GetType().Equals(obj.GetType()))
     {
         return(false);
     }
     else
     {
         FixVec2 fv = (FixVec2)obj;
         return(_x == fv._x.raw && _y.raw == fv._y.raw);
     }
 }
예제 #8
0
        public static Fix Angle(FixVec2 from, FixVec2 to)
        {
            Fix denominator = FixMath.Sqrt(from.GetMagnitudeSquared() * to.GetMagnitudeSquared());

            if (denominator < Fix.Epsilon)
            {
                return(Fix.zero);
            }

            Fix dot = FixMath.Clamp(FixVec2.Dot(from, to) / denominator, -Fix.one, Fix.one);

            return(FixMath.Acos(dot) * FixMath.Rad2Deg);
        }
예제 #9
0
 public static FixVec2 Cross(FixVec2 lhs, Fix rhs)
 {
     return(new FixVec2(lhs.y * rhs, lhs.x * -rhs));
 }
예제 #10
0
 public static FixVec2 Cross(Fix lhs, FixVec2 rhs)
 {
     return(new FixVec2(rhs.y * -lhs, rhs.x * lhs));
 }
예제 #11
0
 public static Fix Cross(FixVec2 lhs, FixVec2 rhs)
 {
     return(lhs.x * rhs.y - lhs.y * rhs.x);
 }
예제 #12
0
 public static Fix Dot(FixVec2 lhs, FixVec2 rhs)
 {
     return(lhs.x * rhs.x + lhs.y * rhs.y);
 }
예제 #13
0
 public static FixVec2 Max(FixVec2 pointA, FixVec2 t)
 {
     return(new FixVec2(FixMath.Max(pointA.x, t.x), FixMath.Max(pointA.y, t.y)));
 }
예제 #14
0
 public static FixVec2 Abs(FixVec2 v)
 {
     return(new FixVec2(FixMath.Abs(v.x), FixMath.Abs(v.y)));
 }
예제 #15
0
 public FixVec2 Apply(FixVec2 vec)
 {
     return this * vec;
 }
예제 #16
0
 public Fix Cross(FixVec2 rhs)
 {
     return(_x * rhs._y - _y * rhs._x);
 }
예제 #17
0
 public Fix Cross(FixVec2 rhs)
 {
     return(x * rhs.y - y * rhs.x);
 }
예제 #18
0
 public FixTrans2 Scale(FixVec2 scale)
 {
     return new FixTrans2(
         _m11 * scale.X, _m12 * scale.X, _m13 * scale.X,
         _m21 * scale.Y, _m22 * scale.Y, _m23 * scale.Y
     );
 }
예제 #19
0
 public FixTrans2 Translate(FixVec2 delta)
 {
     return new FixTrans2(
         _m11, _m12, _m13 + delta.X,
         _m21, _m22, _m23 + delta.Y
     );
 }
예제 #20
0
 public FixPolygon(IEnumerable <FixVec2> points)
 {
     Points = points.ToArray();
     Edges  = new FixVec2[Points.Length];
     BuildEdges();
 }
예제 #21
0
 public static Vector2 Floating(FixVec2 val)
 {
     return(new Vector2(Floating(val.X), Floating(val.Y)));
 }
예제 #22
0
 public Fix Dot(FixVec2 rhs)
 {
     return(x * rhs.x + y * rhs.y);
 }
예제 #23
0
 public FixVec2 Apply(FixVec2 vec)
 {
     return(this * vec);
 }
예제 #24
0
 public Fix Dot(FixVec2 rhs)
 {
     return(_x * rhs._x + _y * rhs._y);
 }
예제 #25
0
 public Fix Cross(FixVec2 rhs)
 {
     return _x * rhs._y - _y * rhs._x;
 }
예제 #26
0
 public static FixTrans2 MakeScale(FixVec2 scale)
 {
     return new FixTrans2(
         scale.X, 0, 0,
         0, scale.Y, 0
     );
 }
예제 #27
0
 public static FixTrans2 MakeTranslation(FixVec2 delta)
 {
     return new FixTrans2(
         1, 0, delta.X,
         0, 1, delta.Y
     );
 }
예제 #28
0
 public Fix Dot(FixVec2 rhs)
 {
     return _x * rhs._x + _y * rhs._y;
 }
예제 #29
0
 internal static FixVec2 Min(FixVec2 pointA, FixVec2 t)
 {
     return(new FixVec2(FixMath.Min(pointA.x, t.x), FixMath.Min(pointA.y, t.y)));
 }