// *** CONSTRUCTOR *** /// <summary> /// Initializes a new instance of the Cube3D class /// </summary> /// <param name="location">Center point</param> /// <param name="scale">Scale</param> /// <param name="position">Position</param> /// <param name="faces">Faces</param> public Cube3D(Point3D location, double scale, CubeFlag position, IEnumerable <Face> faces) { this.Faces = UniCube.GenFaces3D(position); this.Position = position; this.Location = location; this.Scale = scale; this.Faces.ToList().ForEach(f => { f.Color = faces.First(face => face.Position == f.Position).Color; f.Vertices.ToList().ForEach(e => { e.X *= scale; e.Y *= scale; e.Z *= scale; //scale e.X += location.X; e.Y += location.Y; e.Z += location.Z; //translate }); }); }
/// <summary> /// Constructor with the position (the faces will be generated) /// </summary> /// <param name="position">Defines the position of the cube</param> public Cube(CubeFlag position) : this(UniCube.GenFaces(), position) { }