2017-01-23 08:22:51 -06:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2017 Statoil ASA
|
|
|
|
//
|
|
|
|
// ResInsight 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 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// ResInsight 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 at <http://www.gnu.org/licenses/gpl.html>
|
|
|
|
// for more details.
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "cvfBase.h"
|
|
|
|
#include "cvfVector3.h"
|
|
|
|
|
2017-01-26 02:06:18 -06:00
|
|
|
#include "cvfBoundingBox.h"
|
2017-01-23 08:22:51 -06:00
|
|
|
#include "cvfPlane.h"
|
|
|
|
|
2017-06-07 09:04:34 -05:00
|
|
|
#include <array>
|
2017-01-23 08:22:51 -06:00
|
|
|
#include <list>
|
2017-01-26 02:06:18 -06:00
|
|
|
#include <vector>
|
2017-01-23 08:22:51 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class RigCellGeometryTools
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
static void createPolygonFromLineSegments(std::list<std::pair<cvf::Vec3d, cvf::Vec3d>> &intersectionLineSegments, std::vector<std::vector<cvf::Vec3d>> &polygons);
|
|
|
|
|
2017-06-07 09:04:34 -05:00
|
|
|
static void findCellLocalXYZ(const std::array<cvf::Vec3d, 8>& hexCorners, cvf::Vec3d &localXdirection, cvf::Vec3d &localYdirection, cvf::Vec3d &localZdirection);
|
|
|
|
|
2018-08-20 04:47:05 -05:00
|
|
|
static double polygonLengthInLocalXdirWeightedByArea(const std::vector<cvf::Vec3d>& polygon2d);
|
2018-06-22 10:14:28 -05:00
|
|
|
|
2018-08-20 04:47:05 -05:00
|
|
|
static std::vector<std::vector<cvf::Vec3d>> intersectPolygons(const std::vector<cvf::Vec3d>& polygon1,
|
|
|
|
const std::vector<cvf::Vec3d>& polygon2);
|
2018-06-22 10:14:28 -05:00
|
|
|
|
|
|
|
static std::vector<std::vector<cvf::Vec3d>> subtractPolygons(const std::vector<cvf::Vec3d>& sourcePolygon,
|
|
|
|
const std::vector<std::vector<cvf::Vec3d>>& polygonToSubtract);
|
2017-05-22 08:33:53 -05:00
|
|
|
|
|
|
|
enum ZInterpolationType { INTERPOLATE_LINE_Z, USE_HUGEVAL, USE_ZERO};
|
2017-05-22 11:11:03 -05:00
|
|
|
static std::vector<std::vector<cvf::Vec3d> > clipPolylineByPolygon(const std::vector<cvf::Vec3d>& polyLine,
|
|
|
|
const std::vector<cvf::Vec3d>& polygon,
|
|
|
|
ZInterpolationType interpolType = USE_ZERO);
|
2017-01-26 02:06:18 -06:00
|
|
|
|
2018-08-20 04:47:05 -05:00
|
|
|
static std::pair<cvf::Vec3d, cvf::Vec3d> getLineThroughBoundingBox(const cvf::Vec3d& lineDirection, const cvf::BoundingBox& polygonBBox, const cvf::Vec3d& pointOnLine);
|
2017-01-26 02:06:18 -06:00
|
|
|
|
2017-09-07 14:24:06 -05:00
|
|
|
static double getLengthOfPolygonAlongLine(const std::pair<cvf::Vec3d, cvf::Vec3d>& line, const std::vector<cvf::Vec3d>& polygon);
|
2017-08-07 06:14:01 -05:00
|
|
|
|
2018-08-20 04:47:05 -05:00
|
|
|
static std::vector<cvf::Vec3d> unionOfPolygons(const std::vector<std::vector<cvf::Vec3d>>& polygons);
|
2018-03-08 04:01:04 -06:00
|
|
|
|
2017-08-07 06:14:01 -05:00
|
|
|
private:
|
|
|
|
static std::vector<cvf::Vec3d> ajustPolygonToAvoidIntersectionsAtVertex(const std::vector<cvf::Vec3d>& polyLine,
|
|
|
|
const std::vector<cvf::Vec3d>& polygon);
|
|
|
|
|
2017-01-23 08:22:51 -06:00
|
|
|
};
|