public static TransformationMatrix3D Identity()
 {
     var transformationMatrix3D = new TransformationMatrix3D();
     for (var i = 0; i < 4; i++)
     {
         transformationMatrix3D[i, i] = 1.0;
     }
     return transformationMatrix3D;
 }
 public static Collection<Point3D> Multiply(TransformationMatrix3D transform, Collection<Point3D> points)
 {
     var collection = new Collection<Point3D>();
     foreach (var current in points)
     {
         collection.Add(transform*current);
     }
     return collection;
 }
 public Point3D Centroid(Collection<Point3D> points)
 {
     var count = points.Count;
     var num = 0.0;
     var num2 = 0.0;
     var num3 = 0.0;
     foreach (var current in points)
     {
         num += current.X;
         num2 += current.Y;
         num3 += current.Z;
     }
     var point3D = new Point3D(num/count, num2/count, num3/count);
     Transform = new TransformationMatrix3D(new Vector3D(point3D.X, point3D.Y, point3D.Z), new RotationMatrix3D());
     CalculateErrors(points, point3D);
     return point3D;
 }