#2633 3D well log curves: Clip curve on well path bounding box

This commit is contained in:
Rebecca Cox 2018-03-21 13:15:48 +01:00
parent b20b633c40
commit a1d82fcffa
5 changed files with 42 additions and 11 deletions

View File

@ -38,12 +38,13 @@
//--------------------------------------------------------------------------------------------------
cvf::ref<cvf::DrawableGeo>
Riv3dWellLogCurveGeometryGenerator::createCurveLine(const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox,
const Rim3dWellLogCurve* rim3dWellLogCurve) const
{
std::vector<cvf::Vec3f> vertices;
std::vector<cvf::uint> indices;
createCurveVerticesAndIndices(rim3dWellLogCurve, displayCoordTransform, &vertices, &indices);
createCurveVerticesAndIndices(rim3dWellLogCurve, displayCoordTransform, wellPathClipBoundingBox, &vertices, &indices);
if (vertices.empty() || indices.empty())
{
@ -181,10 +182,13 @@ cvf::ref<cvf::DrawableGeo> Riv3dWellLogCurveGeometryGenerator::createGrid(const
//--------------------------------------------------------------------------------------------------
void Riv3dWellLogCurveGeometryGenerator::createCurveVerticesAndIndices(const Rim3dWellLogCurve* rim3dWellLogCurve,
const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox,
std::vector<cvf::Vec3f>* vertices,
std::vector<cvf::uint>* indices) const
{
if (!wellPathGeometry()) return;
if (wellPathGeometry()->m_wellPathPoints.empty()) return;
if (!wellPathClipBoundingBox.isValid()) return;
std::vector<double> resultValues;
std::vector<double> mds;
@ -193,17 +197,36 @@ void Riv3dWellLogCurveGeometryGenerator::createCurveVerticesAndIndices(const Rim
if (resultValues.empty()) return;
CVF_ASSERT(resultValues.size() == mds.size());
cvf::Vec3d globalDirection =
(wellPathGeometry()->m_wellPathPoints.back() - wellPathGeometry()->m_wellPathPoints.front()).getNormalized();
RimWellPathCollection* wellPathCollection = nullptr;
m_wellPath->firstAncestorOrThisOfTypeAsserted(wellPathCollection);
double maxZClipHeight = wellPathGeometry()->m_wellPathPoints.front().z();
if (wellPathCollection->wellPathClip)
{
maxZClipHeight = wellPathClipBoundingBox.max().z() + wellPathCollection->wellPathClipZDistance;
}
std::vector<cvf::Vec3d> interpolatedWellPathPoints;
interpolatedWellPathPoints.reserve(mds.size());
for (double md : mds)
for (auto rit = mds.rbegin(); rit != mds.rend(); rit++)
{
interpolatedWellPathPoints.push_back(wellPathGeometry()->interpolatedPointAlongWellPath(md));
cvf::Vec3d point = wellPathGeometry()->interpolatedPointAlongWellPath(*rit);
if (point.z() > maxZClipHeight) break;
interpolatedWellPathPoints.push_back(point);
}
if (interpolatedWellPathPoints.size() % 2 != 0)
{
interpolatedWellPathPoints.pop_back();
}
std::reverse(interpolatedWellPathPoints.begin(), interpolatedWellPathPoints.end());
if (interpolatedWellPathPoints.empty()) return;
resultValues.erase(resultValues.begin(), resultValues.end() - interpolatedWellPathPoints.size());
std::vector<cvf::Vec3d> pointNormals = calculatePointNormals(rim3dWellLogCurve->drawPlane(), interpolatedWellPathPoints);
if (interpolatedWellPathPoints.size() != pointNormals.size()) return;
@ -258,9 +281,12 @@ std::vector<cvf::Vec3d> Riv3dWellLogCurveGeometryGenerator::calculatePointNormal
std::vector<cvf::Vec3d> pointNormals;
if (!wellPathGeometry()) return pointNormals;
if (points.empty()) return pointNormals;
pointNormals.reserve(points.size());
const cvf::Vec3d globalDirection = (points.back() - points.front()).getNormalized();
const cvf::Vec3d globalDirection =
(wellPathGeometry()->m_wellPathPoints.back() - wellPathGeometry()->m_wellPathPoints.front()).getNormalized();
const cvf::Vec3d up(0, 0, 1);
for (const cvf::Vec3d point : points)

View File

@ -50,6 +50,7 @@ public:
: m_wellPath(wellPath), m_gridView(gridView) {};
cvf::ref<cvf::DrawableGeo> createCurveLine(const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox,
const Rim3dWellLogCurve* rim3dWellLogCurve) const;
cvf::ref<cvf::DrawableGeo> createGrid(const caf::DisplayCoordTransform* displayCoordTransform,
@ -60,6 +61,7 @@ public:
private:
void createCurveVerticesAndIndices(const Rim3dWellLogCurve* rim3dWellLogCurve,
const caf::DisplayCoordTransform* displayCoordTransform,
const cvf::BoundingBox& wellPathClipBoundingBox,
std::vector<cvf::Vec3f>* vertices,
std::vector<cvf::uint>* indices) const;

View File

@ -46,8 +46,9 @@ Riv3dWellLogPlanePartMgr::Riv3dWellLogPlanePartMgr(RimWellPath* wellPath, RimGri
//--------------------------------------------------------------------------------------------------
void Riv3dWellLogPlanePartMgr::append3dWellLogCurvesToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform,
std::vector<Rim3dWellLogCurve*> rim3dWellLogCurves)
const cvf::BoundingBox& wellPathClipBoundingBox)
{
std::vector<Rim3dWellLogCurve*> rim3dWellLogCurves = m_wellPath->vectorOf3dWellLogCurves();
if (rim3dWellLogCurves.empty()) return;
if (m_wellPath.isNull()) return;
@ -61,7 +62,7 @@ void Riv3dWellLogPlanePartMgr::append3dWellLogCurvesToModel(cvf::ModelBasicList*
if (!rim3dWellLogCurve->toggleState()) continue;
cvf::ref<cvf::Drawable> curveDrawable =
m_3dWellLogCurveGeometryGenerator->createCurveLine(displayCoordTransform, rim3dWellLogCurve);
m_3dWellLogCurveGeometryGenerator->createCurveLine(displayCoordTransform, wellPathClipBoundingBox, rim3dWellLogCurve);
if (curveDrawable.isNull() || !curveDrawable->boundingBox().isValid())
{

View File

@ -52,7 +52,7 @@ public:
void append3dWellLogCurvesToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform,
std::vector<Rim3dWellLogCurve*> rim3dWellLogCurves);
const cvf::BoundingBox& wellPathClipBoundingBox);
void appendGridToModel(cvf::ModelBasicList* model,
const caf::DisplayCoordTransform* displayCoordTransform,

View File

@ -545,7 +545,9 @@ void RivWellPathPartMgr::appendDynamicGeometryPartsToModel(cvf::ModelBasicList*
if (!gridView) return;
m_3dWellLogCurvePartMgr = new Riv3dWellLogPlanePartMgr(m_rimWellPath, gridView);
m_3dWellLogCurvePartMgr->append3dWellLogCurvesToModel(model, displayCoordTransform, m_rimWellPath->vectorOf3dWellLogCurves());
m_3dWellLogCurvePartMgr->append3dWellLogCurvesToModel(model,
displayCoordTransform,
wellPathClipBoundingBox);
if (m_rimWellPath->rim3dWellLogCurveCollection()->showGrid())
{