//  ************************************************************************************************
//
//  BornAgain: simulate and fit reflection and scattering
//
//! @file      Sample/HardParticle/Polyhedra.cpp
//! @brief     Implements polyhedron classes (Box, prisms, pyramids, and platonic solids).
//!
//! @homepage  http://www.bornagainproject.org
//! @license   GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
//  ************************************************************************************************

#include "Sample/HardParticle/Polyhedra.h"
#include <ff/Make.h>

//  ************************************************************************************************
//  Prisms
//  ************************************************************************************************

Box::Box(double length, double width, double height)
    : FormfactorPrism()
    , m_length(length)
    , m_width(width)
    , m_height(height)
{
    pimpl.reset(ff::make::Box(m_length, m_width, m_height));
    validate();
}


Prism3::Prism3(double base_edge, double height)
    : FormfactorPrism()
    , m_base_edge(base_edge)
    , m_height(height)
{
    pimpl.reset(ff::make::Prism3(m_base_edge, m_height));
    validate();
}


Prism6::Prism6(double base_edge, double height)
    : FormfactorPrism()
    , m_base_edge(base_edge)
    , m_height(height)
{
    pimpl.reset(ff::make::Prism6(m_base_edge, m_height));
    validate();
}

//  ************************************************************************************************
//  Platonic solids
//  ************************************************************************************************

PlatonicTetrahedron::PlatonicTetrahedron(double edge)
    : FormfactorPolyhedron()
    , m_edge(edge)
{
    pimpl.reset(ff::make::Tetrahedron(m_edge));
    validate();
}


PlatonicOctahedron::PlatonicOctahedron(double edge)
    : FormfactorPolyhedron()
    , m_edge(edge)
{
    pimpl.reset(ff::make::Octahedron(m_edge));
    validate();
}


Dodecahedron::Dodecahedron(double edge)
    : FormfactorPolyhedron()
    , m_edge(edge)
{
    pimpl.reset(ff::make::Dodecahedron(m_edge));
    validate();
}


Icosahedron::Icosahedron(double edge)
    : FormfactorPolyhedron()
    , m_edge(edge)
{
    pimpl.reset(ff::make::Icosahedron(m_edge));
    validate();
}

//  ************************************************************************************************
//  Pyramids
//  ************************************************************************************************

Pyramid2::Pyramid2(double length, double width, double height, double alpha)
    : FormfactorPolyhedron()
    , m_length(length)
    , m_width(width)
    , m_height(height)
    , m_alpha(alpha)
{
    pimpl.reset(ff::make::Pyramid2(m_length, m_width, m_height, m_alpha));
    validate();
}


Pyramid3::Pyramid3(double base_edge, double height, double alpha)
    : FormfactorPolyhedron()
    , m_base_edge(base_edge)
    , m_height(height)
    , m_alpha(alpha)
{
    pimpl.reset(ff::make::Pyramid3(m_base_edge, m_height, m_alpha));
    validate();
}


Pyramid4::Pyramid4(double base_edge, double height, double alpha)
    : FormfactorPolyhedron()
    , m_base_edge(base_edge)
    , m_height(height)
    , m_alpha(alpha)
{
    pimpl.reset(ff::make::Pyramid4(m_base_edge, m_height, m_alpha));
    validate();
}


Pyramid6::Pyramid6(double base_edge, double height, double alpha)
    : FormfactorPolyhedron()
    , m_base_edge(base_edge)
    , m_height(height)
    , m_alpha(alpha)
{
    pimpl.reset(ff::make::Pyramid6(m_base_edge, m_height, m_alpha));
    validate();
}


Bipyramid4::Bipyramid4(double length, double base_height, double height_ratio, double alpha)
    : FormfactorPolyhedron()
    , m_length(length)
    , m_base_height(base_height)
    , m_height_ratio(height_ratio)
    , m_alpha(alpha)
{
    pimpl.reset(ff::make::Bipyramid4(m_length, m_base_height, m_height_ratio, m_alpha));
    validate();
}

//  ************************************************************************************************
//  Others
//  ************************************************************************************************

CantellatedCube::CantellatedCube(double length, double removed_length)
    : FormfactorPolyhedron()
    , m_length(length)
    , m_removed_length(removed_length)
{
    pimpl.reset(ff::make::CantellatedCube(m_length, m_removed_length));
    validate();
}


TruncatedCube::TruncatedCube(double length, double removed_length)
    : FormfactorPolyhedron()
    , m_length(length)
    , m_removed_length(removed_length)
{
    pimpl.reset(ff::make::TruncatedCube(m_length, m_removed_length));
    validate();
}
