2018-03-14 03:35:48 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Copyright (C) 2018 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"
|
2018-03-15 15:25:54 -05:00
|
|
|
#include "cvfMatrix4.h"
|
2018-03-14 03:35:48 -05:00
|
|
|
#include "cvfObject.h"
|
|
|
|
#include "cvfVector3.h"
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace cvf
|
|
|
|
{
|
2018-03-15 15:25:54 -05:00
|
|
|
class DrawableGeo;
|
2018-03-14 03:35:48 -05:00
|
|
|
} // namespace cvf
|
|
|
|
|
2018-03-15 15:25:54 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-03-15 13:09:23 -05:00
|
|
|
struct CompletionVizData
|
|
|
|
{
|
2018-03-15 15:25:54 -05:00
|
|
|
CompletionVizData(const cvf::Vec3d& anchor, const cvf::Vec3d& direction, double connectionFactor, size_t globalCellIndex)
|
2018-03-15 13:09:23 -05:00
|
|
|
: m_anchor(anchor)
|
|
|
|
, m_direction(direction)
|
|
|
|
, m_connectionFactor(connectionFactor)
|
2018-03-15 15:25:54 -05:00
|
|
|
, m_globalCellIndex(globalCellIndex)
|
2018-03-15 13:09:23 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
cvf::Vec3d m_anchor;
|
|
|
|
cvf::Vec3d m_direction;
|
|
|
|
double m_connectionFactor;
|
2018-03-15 15:25:54 -05:00
|
|
|
size_t m_globalCellIndex;
|
2018-03-15 13:09:23 -05:00
|
|
|
};
|
|
|
|
|
2018-03-14 03:35:48 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2018-03-15 15:25:54 -05:00
|
|
|
class RivWellConnectionFactorGeometryGenerator : public cvf::Object
|
2018-03-14 03:35:48 -05:00
|
|
|
{
|
|
|
|
public:
|
2018-03-15 15:25:54 -05:00
|
|
|
RivWellConnectionFactorGeometryGenerator(std::vector<CompletionVizData>& centerColorPairs, float radius);
|
|
|
|
~RivWellConnectionFactorGeometryGenerator();
|
2018-03-14 03:35:48 -05:00
|
|
|
|
2018-03-16 09:58:04 -05:00
|
|
|
cvf::ref<cvf::DrawableGeo> createSurfaceGeometry();
|
2018-03-14 03:35:48 -05:00
|
|
|
|
2018-03-19 08:41:46 -05:00
|
|
|
double connectionFactor(cvf::uint triangleIndex) const;
|
2018-03-15 15:25:54 -05:00
|
|
|
size_t globalCellIndexFromTriangleIndex(cvf::uint triangleIndex) const;
|
2018-03-14 04:59:03 -05:00
|
|
|
|
2018-03-15 15:25:54 -05:00
|
|
|
private:
|
2018-03-19 08:41:46 -05:00
|
|
|
size_t mapFromTriangleToConnectionIndex(cvf::uint triangleIndex) const;
|
2018-03-15 13:09:23 -05:00
|
|
|
static cvf::Mat4f rotationMatrixBetweenVectors(const cvf::Vec3d& v1, const cvf::Vec3d& v2);
|
2018-03-15 15:25:54 -05:00
|
|
|
static void
|
|
|
|
createStarGeometry(std::vector<cvf::Vec3f>* vertices, std::vector<cvf::uint>* indices, float radius, float thickness);
|
2018-03-15 13:09:23 -05:00
|
|
|
|
2018-03-16 09:58:04 -05:00
|
|
|
static void createSimplifiedStarGeometry(std::vector<cvf::Vec3f>* vertices,
|
|
|
|
std::vector<cvf::uint>* indices,
|
|
|
|
float radius,
|
|
|
|
float thickness);
|
|
|
|
|
2018-03-14 03:35:48 -05:00
|
|
|
private:
|
2018-03-19 08:41:46 -05:00
|
|
|
std::vector<CompletionVizData> m_completionVizData;
|
2018-03-15 15:25:54 -05:00
|
|
|
float m_radius;
|
|
|
|
size_t m_trianglesPerConnection;
|
2018-03-14 03:35:48 -05:00
|
|
|
};
|