public static void ClearMatrix() { MatrixList[0] = new FVector4(1, 0, 0, 0); MatrixList[1] = new FVector4(0, 1, 0, 0); MatrixList[2] = new FVector4(0, 0, 1, 0); MatrixList[3] = new FVector4(0, 0, 0, 1); }
public static FVector4 MultiplicationMatrix(FVector4 Point, FVector4[] Matrix) { FVector4 PointReturn = new FVector4(0, 0, 0, 1); float[] PointArray = new float[4] { Point.X, Point.Y, Point.Z, Point.W }; float[,] MatrixArray = new float[4, 4] { { Matrix[0].X, Matrix[0].Y, Matrix[0].Z, Matrix[0].W }, { Matrix[1].X, Matrix[1].Y, Matrix[1].Z, Matrix[1].W }, { Matrix[2].X, Matrix[2].Y, Matrix[2].Z, Matrix[2].W }, { Matrix[3].X, Matrix[3].Y, Matrix[3].Z, Matrix[3].W } }; for (int Index = 0; Index < 4; ++Index) { PointReturn.X += PointArray[Index] * MatrixArray[Index, 0]; PointReturn.Y += PointArray[Index] * MatrixArray[Index, 1]; PointReturn.Z += PointArray[Index] * MatrixArray[Index, 2]; PointReturn.W += PointArray[Index] * MatrixArray[Index, 3]; } return(PointReturn); }
public static float ModuleVector(FVector4 C1) { float I = C1.X * C1.X; float J = C1.Y * C1.Y; float K = C1.Z * C1.Z; return((float)Math.Sqrt((double)(I + J + K))); }
public static FVector4 OperatorCrossProduct(FVector4 C1, FVector4 C2) { float I = C1.Y * C2.Z - C2.Y * C1.Z; float J = C1.X * C2.Z - C2.X * C1.Z; float K = C1.X * C2.Y - C2.X * C1.Y; return(new FVector4(I, -J, K, 1)); }
public static float OperatorDotProduct(FVector4 C1, FVector4 C2) { float X = C1.X * C2.X; float Y = C1.Y * C2.Y; float Z = C1.Z * C2.Z; return(X + Y + Z); }
private void Draw() { Bitmap Picture = new Bitmap(PictureBox.Width, PictureBox.Height); Graphics Canvas = Graphics.FromImage(Picture); Pen Pen = new Pen(Color.Black); Canvas.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; foreach (var Element in Figure.GetConnectionsFVectorList()) { FVector4 One = Figure.GetCoordinates(Element.X); FVector4 Two = Figure.GetCoordinates(Element.Y); Canvas.DrawLine(Pen, One.Y, One.Z, Two.Y, Two.Z); } PictureBox.Image = Picture; }