Commit 48154f44 authored by Dennis Gläser's avatar Dennis Gläser
Browse files

[isection] add face-quadrilateral algo

parent 2684791b
......@@ -6,6 +6,7 @@ algo_disk_disk.hh
algo_disk_line.hh
algo_face_disk.hh
algo_face_planargeom.hh
algo_face_quadrilateral.hh
algo_find_touching_points.hh
algo_planargeom_line.hh
algo_planargeom_planargeom.hh
......
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*****************************************************************************
* See the file COPYING for full copying permissions. *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
* \brief Contains the intersection algorithm
* between a face shape and a quadrilateral in 3d space.
*/
#ifndef FRACKIT_FACE_QUADRILATERAL_INTERSECTION_HH
#define FRACKIT_FACE_QUADRILATERAL_INTERSECTION_HH
#include "algo_face_planargeom.hh"
#include "intersectiontraits.hh"
namespace Frackit {
namespace IntersectionAlgorithms {
//! Intersect a face shape and a quadrilateral in 3d space.
//! The result can be composed of:
//! - points
//! - edges
//! - faces
//! Multiple of the above are possible
//! since the face shape might be curved.
template<class ctype>
Intersection< TopoDS_Face, Quadrilateral<ctype, 3> >
intersect_face_quadrilateral(const TopoDS_Face& face,
const Quadrilateral<ctype, 3>& quad,
ctype eps)
{ return intersect_face_planarGeometry(face, quad, eps); }
} // end namespace IntersectionAlgorithms
} // end namespace Frackit
#endif // FRACKIT_FACE_QUADRILATERAL_INTERSECTION_HH
......@@ -50,6 +50,7 @@
#include "algo_cylsurface_quadrilateral.hh"
#include "algo_shell_disk.hh"
#include "algo_face_disk.hh"
#include "algo_face_quadrilateral.hh"
namespace Frackit {
......@@ -308,6 +309,28 @@ Intersection< TopoDS_Face, Disk<ctype> >
intersect(const TopoDS_Face& face, const Disk<ctype>& disk, ctype eps)
{ return intersect(disk, face, eps); }
/*!
* \brief Intersect a quadrilateral and a face shape.
* \param quad The quadrilateral
* \param face The face shape
* \param eps Tolerance to be used for floating point comparisons
*/
template<class ctype>
Intersection< Quadrilateral<ctype, 3>, TopoDS_Face >
intersect(const Quadrilateral<ctype, 3>& quad, const TopoDS_Face& face, ctype eps)
{ return IntersectionAlgorithms::intersect_face_quadrilateral(face, quad, eps); }
/*!
* \brief Intersect a face shape and a quadrilateral.
* \param face The face shape
* \param quad The quadrilateral
* \param eps Tolerance to be used for floating point comparisons
*/
template<class ctype>
Intersection< TopoDS_Face, Quadrilateral<ctype, 3> >
intersect(const TopoDS_Face& face, const Quadrilateral<ctype, 3>& quad, ctype eps)
{ return intersect(quad, face, eps); }
} // end namespace Frackit
#endif // FRACKIT_INTERSECT_HH
......@@ -227,16 +227,18 @@ struct IntersectionTraits< Disk<ctype>, TopoDS_Shell >
: public IntersectionTraits< TopoDS_Shell, Disk<ctype> >
{};
namespace IntersectionDetail {
template<class ctype>
using FaceIntersectionWith2d = std::vector< std::variant< Point<ctype, 3>,
TopoDS_Edge,
TopoDS_Face,
EmptyIntersection<3> > >;
} // end namespace IntersectionDetail
//! Result type of the intersection of a face and a disk
template<class ctype>
struct IntersectionTraits< TopoDS_Face, Disk<ctype> >
{
using BaseType = std::variant< Point<ctype, 3>,
TopoDS_Edge,
TopoDS_Face,
EmptyIntersection<3> >;
using type = std::vector<BaseType>;
};
{ using type = IntersectionDetail::FaceIntersectionWith2d<ctype>; };
//! Result type of the intersection of a disk and a face
template<class ctype>
......@@ -244,6 +246,17 @@ struct IntersectionTraits< Disk<ctype>, TopoDS_Face >
: public IntersectionTraits< TopoDS_Face, Disk<ctype> >
{};
//! Result type of the intersection of a quadrilateral and a face
template<class ctype>
struct IntersectionTraits< Quadrilateral<ctype, 3>, TopoDS_Face >
{ using type = IntersectionDetail::FaceIntersectionWith2d<ctype>; };
//! Result type of the intersection of a face and a quadrilateral
template<class ctype>
struct IntersectionTraits< TopoDS_Face, Quadrilateral<ctype, 3> >
: public IntersectionTraits< Quadrilateral<ctype, 3>, TopoDS_Face >
{};
} // end namespace Frackit
#endif // FRACKIT_INTERSECTION_TRAITS_HH
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment