mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#923 Moved extrusion computation to RimIntersection
This commit is contained in:
parent
2ca40025f2
commit
6bb0c3b87e
@ -505,7 +505,7 @@ void RivIntersectionPartMgr::computeData()
|
||||
std::vector< std::vector <cvf::Vec3d> > polyLines = m_rimCrossSection->polyLines();
|
||||
if (polyLines.size() > 0)
|
||||
{
|
||||
cvf::Vec3d direction = extrusionDirection(polyLines[0]);
|
||||
cvf::Vec3d direction = m_rimCrossSection->extrusionDirection();
|
||||
cvf::ref<RivIntersectionHexGridInterface> hexGrid = createHexGridInterface();
|
||||
m_crossSectionGenerator = new RivIntersectionGeometryGenerator(m_rimCrossSection, polyLines, direction, hexGrid.p());
|
||||
}
|
||||
@ -516,7 +516,6 @@ void RivIntersectionPartMgr::computeData()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::ref<RivIntersectionHexGridInterface> RivIntersectionPartMgr::createHexGridInterface()
|
||||
{
|
||||
|
||||
RimEclipseView* eclipseView;
|
||||
m_rimCrossSection->firstAncestorOrThisOfType(eclipseView);
|
||||
if (eclipseView)
|
||||
@ -537,26 +536,3 @@ cvf::ref<RivIntersectionHexGridInterface> RivIntersectionPartMgr::createHexGridI
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RivIntersectionPartMgr::extrusionDirection(const std::vector<cvf::Vec3d>& polyline) const
|
||||
{
|
||||
CVF_ASSERT(m_rimCrossSection);
|
||||
|
||||
cvf::Vec3d dir = cvf::Vec3d::Z_AXIS;
|
||||
|
||||
if (m_rimCrossSection->direction == RimIntersection::CS_HORIZONTAL &&
|
||||
polyline.size() > 1)
|
||||
{
|
||||
// Use first and last point of polyline to approximate orientation of polyline
|
||||
// Then cross with Z axis to find extrusion direction
|
||||
|
||||
cvf::Vec3d polyLineDir = polyline[polyline.size() - 1] - polyline[0];
|
||||
cvf::Vec3d up = cvf::Vec3d::Z_AXIS;
|
||||
dir = polyLineDir ^ up;
|
||||
}
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,6 @@ private:
|
||||
void generatePartGeometry();
|
||||
void computeData();
|
||||
|
||||
cvf::Vec3d extrusionDirection(const std::vector<cvf::Vec3d>& polyline) const;
|
||||
static void calculateEclipseTextureCoordinates(cvf::Vec2fArray* textureCoords,
|
||||
const std::vector<size_t>& triangleToCellIdxMap,
|
||||
const RigResultAccessor* resultAccessor,
|
||||
|
@ -57,6 +57,7 @@ void caf::AppEnum< RimIntersection::CrossSectionDirEnum >::setUp()
|
||||
{
|
||||
addItem(RimIntersection::CS_VERTICAL, "CS_VERTICAL", "Vertical");
|
||||
addItem(RimIntersection::CS_HORIZONTAL, "CS_HORIZONTAL", "Horizontal");
|
||||
addItem(RimIntersection::CS_CUSTOM, "CS_CUSTOM", "Custom");
|
||||
setDefault(RimIntersection::CS_VERTICAL);
|
||||
}
|
||||
|
||||
@ -81,6 +82,9 @@ RimIntersection::RimIntersection()
|
||||
CAF_PDM_InitFieldNoDefault(&wellPath, "WellPath", "Well Path ", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&simulationWell, "SimulationWell", "Simulation Well", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_userPolyline, "Points", "Points", "", "Use Ctrl-C for copy and Ctrl-V for paste", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_customExtrusionPoints, "CustomExtrusionPoints", "Extrusion Points", "", "", "");
|
||||
|
||||
CAF_PDM_InitField (&m_branchIndex, "Branch", -1, "Branch", "", "", "");
|
||||
CAF_PDM_InitField (&m_extentLength, "ExtentLength", 200.0, "Extent length", "", "", "");
|
||||
CAF_PDM_InitField (&showInactiveCells, "ShowInactiveCells", false, "Show Inactive Cells", "", "", "");
|
||||
@ -543,6 +547,27 @@ void RimIntersection::appendPointToPolyLine(const cvf::Vec3d& point)
|
||||
rebuildGeometryAndScheduleCreateDisplayModel();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
cvf::Vec3d RimIntersection::extrusionDirection() const
|
||||
{
|
||||
cvf::Vec3d dir = cvf::Vec3d::Z_AXIS;
|
||||
|
||||
if (direction() == RimIntersection::CS_HORIZONTAL &&
|
||||
m_userPolyline().size() > 1)
|
||||
{
|
||||
// Use first and last point of polyline to approximate orientation of polyline
|
||||
// Then cross with Z axis to find extrusion direction
|
||||
|
||||
cvf::Vec3d polyLineDir = m_userPolyline()[m_userPolyline().size() - 1] - m_userPolyline()[0];
|
||||
cvf::Vec3d up = cvf::Vec3d::Z_AXIS;
|
||||
dir = polyLineDir ^ up;
|
||||
}
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -54,7 +54,8 @@ public:
|
||||
enum CrossSectionDirEnum
|
||||
{
|
||||
CS_VERTICAL,
|
||||
CS_HORIZONTAL
|
||||
CS_HORIZONTAL,
|
||||
CS_CUSTOM
|
||||
};
|
||||
|
||||
public:
|
||||
@ -78,6 +79,8 @@ public:
|
||||
|
||||
void appendPointToPolyLine(const cvf::Vec3d& point);
|
||||
|
||||
cvf::Vec3d extrusionDirection() const;
|
||||
|
||||
protected:
|
||||
virtual caf::PdmFieldHandle* userDescriptionField();
|
||||
virtual caf::PdmFieldHandle* objectToggleField();
|
||||
@ -95,6 +98,7 @@ private:
|
||||
caf::PdmField<double> m_extentLength;
|
||||
|
||||
caf::PdmField< std::vector< cvf::Vec3d> > m_userPolyline;
|
||||
caf::PdmField< std::vector< cvf::Vec3d> > m_customExtrusionPoints;
|
||||
|
||||
RimEclipseWellCollection* simulationWellCollection();
|
||||
void updateWellCenterline() const;
|
||||
|
Loading…
Reference in New Issue
Block a user