Program Listing for File rib.hxx

Return to documentation for file (src/enve/rib.hxx)

/*
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *                                                                     *
 * The ENVE project                                                    *
 *                                                                     *
 * Copyright (c) 2020, Davide Stocco and Enrico Bertolazzi.            *
 *                                                                     *
 * The ENVE project and its components are supplied under the terms of *
 * the open source BSD 3-Clause License. The contents of the ENVE      *
 * project and its components may not be copied or disclosed except in *
 * accordance with the terms of the BSD 3-Clause License.              *
 *                                                                     *
 * URL: https://opensource.org/licenses/BSD-3-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                               *
 *                                                                     *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*/


#ifndef INCLUDE_ENVE_RIB_HXX
#define INCLUDE_ENVE_RIB_HXX

#include "triangleground.hxx"
#include "mesh.hxx"
#include "flat.hxx"
#include "output.hxx"

namespace enve
{

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

  class rib : public disk
  {
  private:
    integer m_id;
    real    m_y;
    real    m_width;
    real    m_angle;

  public:
    rib(rib const &) = default;

    rib(rib &&) = default;

    rib & operator=(const rib &) = delete;

    rib & operator=(rib &&) = delete;

    ~rib(void) override = default;

    rib(void);

    rib(
      integer id,
      real    radius,
      real    y,
      real    width,
      real    angle
    );

    void
    copy(
      rib const & rib_obj
    );

    bool
    isApprox(
      rib  const & rib_obj,
      real         tolerance = EPSILON_LOW
    ) const;

    integer &
    id(void);

    integer const &
    id(void)
    const;

    real &
    width(void);

    real const &
    width(void)
    const;

    real &
    angle(void);

    real const &
    angle(void)
    const;

    bool
    envelop(
      affine const & pose,
      output       & out
    ) const;

    bool
    envelop(
      triangleground::vecptr const & ground,
      affine                 const & pose,
      std::string            const   method,
      output                       & out
    ) const;

    bool
    envelop(
      ground::flat const & ground,
      affine       const & pose,
      std::string  const   method,
      output             & out
    ) const;

  private:
    bool
    envelopGeometric(
      triangleground::vecptr const & ground,
      affine                 const & pose,
      output                       & out
    ) const;

    bool
    envelopGeometric(
      ground::flat const & ground,
      affine       const & pose,
      output             & out
    ) const;

    bool
    envelopSampling(
      triangleground::vecptr const & ground,
      affine                 const & pose,
      output                       & out
    ) const;

    bool
    envelopSampling(
      ground::flat const & ground,
      affine       const & pose,
      output             & out
    ) const;

    bool
    samplingLine(
      triangleground::vecptr const & ground,
      line                   const & sampling_line,
      point                        & contact_point,
      real                         & contact_friction
    ) const;

    bool
    samplingLine(
      ground::flat const & ground,
      line         const & sampling_line,
      point              & contact_point,
      real               & contact_friction
    ) const;

  }; // class rib

} // namespace enve

#endif