2017-06-14 07:15:29 -05: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"
|
|
|
|
#include "cvfStructGrid.h"
|
2017-06-16 02:44:28 -05:00
|
|
|
#include "cvfPlane.h"
|
|
|
|
|
|
|
|
#include <array>
|
2017-06-14 07:15:29 -05:00
|
|
|
|
|
|
|
//==================================================================================================
|
|
|
|
/// Internal class for intersection point info
|
|
|
|
//==================================================================================================
|
|
|
|
|
|
|
|
struct HexIntersectionInfo
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
HexIntersectionInfo( cvf::Vec3d intersectionPoint,
|
|
|
|
bool isIntersectionEntering,
|
|
|
|
cvf::StructGridInterface::FaceType face,
|
|
|
|
size_t hexIndex)
|
|
|
|
: m_intersectionPoint(intersectionPoint),
|
|
|
|
m_isIntersectionEntering(isIntersectionEntering),
|
|
|
|
m_face(face),
|
|
|
|
m_hexIndex(hexIndex) {}
|
|
|
|
|
|
|
|
|
|
|
|
cvf::Vec3d m_intersectionPoint;
|
|
|
|
bool m_isIntersectionEntering;
|
|
|
|
cvf::StructGridInterface::FaceType m_face;
|
|
|
|
size_t m_hexIndex;
|
|
|
|
};
|
|
|
|
|
2017-09-18 09:29:05 -05:00
|
|
|
bool operator<( const HexIntersectionInfo& hi1, const HexIntersectionInfo& hi2);
|
|
|
|
|
2017-06-14 07:15:29 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
/// Specialized Line - Hex intersection
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
struct RigHexIntersectionTools
|
|
|
|
{
|
|
|
|
static int lineHexCellIntersection(const cvf::Vec3d p1,
|
|
|
|
const cvf::Vec3d p2,
|
|
|
|
const cvf::Vec3d hexCorners[8],
|
|
|
|
const size_t hexIndex,
|
|
|
|
std::vector<HexIntersectionInfo>* intersections);
|
|
|
|
|
2018-10-16 02:53:30 -05:00
|
|
|
static bool lineIntersectsHexCell(const cvf::Vec3d p1,
|
|
|
|
const cvf::Vec3d p2,
|
|
|
|
const cvf::Vec3d hexCorners[8]);
|
|
|
|
|
2017-06-14 07:15:29 -05:00
|
|
|
static bool isPointInCell(const cvf::Vec3d point, const cvf::Vec3d hexCorners[8]);
|
|
|
|
|
2017-06-16 02:44:28 -05:00
|
|
|
static bool planeHexCellIntersection(cvf::Vec3d* hexCorners,
|
2018-08-20 04:47:05 -05:00
|
|
|
const cvf::Plane& fracturePlane,
|
2017-06-16 02:44:28 -05:00
|
|
|
std::list<std::pair<cvf::Vec3d, cvf::Vec3d > >& intersectionLineSegments);
|
2017-06-14 07:15:29 -05:00
|
|
|
|
2017-06-16 02:44:28 -05:00
|
|
|
static bool planeHexIntersectionPolygons(std::array<cvf::Vec3d, 8> hexCorners,
|
2017-06-23 03:16:39 -05:00
|
|
|
cvf::Mat4d transformMatrixForPlane,
|
2017-06-16 02:44:28 -05:00
|
|
|
std::vector<std::vector<cvf::Vec3d> > & polygons);
|
2017-06-14 07:15:29 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|