protected Vector3[] RotateMatrix(Node root, float angle) { //Rotate the verticies matrix LightMatrix rotatedMatrix = modifiedVerticesMatrix.Duplicate(); for (int i = 0; i < rotatorData.listRotationDimension.Length; i++) { LightMatrix rotationMatrix = LightMatrixRotationND.Rotation( angle, root.dimension, rotatorData.listRotationDimension[i].x, rotatorData.listRotationDimension[i].y); rotatedMatrix = LightMatrix.Multiply(rotatedMatrix, rotationMatrix); } Vector3[] rotatedVertices = new Vector3[rotatedMatrix.rows]; //Convert matrix to 3D coordinate for (int i = 0; i < rotatedMatrix.rows; i++) { Vector3 position = rotatorData.dimensionReader.NDtoVector3(rotatedMatrix.GetRow(i)); rotatedVertices[i] = position * rotatorData.size; } return(rotatedVertices); }
void CalculateVerticesMatrix(Node root) { verticesMatrix = new LightMatrix(root.vertices.Count, root.dimension); for (int i = 0; i < root.vertices.Count; i++) { verticesMatrix.SetRow(i, root.vertices[i].GetValues()); } modifiedVerticesMatrix = verticesMatrix.Duplicate(); }