/// <summary> /// Generates a 3D Model for a cuboid /// </summary> /// <param name="Name">Model name</param> /// <param name="u">Length of the lower part</param> /// <param name="v">Length of the high part</param> /// <param name="numberOfPoints">Number of points to use in circumference</param> /// <param name="Color">Color vector</param> /// <param name="Texture">Texture bitmap. Null uses no texture</param> /// <returns></returns> public static Model3D Cuboid(string Name, float u, float v, int numberOfPoints, Vector3d Color, System.Drawing.Bitmap Texture) { List <Vertex> points = Vertices.CreateCuboid(u, v, numberOfPoints); Vertices.SetColorOfListTo(points, Color); Model3D myModel = new Model3D(); myModel.Create3DModel("Cube", points); return(myModel); }
/// <summary> /// Generates a 3D Model for a cuboid, by setting all lines with points /// </summary> /// <param name="Name">Model name</param> /// <param name="u">Length of the lower part</param> /// <param name="v">Length of the high part</param> /// <param name="numberOfPoints">Number of points to use in circumference</param> /// <param name="Color">Color vector</param> /// <param name="Texture">Texture bitmap. Null uses no texture</param> /// <returns></returns> public static Model3D Cuboid_AllLines(string Name, float u, float v, int numberOfPoints, Vector3d Color, System.Drawing.Bitmap Texture) { List <Vertex> points = new List <Vertex>(); float u0 = 0f; float v0 = 0f; for (int i = 0; i < numberOfPoints; i++) { points.Add(new Vertex(u0, 0, 0)); points.Add(new Vertex(0, 0, u0)); points.Add(new Vertex(u0, 0, u)); points.Add(new Vertex(u, 0, u0)); points.Add(new Vertex(0, v0, 0)); points.Add(new Vertex(0, v0, u)); points.Add(new Vertex(u, v0, u)); points.Add(new Vertex(u, v0, 0)); points.Add(new Vertex(u0, v, 0)); points.Add(new Vertex(0, v, u0)); points.Add(new Vertex(u0, v, u)); points.Add(new Vertex(u, v, u0)); u0 += u / 100; v0 += v / 100; } Vertices.SetColorOfListTo(points, Color); Model3D myModel = new Model3D(); myModel.Create3DModel("Cube", points); return(myModel); }