Program Listing for File collection.hxx

Return to documentation for file (src/acme/collection.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_COLLECTION_HXX
#define INCLUDE_ACME_COLLECTION_HXX

#include "AABBtree.hxx"
#include "entity.hxx"
#include "intersection.hxx"

namespace acme
{

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


  class collection
  {
  private:
    entity::vecptr m_entities;
    AABBtree::ptr  m_AABBtree;

  public:
    collection(collection const &) = default;

    collection(collection &&) = default;

    collection(void);

    collection(
      entity::vecptr & entities
    );

    void
    clear(void);

    void
    resize(
      integer size
    );

    void
    push_back(
      entity::ptr entity
    );

    entity::ptr &
    operator[](
      integer i
    );

    entity::ptr const &
    operator[](
      integer i
    ) const;

    void
    translate(
      vec3 const & input
    );

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

    void
    rotate(
      real                angle,
      std::string const & axis
    );

    void
    transform(
      affine const & matrix
    );

    bool
    containNone(void)
    const;

    bool
    areNone(void)
    const;

    bool
    isNone(
      integer i
    ) const;

    void
    removeNone(void);

    integer
    countNone(void)
    const;

    bool
    containPoint(void)
    const;

    bool
    arePoint(void)
    const;

    bool
    isPoint(
      integer i
    ) const;

    void
    removePoint(void);

    integer
    countPoint(void)
    const;

    bool
    containLine(void)
    const;

    bool
    areLine(void)
    const;

    bool
    isLine(
      integer i
    ) const;

    void
    removeLine(void);

    integer
    countLine(void)
    const;

    bool
    containRay(void)
    const;

    bool
    areRay(void)
    const;

    bool
    isRay(
      integer i
    ) const;

    void
    removeRay(void);

    integer
    countRay(void)
    const;

    bool
    containPlane(void)
    const;

    bool
    arePlane(void)
    const;

    bool
    isPlane(
      integer i
    ) const;

    void
    removePlane(void);

    integer
    countPlane(void)
    const;

    bool
    containSegment(void)
    const;

    bool
    areSegment(void)
    const;

    bool
    isSegment(
      integer i
    ) const;

    void
    removeSegment(void);

    integer
    countSegment(void)
    const;

    bool
    containTriangle(void)
    const;

    bool
    areTriangle(void)
    const;

    bool
    isTriangle(
      integer i
    ) const;

    void
    removeTriangle(void);

    integer
    countTriangle(void)
    const;

    bool
    containDisk(void)
    const;

    bool
    areDisk(void)
    const;

    bool
    isDisk(
      integer i
    ) const;

    void
    removeDisk(void);

    integer
    countDisk(void)
    const;

    bool
    containBall(void)
    const;

    bool
    areBall(void)
    const;

    bool
    isBall(
      integer i
    ) const;

    void
    removeBall(void);

    integer
    countBall(void)
    const;

    bool
    containDegenerated(
      real tolerance = EPSILON
    ) const;

    bool
    areDegenerated(
      real tolerance = EPSILON
    ) const;

    bool
    isDegenerated(
      integer i,
      real    tolerance = EPSILON
    ) const;

    void
    removeDegenerated(
      real tolerance = EPSILON
    );

    integer
    countDegenerated(
      real tolerance = EPSILON
    ) const;

    bool
    containClampable(void)
    const;

    bool
    areClampable(void)
    const;

    bool
    isClampable(
      integer i
    ) const;

    void
    removeClampable(void);

    integer
    countClampable(void)
    const;

    bool
    containNonClampable(void)
    const;

    bool
    areNonClampable(void)
    const;

    bool
    isNonClampable(
      integer i
    ) const;

    void
    removeNonClampable(void);

    integer
    countNonClampable(void)
    const;

    integer
    size(void)
    const;

    std::map<std::string, integer>
    count(
      real tolerance = EPSILON
    ) const;

    void
    clamp(
      aabb::vecptr & boxes
    ) const;

    void
    buildAABBtree(void);

    AABBtree::ptr const &
    ptrAABBtree(void);

    bool
    intersection(
      collection & entities,
      collection & candidates
    ) const;

    bool
    intersection(
      AABBtree::ptr const & AABBtree,
      collection          & entities
    ) const;

    bool
    intersection(
      aabb::vecptr const & boxes,
      collection         & entities
    ) const;

    bool
    intersection(
      aabb::ptr  const   box,
      collection       & entities
    ) const;

    void
    intersection(
      collection & entities,
      real         tolerance = EPSILON
    ) const;

  }; // class collection

} // namespace acme

#endif