17 Point P0 =
new Point(0.0, 0.01);
18 Point P1 =
new Point(50.0, 1.0);
20 Point P3 =
new Point(100.0, 100.0);
21 Point V0 =
new Point(125.0, 0);
22 Point V1 =
new Point(1.0, 0.1);
24 Point V3 =
new Point(0.0, 287.0);
26 double eps = 0.000001;
37 double toAddOrSubtract = 0.25;
55 Point point =
new Point();
57 double f1, f2, f3, f4;
67 point.X = p0.X * f1 + p1.X * f2 + v0.X * f3 + v1.X * f4;
74 }
while (Math.Abs(x - point.X) > eps);
76 double Yvalue = p0.Y * f1 + p1.Y * f2 + v0.Y * f3 + v1.Y * f4;
85 protected double F1(
double t)
87 return 2 * Math.Pow(t, 3) - 3 * Math.Pow(t, 2) + 1;
95 protected double F2(
double t)
97 return -2 * Math.Pow(t, 3) + 3 * Math.Pow(t, 2);
105 protected double F3(
double t)
107 return Math.Pow(t, 3) - 2 * Math.Pow(t, 2) + t;
115 protected double F4(
double t)
117 return Math.Pow(t, 3) - Math.Pow(t, 2);
124 public void Draw(DrawingContext dc)
126 double ellipseRadius = 2.0;
127 double enhancer = 8.0;
128 double enhancerX = 1.0;
129 double enhancerY = 1.0;
130 for (
int x = 0; x <= 100; x++)
132 double y = GetYValue(x);
133 Brush br = Brushes.Black;
134 if (x == 50 || x == 0 || x == 100)
139 Console.Write(y.ToString(CultureInfo.InvariantCulture) +
",");
140 dc.DrawEllipse(br, null,
new Point(x * enhancer * enhancerX, (100.0 * enhancer * enhancerY) -
141 (y * enhancer * enhancerY)), ellipseRadius, ellipseRadius);
147 for (
int x = 0; x <= 55; x++)
149 double y = GetYValue(x);
150 Brush br = Brushes.Green;
151 if (x == 50 || x == 0 || x == 100)
155 dc.DrawEllipse(br, null,
new Point(x * enhancer * enhancerX, (100.0 * enhancer) -
156 ((100.0 * enhancer * enhancerY) - ((100 - y) * enhancer * enhancerY))),
157 ellipseRadius, ellipseRadius);
double GetYValue(double x)
Gets Y Value for X value for Ferguson cubics.
void Draw(DrawingContext dc)
Draw points to visualize Ferguson cubic used for determining zoom rates from some interval...
double F3(double t)
Method as part of computing value in X axis for Ferguson cubic.
double F4(double t)
Method as part of computing value in X axis for Ferguson cubic.
double F1(double t)
Method as part of computing value in X axis for Ferguson cubic.
double F2(double t)
Method as part of computing value in X axis for Ferguson cubic.