/// <summary> /// Transform /// </summary> /// <param name="r"></param> /// <param name="origin"></param> /// <param name="point"></param> /// <returns></returns> public Point3dModel Transform(double r, Point3dModel origin, Point3dModel point) { List <double> arraTranform1 = new List <double> { 1, 0, 0, -origin.X, 0, 1, 0, -origin.Y, 0, 0, 1, -origin.Z, 0, 0, 0, 1 }; Matrix3dModel T1 = new Matrix3dModel(arraTranform1); List <double> rotationMatrix = new List <double> { Math.Cos(r), -Math.Sin(r), 0, 0, Math.Sin(r), Math.Cos(r), 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }; Matrix3dModel T2 = new Matrix3dModel(rotationMatrix); List <double> arraTranform2 = new List <double> { 1, 0, 0, origin.X, 0, 1, 0, origin.Y, 0, 0, 1, origin.Z, 0, 0, 0, 1 }; Matrix3dModel T3 = new Matrix3dModel(arraTranform2); Point3dModel tfBack = T1.Transform(point); Point3dModel tfRotate = T2.Transform(tfBack); Point3dModel tfMove = T3.Transform(tfRotate); Point3dModel tfBlockTransform = this.Transform(tfMove); return(tfBlockTransform); }
/// <summary> /// Transform with rotation, this means it is already tranformed back to /// </summary> /// <param name="r"></param> /// <param name="point"></param> /// <returns></returns> public Point3dModel Transform(double r, Point3dModel point) { List <double> rotationMatrix = new List <double> { Math.Cos(r), -Math.Sin(r), 0, 0, Math.Sin(r), Math.Cos(r), 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 }; Matrix3dModel T1 = new Matrix3dModel(rotationMatrix); return(this.Transform(T1.Transform(point))); }