/*============================================================================

The Medical Imaging Interaction Toolkit (MITK)

Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.

Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.

============================================================================*/

#ifndef mitkCuboid_h
#define mitkCuboid_h

#include <MitkDataTypesExtExports.h>
#include <mitkBoundingObject.h>

namespace mitk
{
  /**
   * \brief Bounding object shaped as a cuboid (axis-aligned box).
   *
   * The cuboid has side length 2 in each axis, centered at the origin.
   * The surface is generated by vtkCubeSource. Volume is computed as
   * width * height * depth from the geometry extents.
   *
   * \sa BoundingObject, Cone, Cylinder, Ellipsoid
   * \ingroup Data
   */
  class MITKDATATYPESEXT_EXPORT Cuboid : public BoundingObject
  {
  public:
    mitkClassMacro(Cuboid, BoundingObject);
    itkFactorylessNewMacro(Self);
    itkCloneMacro(Self);

    /**
     * \brief Calculate the cuboid volume from the geometry extents.
     * \return The volume in world-coordinate units cubed.
     */
    mitk::ScalarType GetVolume() override;

    /**
     * \brief Test whether a world-coordinate point lies inside the cuboid.
     *
     * The point is transformed to object coordinates and checked against
     * the [-1, 1] bounds on each axis.
     *
     * \param[in] p The point in world coordinates.
     * \return true if the point is inside.
     */
    bool IsInside(const Point3D &p) const override;

  protected:
    Cuboid();
    ~Cuboid() override;
  };
}
#endif
