mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#1794 Include Clipper library inside ifdef USE_PROTOTYPE_FEATURE_FRACTURES
This commit is contained in:
parent
2d11a34928
commit
de6e6858fa
@ -24,7 +24,9 @@
|
||||
#include "cafHexGridIntersectionTools/cafHexGridIntersectionTools.h"
|
||||
#include "cvfBoundingBox.h"
|
||||
|
||||
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
|
||||
#include "clipper/clipper.hpp"
|
||||
#endif // USE_PROTOTYPE_FEATURE_FRACTURES
|
||||
|
||||
#include <vector>
|
||||
|
||||
@ -213,6 +215,8 @@ double RigCellGeometryTools::polygonAreaWeightedLength(cvf::Vec3d directionOfLen
|
||||
return areaWeightedLength;
|
||||
}
|
||||
|
||||
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
|
||||
|
||||
double clipperConversionFactor = 10000; //For transform to clipper int
|
||||
|
||||
ClipperLib::IntPoint toClipperPoint(const cvf::Vec3d& cvfPoint)
|
||||
@ -238,13 +242,16 @@ cvf::Vec3d fromClipperPoint(const ClipperLib::IntPoint& clipPoint)
|
||||
|
||||
return cvf::Vec3d (clipPoint.X, clipPoint.Y, zDValue ) /clipperConversionFactor;
|
||||
}
|
||||
#endif // USE_PROTOTYPE_FEATURE_FRACTURES
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
std::vector<std::vector<cvf::Vec3d> > RigCellGeometryTools::intersectPolygons(std::vector<cvf::Vec3d> polygon1, std::vector<cvf::Vec3d> polygon2)
|
||||
{
|
||||
std::vector<std::vector<cvf::Vec3d> > clippedPolygons;
|
||||
|
||||
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
|
||||
// Convert to int for clipper library and store as clipper "path"
|
||||
ClipperLib::Path polygon1path;
|
||||
for (cvf::Vec3d& v : polygon1)
|
||||
@ -266,7 +273,6 @@ std::vector<std::vector<cvf::Vec3d> > RigCellGeometryTools::intersectPolygons(st
|
||||
clpr.Execute(ClipperLib::ctIntersection, solution, ClipperLib::pftEvenOdd, ClipperLib::pftEvenOdd);
|
||||
|
||||
// Convert back to std::vector<std::vector<cvf::Vec3d> >
|
||||
std::vector<std::vector<cvf::Vec3d> > clippedPolygons;
|
||||
for (ClipperLib::Path pathInSol : solution)
|
||||
{
|
||||
std::vector<cvf::Vec3d> clippedPolygon;
|
||||
@ -276,14 +282,15 @@ std::vector<std::vector<cvf::Vec3d> > RigCellGeometryTools::intersectPolygons(st
|
||||
}
|
||||
clippedPolygons.push_back(clippedPolygon);
|
||||
}
|
||||
#endif // USE_PROTOTYPE_FEATURE_FRACTURES
|
||||
|
||||
return clippedPolygons;
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
|
||||
void fillInterpolatedSubjectZ(ClipperLib::IntPoint& e1bot,
|
||||
ClipperLib::IntPoint& e1top,
|
||||
ClipperLib::IntPoint& e2bot,
|
||||
@ -336,6 +343,7 @@ void fillUndefinedZ(ClipperLib::IntPoint& e1bot,
|
||||
{
|
||||
pt.Z = std::numeric_limits<int>::max();
|
||||
}
|
||||
#endif // USE_PROTOTYPE_FEATURE_FRACTURES
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Assumes x.y plane polygon. Polyline might have a Z, and the returned Z is the polyline Z, interpolated if it is clipped.
|
||||
@ -344,7 +352,9 @@ std::vector<std::vector<cvf::Vec3d> > RigCellGeometryTools::clipPolylineByPolygo
|
||||
const std::vector<cvf::Vec3d>& polygon,
|
||||
ZInterpolationType interpolType)
|
||||
{
|
||||
std::vector<std::vector<cvf::Vec3d> > clippedPolyline;
|
||||
|
||||
#ifdef USE_PROTOTYPE_FEATURE_FRACTURES
|
||||
//Adjusting polygon to avoid clipper issue with interpolating z-values when lines crosses though polygon vertecies
|
||||
std::vector<cvf::Vec3d> adjustedPolygon = ajustPolygonToAvoidIntersectionsAtVertex(polyLine, polygon);
|
||||
|
||||
@ -386,7 +396,6 @@ std::vector<std::vector<cvf::Vec3d> > RigCellGeometryTools::clipPolylineByPolygo
|
||||
ClipperLib::OpenPathsFromPolyTree(solution, solutionPaths);
|
||||
|
||||
//Convert back to std::vector<std::vector<cvf::Vec3d> >
|
||||
std::vector<std::vector<cvf::Vec3d> > clippedPolyline;
|
||||
for (ClipperLib::Path pathInSol : solutionPaths)
|
||||
{
|
||||
std::vector<cvf::Vec3d> clippedPolygon;
|
||||
@ -396,6 +405,7 @@ std::vector<std::vector<cvf::Vec3d> > RigCellGeometryTools::clipPolylineByPolygo
|
||||
}
|
||||
clippedPolyline.push_back(clippedPolygon);
|
||||
}
|
||||
#endif // USE_PROTOTYPE_FEATURE_FRACTURES
|
||||
|
||||
return clippedPolyline;
|
||||
}
|
||||
|
@ -228,18 +228,6 @@ list(APPEND THIRD_PARTY_LIBRARIES
|
||||
NRLib
|
||||
)
|
||||
|
||||
|
||||
################################################################################
|
||||
# clipper
|
||||
################################################################################
|
||||
|
||||
add_subdirectory(ThirdParty/clipper)
|
||||
|
||||
list(APPEND THIRD_PARTY_LIBRARIES
|
||||
clipper
|
||||
)
|
||||
|
||||
|
||||
################################################################################
|
||||
# Qt
|
||||
################################################################################
|
||||
@ -291,6 +279,16 @@ if (RESINSIGHT_ENABLE_PROTOTYPE_FEATURE_FRACTURES)
|
||||
################################################################################
|
||||
include_directories(SYSTEM ThirdParty/Eigen-Subset)
|
||||
|
||||
################################################################################
|
||||
# clipper
|
||||
################################################################################
|
||||
|
||||
add_subdirectory(ThirdParty/clipper)
|
||||
|
||||
list(APPEND THIRD_PARTY_LIBRARIES
|
||||
clipper
|
||||
)
|
||||
|
||||
endif() # RESINSIGHT_ENABLE_PROTOTYPE_FEATURE_FRACTURES
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user