Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void GetPointsForSpline(Dictionary<double, double> points)
- {
- Dictionary<double, double> newPoints = new Dictionary<double, double>();
- for (int x = 3; x < 9; x++)
- {
- for (double t = 0; t <= 1; t = t + 0.01)
- {
- Matrix<double> Tmatrix = DenseMatrix.OfArray(new double[,]
- {
- {Math.Pow(t, 3), Math.Pow(t, 2), t, 1}
- });
- Matrix<double> matrix = DenseMatrix.OfArray(new double[,]
- {
- {-0.5, 1.5, -1.5, 0.5},
- {1, -2.5, 2, -0.5},
- {-0.5, 0, 0.5, 0},
- {0, 1, 0, 0}
- });
- Matrix<double> Xmatrix = DenseMatrix.OfArray(new double[,]
- {
- {points.Keys.ElementAt(x - 3)},
- {points.Keys.ElementAt(x - 2)},
- {points.Keys.ElementAt(x - 1)},
- {points.Keys.ElementAt(x)}
- });
- Matrix<double> Ymatrix = DenseMatrix.OfArray(new double[,]
- {
- {points.Values.ElementAt(x - 3)},
- {points.Values.ElementAt(x - 2)},
- {points.Values.ElementAt(x - 1)},
- {points.Values.ElementAt(x)}
- });
- Matrix<double> XResultMatrix = Tmatrix * matrix * Xmatrix;
- Matrix<double> YResultMatrix = Tmatrix * matrix * Ymatrix;
- if (!newPoints.ContainsKey(XResultMatrix[0, 0]))
- {
- newPoints.Add(XResultMatrix[0, 0], YResultMatrix[0, 0]);
- }
- }
- }
- DrawPoligonalLine(newPoints, System.Windows.Media.Brushes.BlueViolet);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement