using System.Collections.Generic;
using System.Drawing;

using Spark3D.Algebra3D;

namespace Spark3D.Objects3D.Shapes
{
    public class Octahedron : Object3DCommon, IObject3D
    {
        public Octahedron(double size)
            : base(MakeFaces(size / 2.0))
        {
        }
        static IList<Polygon3D> MakeFaces(double r)
        {
            IList<Polygon3D> ret = new List<Polygon3D>();
            for (int ix = -1; ix <= 1; ix += 2)
                for (int iy = -1; iy <= 1; iy += 2)
                    for (int iz = -1; iz <= 1; iz += 2)
                        ret.Add(
                new Polygon3D(
                new Vector3D[] 
                {
                     new Vector3D( ix*r, 0   , 0),
                     new Vector3D( 0   , iy*r, 0),
                     new Vector3D( 0   , 0   , iz*r),
                }, Color.Blue));

            return ret;
        }
    }


}
