public void InitializePoints(int size) { P = new _3DPoint[(2 * size) * (2 * size) * 5 * 5]; double xCount = -size; double yCount = -size; _3DPoint.inMiddle = 60 * (int)Math.Pow(4 * (size + size), 2) / P.Length; int i; for (i = 0; i < P.Length && xCount < size; i += 1) { P[i] = new _3DPoint(); P[i].x = (float)xCount; P[i].y = (float)yCount; P[i].z = equation(P[i].x, P[i].y); P[i].c = (Color)ColorConverter.ConvertFromString("White"); yCount = Math.Round(yCount, 1); if (yCount == size) { yCount = -size; xCount += 0.2; } else { yCount += 0.2; } } }
public _3DPoint(_3DPoint p) { this.x = p.x; this.y = p.y; this.z = p.z; this.c = p.c; }
public void movePoint(int index, _3DPoint P, float x, float y) { Rectangle r = (Rectangle)drawingboard.Children[index]; Canvas.SetTop(r, Center.Y + P.y * spacing + y); Canvas.SetLeft(r, Center.X + P.x * spacing + x); //P.x += x; //P.y += y; }
public _3DPoint[] multiplyMartix(_3DPoint[] P, double[][] R) { _3DPoint[] newMatrix = new _3DPoint[P.Length]; for (int i = 0; i < newMatrix.Length; i++) { if (P[i] != null) { newMatrix[i] = new _3DPoint(); newMatrix[i].x = (float)(P[i].x * R[0][0] + P[i].y * R[0][1] + P[i].z * R[0][2]); //new x value newMatrix[i].y = (float)(P[i].x * R[1][0] + P[i].y * R[1][1] + P[i].z * R[1][2]); //new y value newMatrix[i].z = (float)(P[i].x * R[2][0] + P[i].y * R[2][1] + P[i].z * R[2][2]); newMatrix[i].c = P[i].c; newMatrix[i].proximity = P[i].proximity; } } return(newMatrix); }