示例#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)));
 }