public static string GetString(object value) { if (value is Vector3) { Vector3 v = (Vector3)value; return("(" + v.X + " ," + v.Y + " ," + v.Z + ")"); } else if (value is Vector2) { Vector2 v = (Vector2)value; return("(" + v.X + " ," + v.Y + ")"); } else if (value is Vector4) { Vector4 v = (Vector4)value; return("(" + v.X + " ," + v.Y + " ," + v.Z + " ," + v.W + ")"); } else if (value is Plane) { Plane plane = (Plane)value; return(String.Format("<{0},{1}>", GetString(plane.Normal), plane.D)); } else if (value is Euler) { Euler v = (Euler)value; return("<" + ToAngle(v.Heading) + " ," + ToAngle(v.Pitch) + " ," + ToAngle(v.Roll) + ">"); } else if (value is Size) { Size v = (Size)value; return("<" + v.Width + " x " + v.Height + ">"); } else if (value is SizeF) { SizeF v = (SizeF)value; return("<" + v.Width + " x " + v.Height + ">F"); } else if (value is Spherical) { var s = (Spherical)value; return("<" + s.Theta + " x " + s.Phi + ">"); } return(value.ToString()); }
public static Spherical FromGrades(float theta, float pi) { return(new Spherical(Euler.ToRadians(theta), Euler.ToRadians(pi))); }