KratosMultiphysics
KRATOS Multiphysics (Kratos) is a framework for building parallel, multi-disciplinary simulation software, aiming at modularity, extensibility, and high performance. Kratos is written in C++, and counts with an extensive Python interface.
|
Utilities to compute intersections between different geometries. More...
#include <intersection_utilities.h>
Public Member Functions | |
Type Definitions | |
KRATOS_CLASS_POINTER_DEFINITION (IntersectionUtilities) | |
Pointer definition of IntersectionUtilities. More... | |
Operators | |
IntersectionUtilities () | |
Default constructor. More... | |
virtual | ~IntersectionUtilities () |
Destructor. More... | |
Static Public Member Functions | |
Operations | |
template<class TGeometryType > | |
static int | ComputeTriangleLineIntersection (const TGeometryType &rTriangleGeometry, const array_1d< double, 3 > &rLinePoint1, const array_1d< double, 3 > &rLinePoint2, array_1d< double, 3 > &rIntersectionPoint, const double epsilon=1e-12) |
template<class TGeometryType > | |
static bool | TriangleLineIntersection2D (const TGeometryType &rTriangle, const array_1d< double, 3 > &rPoint0, const array_1d< double, 3 > &rPoint1) |
static bool | TriangleLineIntersection2D (const array_1d< double, 3 > &rVert0, const array_1d< double, 3 > &rVert1, const array_1d< double, 3 > &rVert2, const array_1d< double, 3 > &rPoint0, const array_1d< double, 3 > &rPoint1) |
static bool | PointInTriangle (const array_1d< double, 3 > &rVert0, const array_1d< double, 3 > &rVert1, const array_1d< double, 3 > &rVert2, const array_1d< double, 3 > &rPoint, const double Tolerance=std::numeric_limits< double >::epsilon()) |
This uses the Cramer's rule for solving a linear system and obtain the barycentric coordinates. More... | |
template<class TGeometryType , class TCoordinatesType > | |
static int | ComputeTriangleLineIntersectionInTheSamePlane (const TGeometryType &rTriangleGeometry, const TCoordinatesType &rLinePoint1, const TCoordinatesType &rLinePoint2, TCoordinatesType &rIntersectionPoint1, TCoordinatesType &rIntersectionPoint2, int &rSolution, const double Epsilon=1e-12) |
Find the 3D intersection of a line (bounded) with a triangle (bounded) in the same plane. More... | |
template<class TGeometryType , class TCoordinatesType , bool TConsiderInsidePoints = true> | |
static int | ComputeTetrahedraLineIntersection (const TGeometryType &rTetrahedraGeometry, const TCoordinatesType &rLinePoint1, const TCoordinatesType &rLinePoint2, TCoordinatesType &rIntersectionPoint1, TCoordinatesType &rIntersectionPoint2, const double Epsilon=1e-12) |
Find the 3D intersection of a line (bounded) with a tetrahedra (bounded) More... | |
template<class TGeometryType > | |
static PointerVector< Point > | ComputeShortestLineBetweenTwoLines (const TGeometryType &rSegment1, const TGeometryType &rSegment2) |
Calculates the line to line intersection (shortest line). If line is length 0, it is considered a point and therefore there is intersection (3D version) More... | |
template<class TGeometryType > | |
static int | ComputeLineLineIntersection (const TGeometryType &rLineGeometry, const array_1d< double, 3 > &rLinePoint0, const array_1d< double, 3 > &rLinePoint1, array_1d< double, 3 > &rIntersectionPoint, const double epsilon=1e-12) |
static int | ComputeLineLineIntersection (const array_1d< double, 3 > &rLine1Point0, const array_1d< double, 3 > &rLine1Point1, const array_1d< double, 3 > &rLine2Point0, const array_1d< double, 3 > &rLine2Point1, array_1d< double, 3 > &rIntersectionPoint, const double epsilon=1e-12) |
static int | ComputePlaneLineIntersection (const array_1d< double, 3 > &rPlaneBasePoint, const array_1d< double, 3 > &rPlaneNormal, const array_1d< double, 3 > &rLinePoint1, const array_1d< double, 3 > &rLinePoint2, array_1d< double, 3 > &rIntersectionPoint, const double epsilon=1e-12) |
Find the 3D intersection of a plane (infinite) with a segment (bounded) More... | |
static int | ComputeLineBoxIntersection (const array_1d< double, 3 > &rBoxPoint0, const array_1d< double, 3 > &rBoxPoint1, const array_1d< double, 3 > &rLinePoint0, const array_1d< double, 3 > &rLinePoint1) |
Compute a segment box intersection Provided the minimum and maximum points of a box cell, this method checks if the segment intersects it. If it does intersect, it returns the rIntersectionPointpoint as well. Note that the cell box is assumed to be aligned to the cartesian axes. Adapted from: https://www.3dkingdoms.com/weekly/weekly.php?a=3. More... | |
Utilities to compute intersections between different geometries.
This class provides static methods to check if there is intersections between different entities, and if there is, give back the intersection points.
|
inline |
Default constructor.
|
inlinevirtual |
Destructor.
|
inlinestatic |
Compute a segment box intersection Provided the minimum and maximum points of a box cell, this method checks if the segment intersects it. If it does intersect, it returns the rIntersectionPointpoint as well. Note that the cell box is assumed to be aligned to the cartesian axes. Adapted from: https://www.3dkingdoms.com/weekly/weekly.php?a=3.
rBoxPoint0 | Minimum point of the box cell |
rBoxPoint1 | Maximum point of the box cell |
rLinePoint0 | Segment origin point |
rLinePoint1 | Segment end point |
|
inlinestatic |
Find the 2D intersection of two lines (both bounded)
rLine1Point0 | Coordinates of the first point of the first line |
rLine1Point1 | Coordinates of the second point of the first line |
rLine2Point0 | Coordinates of the first point of the second line |
rLine2Point1 | Coordinates of the second point of the second line |
|
inlinestatic |
Find the 2D intersection of two lines (both bounded)
rLineGeometry | Is the line to intersect |
rLinePoint1 | Coordinates of the first point of the intersecting line |
rLinePoint2 | Coordinates of the second point of the intersecting line |
|
inlinestatic |
Find the 3D intersection of a plane (infinite) with a segment (bounded)
rPlaneBasePoint | Base point of the plane to intersect with |
rPlaneNormal | Normal vector of the plane to intersect with |
rLinePoint1 | Coordinates of the first point of the segment |
rLinePoint2 | Coordinates of the second point of the segment |
rIntersectionPoint | The intersection point coordinates |
|
inlinestatic |
Calculates the line to line intersection (shortest line). If line is length 0, it is considered a point and therefore there is intersection (3D version)
Calculate the line segment PaPb that is the shortest route between two lines P1P2 and P3P4. Calculate also the values of mua and mub where Pa = P1 + mua (P2 - P1) Pb = P3 + mub (P4 - P3) http://paulbourke.net/geometry/pointlineplane/
rSegment1 | The first segment |
rSegment2 | The second segment |
TGeometryType | The geometry type |
|
inlinestatic |
Find the 3D intersection of a line (bounded) with a tetrahedra (bounded)
TGeometryType | The geometry type |
TCoordinatesType | The type of coordinates |
TConsiderInsidePoints | If considering inside points or just the intersections in the faces |
[in] | rTetrahedraGeometry | Is the tetrahedra to intersect |
[in] | rLinePoint1 | Coordinates of the first point of the intersecting line |
[in] | rLinePoint2 | Coordinates of the second point of the intersecting line |
[out] | rIntersectionPoint1 | The first intersection point coordinates |
[out] | rIntersectionPoint2 | The second intersection point coordinates |
Epsilon | The tolerance |
|
inlinestatic |
Find the 3D intersection of a line (bounded) with a triangle (bounded)
rTriangleGeometry | Is the triangle to intersect |
rLinePoint1 | Coordinates of the first point of the intersecting line |
rLinePoint2 | Coordinates of the second point of the intersecting line |
|
inlinestatic |
Find the 3D intersection of a line (bounded) with a triangle (bounded) in the same plane.
TGeometryType | The geometry type |
TCoordinatesType | The type of coordinates |
TConsiderInsidePoints | If considering inside points or just the intersections in the faces |
[in] | rTriangleGeometry | Is the tetrahedra to intersect |
[in] | rLinePoint1 | Coordinates of the first point of the intersecting line |
[in] | rLinePoint2 | Coordinates of the second point of the intersecting line |
[out] | rIntersectionPoint1 | The first intersection point coordinates |
[out] | rIntersectionPoint2 | The second intersection point coordinates |
[out] | rSolution | The intersection type index: NO_INTERSECTION (disjoint - no intersection) TWO_POINTS_INTERSECTION (intersect in two points) ONE_POINT_INTERSECTION (intersect in one point) |
Epsilon | The tolerance |
Kratos::IntersectionUtilities::KRATOS_CLASS_POINTER_DEFINITION | ( | IntersectionUtilities | ) |
Pointer definition of IntersectionUtilities.
|
inlinestatic |
This uses the Cramer's rule for solving a linear system and obtain the barycentric coordinates.
Check if a point is inside a 2D triangle
rVert0 | The first vertex of the triangle to intersect |
rVert1 | The second vertex of the triangle to intersect |
rVert2 | The third vertex of the triangle to intersect |
rPoint | Coordinates of the point |
|
inlinestatic |
Find the 2D intersection of a line (bounded) with a triangle (bounded)
rVert1 | The first vertex of the triangle to intersect |
rVert2 | The second vertex of the triangle to intersect |
rVert3 | The third vertex of the triangle to intersect |
rPoint1 | Coordinates of the first point of the intersecting line |
rPoint2 | Coordinates of the second point of the intersecting line |
|
inlinestatic |
Find the 2D intersection of a line (bounded) with a triangle (bounded)
rTriangle | Is the triangle to intersect |
rPoint0 | Coordinates of the first point of the intersecting line |
rPoint1 | Coordinates of the second point of the intersecting line |