|
| 1 | +// The libMesh Finite Element Library. |
| 2 | +// Copyright (C) 2002-2022 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner |
| 3 | + |
| 4 | +// This library is free software; you can redistribute it and/or |
| 5 | +// modify it under the terms of the GNU Lesser General Public |
| 6 | +// License as published by the Free Software Foundation; either |
| 7 | +// version 2.1 of the License, or (at your option) any later version. |
| 8 | + |
| 9 | +// This library is distributed in the hope that it will be useful, |
| 10 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | +// Lesser General Public License for more details. |
| 13 | + |
| 14 | +// You should have received a copy of the GNU Lesser General Public |
| 15 | +// License along with this library; if not, write to the Free Software |
| 16 | +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | +#ifndef LIBMESH_INTERSECTIONTOOLS_H |
| 21 | +#define LIBMESH_INTERSECTIONTOOLS_H |
| 22 | + |
| 23 | +#include "libmesh/libmesh_common.h" |
| 24 | + |
| 25 | +namespace libMesh |
| 26 | +{ |
| 27 | + |
| 28 | +class Point; |
| 29 | + |
| 30 | +namespace IntersectionTools |
| 31 | +{ |
| 32 | + |
| 33 | +/** |
| 34 | + * Checks whether or not a point is within a line segment |
| 35 | + * @param s1 The first point on the segment |
| 36 | + * @param s2 The second point on the segment |
| 37 | + * @param length The segment length (for optimization if it's already computed) |
| 38 | + * @param p The point |
| 39 | + * @param tol The tolerance to use |
| 40 | + * @return If point is within the segment defined by [s1, s2] |
| 41 | + */ |
| 42 | +bool within_segment(const Point & s1, |
| 43 | + const Point & s2, |
| 44 | + const Real length, |
| 45 | + const Point & p, |
| 46 | + const Real tol = TOLERANCE); |
| 47 | + |
| 48 | +/** |
| 49 | + * Checks whether or not a point is within a line segment |
| 50 | + * @param s1 The first point on the segment |
| 51 | + * @param s2 The second point on the segment |
| 52 | + * @param p The point |
| 53 | + * @param tol The tolerance to use |
| 54 | + * @return If point is within the segment defined by [s1, s2] |
| 55 | + */ |
| 56 | +bool within_segment(const Point & s1, |
| 57 | + const Point & s2, |
| 58 | + const Point & p, |
| 59 | + const Real tol = TOLERANCE); |
| 60 | + |
| 61 | +} // namespace IntersectionTools |
| 62 | +} // namespace libMesh |
| 63 | + |
| 64 | +#endif // LIBMESH_INTERSECTIONTOOLS_H |
0 commit comments