Program Listing for File entity.hxx

Return to documentation for file (src/acme/entity.hxx)

/*
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *                                                                     *
 * The ACME project                                                    *
 *                                                                     *
 * Copyright (c) 2020, Davide Stocco and Enrico Bertolazzi.            *
 *                                                                     *
 * The ACME project and its components are supplied under the terms of *
 * the open source BSD 2-Clause License. The contents of the ACME      *
 * project and its components may not be copied or disclosed except in *
 * accordance with the terms of the BSD 2-Clause License.              *
 *                                                                     *
 * URL: https://opensource.org/licenses/BSD-2-Clause                   *
 *                                                                     *
 *    Davide Stocco                                                    *
 *    Department of Industrial Engineering                             *
 *    University of Trento                                             *
 *    e-mail: davide.stocco@unitn.it                                   *
 *                                                                     *
 *    Enrico Bertolazzi                                                *
 *    Department of Industrial Engineering                             *
 *    University of Trento                                             *
 *    e-mail: enrico.bertolazzi@unitn.it                               *
 *                                                                     *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*/


#pragma once
#ifndef INCLUDE_ACME_ENTITY_HXX
#define INCLUDE_ACME_ENTITY_HXX

namespace acme
{

  /*\
   |              _   _ _
   |    ___ _ __ | |_(_) |_ _   _
   |   / _ \ '_ \| __| | __| | | |
   |  |  __/ | | | |_| | |_| |_| |
   |   \___|_| |_|\__|_|\__|\__, |
   |                        |___/
  \*/


  class entity
  {
  public:
    typedef std::shared_ptr<entity> ptr;
    typedef std::vector<ptr>        vecptr;

    entity(entity const &) = default;

    entity(entity &&) = default;

    entity & operator=(const entity &) = default;

    entity & operator=(entity &&) = default;

    virtual
    ~entity(void);

    entity(void);

    virtual
    void
    translate(
      vec3 const & input
    ) = 0;

    virtual void
    transform(
      affine const & matrix
    ) = 0;

    void
    rotate(
      real         angle,
      vec3 const & axis
    );

    virtual
    inline
    bool
    isDegenerated(
      real tolerance = EPSILON
    ) const = 0;

    virtual
    inline
    integer
    level(void)
    const = 0;

    virtual
    inline
    std::string
    type(void)
    const = 0;

    inline
    bool
    isEntity(void)
    const
    {
      return true;
    }

    virtual
    inline
    bool
    isNone(void)
    const = 0;

    virtual
    inline
    bool
    isPoint(void)
    const = 0;

    virtual
    inline
    bool
    isLine(void)
    const = 0;

    virtual
    inline
    bool
    isRay(void)
    const = 0;

    virtual
    inline
    bool
    isPlane(void)
    const = 0;

    virtual
    inline
    bool
    isSegment(void)
    const = 0;

    virtual
    inline
    bool
    isTriangle(void)
    const = 0;

    virtual
    inline
    bool
    isDisk(void)
    const = 0;

    virtual
    inline
    bool
    isBall(void)
    const = 0;

    virtual
    inline
    bool
    isClampable(void)
    const = 0;

    virtual
    inline
    bool
    isNonClampable(void)
    const = 0;

    virtual bool
    clamp(
      vec3 & min,
      vec3 & max
    ) const = 0;

    virtual bool
    clamp(
      real & min_x,
      real & min_y,
      real & min_z,
      real & max_x,
      real & max_y,
      real & max_z
    ) const = 0;

  }; // class entity

} // namespace acme

#endif