Program Listing for File intersection.hxx

Return to documentation for file (src/acme/intersection.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_Intersection_HXX
#define INCLUDE_ACME_Intersection_HXX

#include "aabb.hxx"
#include "ball.hxx"
#include "collinear.hxx"
#include "coplanar.hxx"
#include "disk.hxx"
#include "line.hxx"
#include "none.hxx"
#include "plane.hxx"
#include "ray.hxx"
#include "segment.hxx"
#include "triangle.hxx"

namespace acme
{

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

  entity *
  Intersection(
    entity const * entity0_in,
    entity const * entity1_in,
    real           tolerance = EPSILON
  );

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

  bool
  Intersection(
    point const & point0_in,
    point const & point1_in,
    point       & point_out = DUMMY_POINT,
    real          tolerance = EPSILON
  );

  bool
  Intersection(
    point const & point_in,
    line  const & line_in,
    point       & point_out = DUMMY_POINT,
    real          tolerance = EPSILON
  );

  bool
  Intersection(
    point const & point_in,
    ray   const & ray_in,
    point       & point_out = DUMMY_POINT,
    real          tolerance = EPSILON
  );

  bool
  Intersection(
    point const & point_in,
    plane const & plane_in,
    point       & point_out = DUMMY_POINT,
    real          tolerance = EPSILON
  );

  bool
  Intersection(
    point   const & point_in,
    segment const & segment_in,
    point         & point_out = DUMMY_POINT,
    real            tolerance = EPSILON
  );

  bool
  Intersection(
    point    const & point_in,
    triangle const & triangle_in,
    point          & point_out = DUMMY_POINT,
    real             tolerance = EPSILON
  );

  bool
  Intersection(
    point const & point_in,
    disk  const & disk_in,
    point       & point_out = DUMMY_POINT,
    real          tolerance = EPSILON
  );

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

  bool
  Intersection(
    line const & line0_in,
    line const & line1_in,
    line       & line_out  = DUMMY_LINE,
    real         tolerance = EPSILON
  );

  bool
  Intersection(
    ray  const & ray0_in,
    ray  const & ray1_in,
    ray        & ray_out   = DUMMY_RAY,
    real         tolerance = EPSILON
  );

  bool
  Intersection(
    ray     const & ray0_in,
    ray     const & ray1_in,
    segment       & segment_out = DUMMY_SEGMENT,
    real            tolerance   = EPSILON
  );

  bool
  Intersection(
    segment const & segment0_in,
    segment const & segment1_in,
    segment       & segment_out = DUMMY_SEGMENT,
    real            tolerance   = EPSILON
  );

  bool
  Intersection(
    line const & line_in,
    ray  const & ray_in,
    ray        & ray_out   = DUMMY_RAY,
    real         tolerance = EPSILON
  );

  bool
  Intersection(
    line    const & line_in,
    segment const & segment_in,
    segment       & segment_out = DUMMY_SEGMENT,
    real            tolerance   = EPSILON
  );

  bool
  Intersection(
    ray     const & ray_in,
    segment const & segment_in,
    segment       & segment_out = DUMMY_SEGMENT,
    real            tolerance   = EPSILON
  );

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

  bool
  Intersection(
    line  const & line0_in,
    line  const & line1_in,
    point       & point_out = DUMMY_POINT,
    real          tolerance = EPSILON
  );

  bool
  Intersection(
    ray   const & ray0_in,
    ray   const & ray1_in,
    point       & point_out = DUMMY_POINT,
    real          tolerance = EPSILON
  );

  bool
  Intersection(
    segment const & segment0_in,
    segment const & segment1_in,
    point         & point_out = DUMMY_POINT,
    real            tolerance = EPSILON
  );

  bool
  Intersection(
    line  const & line_in,
    ray   const & ray_in,
    point       & point_out = DUMMY_POINT,
    real          tolerance = EPSILON
  );

  bool
  Intersection(
    line    const & line_in,
    segment const & segment,
    point         & point_out = DUMMY_POINT,
    real            tolerance = EPSILON
  );

  bool
  Intersection(
    ray     const & ray_in,
    segment const & segment,
    point         & point_out = DUMMY_POINT,
    real            tolerance = EPSILON
  );

  /*\
   |    ____            _
   |   / ___|___  _ __ | | __ _ _ __   __ _ _ __
   |  | |   / _ \| '_ \| |/ _` | '_ \ / _` | '__|
   |  | |__| (_) | |_) | | (_| | | | | (_| | |
   |   \____\___/| .__/|_|\__,_|_| |_|\__,_|_|
   |             |_|
  \*/

  bool
  Intersection(
    plane const & plane0_in,
    plane const & plane1_in,
    plane       & plane_out = DUMMY_PLANE,
    real          tolerance = EPSILON
  );

  bool
  Intersection(
    triangle const & triangle0_in,
    triangle const & triangle1_in,
    none           & none_out  = DUMMY_NONE,
    real             tolerance = EPSILON
  );

  bool
  Intersection(
    disk const & disk0_in,
    disk const & disk1_in,
    none       & none_out  = DUMMY_NONE,
    real         tolerance = EPSILON
  );

  bool
  Intersection(
    line  const & line_in,
    plane const & plane_in,
    line        & line_out  = DUMMY_LINE,
    real          tolerance = EPSILON
  );

  bool
  Intersection(
    line     const & line_in,
    triangle const & triangle_in,
    segment        & segment_out = DUMMY_SEGMENT,
    real             tolerance   = EPSILON
  );

  bool
  Intersection(
    line    const & line_in,
    disk    const & disk_in,
    segment       & segment_out = DUMMY_SEGMENT,
    real            tolerance   = EPSILON
  );

  bool
  Intersection(
    ray   const & ray_in,
    plane const & plane_in,
    ray         & ray_out   = DUMMY_RAY,
    real          tolerance = EPSILON
  );

  bool
  Intersection(
    ray      const & ray_in,
    triangle const & triangle_in,
    segment        & segment_out = DUMMY_SEGMENT,
    real             tolerance   = EPSILON
  );

  bool
  Intersection(
    ray     const & ray_in,
    disk    const & disk_in,
    segment       & segment_out = DUMMY_SEGMENT,
    real            tolerance   = EPSILON
  );

  bool
  Intersection(
    plane   const & plane_in,
    segment const & segment_in,
    segment       & segment_out = DUMMY_SEGMENT,
    real            tolerance   = EPSILON
  );

  bool
  Intersection(
    plane    const & plane_in,
    triangle const & triangle_in,
    triangle       & triangle_out = DUMMY_TRIANGLE,
    real             tolerance    = EPSILON
  );

  bool
  Intersection(
    plane const & plane_in,
    disk  const & disk_in,
    disk        & disk_out  = DUMMY_DISK,
    real          tolerance = EPSILON
  );

  bool
  Intersection(
    segment  const & segment_in,
    triangle const & triangle_in,
    segment        & segment_out = DUMMY_SEGMENT,
    real             tolerance   = EPSILON
  );

  bool
  Intersection(
    segment const & segment_in,
    disk    const & disk_in,
    segment       & segment_out = DUMMY_SEGMENT,
    real            tolerance   = EPSILON
  );

  bool
  Intersection(
    triangle const & triangle_in,
    disk     const & disk_in,
    none           & none_out  = DUMMY_NONE,
    real             tolerance = EPSILON
  );

  /*\
   |   _   _              ____            _
   |  | \ | | ___  _ __  / ___|___  _ __ | | __ _ _ __   __ _ _ __
   |  |  \| |/ _ \| '_ \| |   / _ \| '_ \| |/ _` | '_ \ / _` | '__|
   |  | |\  | (_) | | | | |__| (_) | |_) | | (_| | | | | (_| | |
   |  |_| \_|\___/|_| |_|\____\___/| .__/|_|\__,_|_| |_|\__,_|_|
   |                               |_|
  \*/

  bool
  Intersection(
    plane const & plane0_in,
    plane const & plane1_in,
    line        & line_out  = DUMMY_LINE,
    real          tolerance = EPSILON
  );

  bool
  Intersection(
    plane const & plane0_in,
    plane const & plane1_in,
    plane const & plane2_in,
    point       & point_out = DUMMY_POINT,
    real          tolerance = EPSILON
  );

  bool
  Intersection(
    triangle const & triangle0_in,
    triangle const & triangle1_in,
    segment        & segment_out = DUMMY_SEGMENT,
    real             tolerance   = EPSILON
  );

  bool
  Intersection(
    disk    const & disk0_in,
    disk    const & disk1_in,
    segment       & segment_out = DUMMY_SEGMENT,
    real            tolerance   = EPSILON
  );

  bool
  Intersection(
    ball const & ball0_in,
    ball const & ball1_in,
    none       & none_out  = DUMMY_NONE,
    real         tolerance = EPSILON
  );

  bool
  Intersection(
    line  const & line_in,
    plane const & plane_in,
    point       & point_out = DUMMY_POINT,
    real          tolerance = EPSILON
  );

  bool
  Intersection(
    line     const & line_in,
    triangle const & triangle_in,
    point          & point_out = DUMMY_POINT,
    real             tolerance = EPSILON
  );

  bool
  Intersection(
    line  const & line_in,
    disk  const & disk_in,
    point       & point_out = DUMMY_POINT,
    real          tolerance = EPSILON
  );

  bool
  Intersection(
    line    const & line_in,
    ball    const & ball_in,
    segment       & segment_out = DUMMY_SEGMENT,
    real            tolerance   = EPSILON
  );

  bool
  Intersection(
    ray   const & ray_in,
    plane const & plane_in,
    point       & point_out = DUMMY_POINT,
    real          tolerance = EPSILON
  );

  bool
  Intersection(
    ray      const & ray_in,
    triangle const & triangle_in,
    point          & point_out = DUMMY_POINT,
    real             tolerance = EPSILON
  );

  bool
  Intersection(
    ray   const & ray_in,
    disk  const & disk_in,
    point       & point_out = DUMMY_POINT,
    real          tolerance = EPSILON
  );

  bool
  Intersection(
    ray     const & ray_in,
    ball    const & ball_in,
    segment       & segment_out = DUMMY_SEGMENT,
    real            tolerance   = EPSILON
  );

  bool
  Intersection(
    plane   const & plane_in,
    segment const & segment,
    point         & point_out = DUMMY_POINT,
    real            tolerance = EPSILON
  );

  bool
  Intersection(
    plane    const & plane_in,
    triangle const & triangle_in,
    segment        & segment_out = DUMMY_SEGMENT,
    real             tolerance   = EPSILON
  );

  bool
  Intersection(
    plane   const & plane_in,
    disk    const & disk_in,
    segment       & segment_out = DUMMY_SEGMENT,
    real            tolerance   = EPSILON
  );

  bool
  Intersection(
    plane const & plane_in,
    ball  const & ball_in,
    disk        & disk_out  = DUMMY_DISK,
    real          tolerance = EPSILON
  );

  bool
  Intersection(
    segment  const & segment_in,
    triangle const & triangle_in,
    point          & point_out = DUMMY_POINT,
    real             tolerance = EPSILON
  );

  bool
  Intersection(
    segment const & segment_in,
    disk    const & disk_in,
    point         & point_out = DUMMY_POINT,
    real            tolerance = EPSILON
  );

  bool
  Intersection(
    segment const & segment_in,
    ball    const & ball_in,
    segment       & segment_out = DUMMY_SEGMENT,
    real            tolerance   = EPSILON
  );

  bool
  Intersection(
    triangle const & triangle_in,
    disk     const & disk_in,
    segment        & segment_out = DUMMY_SEGMENT,
    real             tolerance   = EPSILON
  );

  bool
  Intersection(
    triangle const & triangle_in,
    ball     const & ball_in,
    none           & none_out  = DUMMY_NONE,
    real             tolerance = EPSILON
  );

  bool
  Intersection(
    disk const & disk_in,
    ball const & ball_in,
    none       & none_out  = DUMMY_NONE,
    real         tolerance = EPSILON
  );

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

  bool
  Intersection(
    aabb const & aabb0_in,
    aabb const & aabb1_in,
    aabb       & aabb_out  = DUMMY_AABB,
    real         tolerance = EPSILON
  );

} // namespace acme

#endif