public static Type TypeFromShape(ShapeWarp shape) { switch (shape) { case ShapeWarp.Cubic: return(typeof(Cubic)); case ShapeWarp.Cylinder: return(typeof(Cylindrical)); case ShapeWarp.Plane: return(typeof(Planar)); case ShapeWarp.Sphere: return(typeof(Spherical)); case ShapeWarp.Torus: return(typeof(Toroidal)); case ShapeWarp.Default: return(null); default: return(null); } }
public static Warp FromShape(ShapeWarp shape) { Type type = TypeFromShape(shape); if (type == null) { return(null); } else { return(Activator.CreateInstance(type) as Warp); } }