Exemplo n.º 1
0
 public static Point2D operator /(Point2D obj, float div)
 {
     Point2D result = new Point2D();
     result.x = obj.x / div;
     result.y = obj.y / div;
     return result;
 }
Exemplo n.º 2
0
 public static Point2D operator *(float mul, Point2D obj)
 {
     Point2D result = new Point2D();
     result.x = obj.x * mul;
     result.y = obj.y * mul;
     return result;
 }
Exemplo n.º 3
0
 public static Point2D operator -(Point2D obj1, Point2D obj2)
 {
     Point2D result = new Point2D();
     result.x = obj1.x - obj2.x;
     result.y = obj1.y - obj2.y;
     return result;
 }
Exemplo n.º 4
0
        Point2D HermiteInterpolate(float t, Point2D P0, Point2D P1, Point2D P2, Point2D P3)
        {
            Point2D m0 = (P1 - P0) * (1 + bias) * (1 - tension) * 0.5f + (P2 - P1) * (1 - bias) * (1 - tension) * 0.5f;
            Point2D m1 = (P2 - P1) * (1 + bias) * (1 - tension) * 0.5f + (P3 - P2) * (1 - bias) * (1 - tension) * 0.5f;

            float mu2 = t * t;
            float mu3 = mu2 * t;

            float a0 = 2 * mu3 - 3 * mu2 + 1;
            float a1 = mu3 - 2 * mu2 + t;
            float a2 = mu3 - mu2;
            float a3 = -2 * mu3 + 3 * mu2;

            return (a0 * P1 + a1 * m0 + a2 * m1 + a3 * P2);
        }
Exemplo n.º 5
0
 public KeyFrame(float t, Point2D point)
 {
     this.t = t;
     this.point = point;
 }
Exemplo n.º 6
0
 public KeyFrame(float t, float x, float y)
 {
     this.t = t;
     point = new Point2D(x, y);
 }