#1450 Use x-axis as lateral start axis if well path is close to z-axis

This commit is contained in:
Magne Sjaastad 2017-05-05 13:32:50 +02:00
parent 414733899e
commit 710236f7f5
2 changed files with 45 additions and 2 deletions

View File

@ -90,10 +90,10 @@ void RivFishbonesSubsPartMgr::buildParts(caf::DisplayCoordTransform* displayCoor
m_rimFishbonesSubs->firstAncestorOrThisOfTypeAsserted(wellPath); m_rimFishbonesSubs->firstAncestorOrThisOfTypeAsserted(wellPath);
RigWellPath* rigWellPath = wellPath->wellPathGeometry(); RigWellPath* rigWellPath = wellPath->wellPathGeometry();
RivPipeGeometryGenerator geoGenerator; RivPipeGeometryGenerator geoGenerator;
geoGenerator.setRadius(m_rimFishbonesSubs->tubingRadius()); geoGenerator.setRadius(m_rimFishbonesSubs->tubingRadius());
for (size_t instanceIndex = 0; instanceIndex < locationOfSubs.size(); instanceIndex++) for (size_t instanceIndex = 0; instanceIndex < locationOfSubs.size(); instanceIndex++)
{ {
double measuredDepth = locationOfSubs[instanceIndex]; double measuredDepth = locationOfSubs[instanceIndex];
@ -114,7 +114,15 @@ void RivFishbonesSubsPartMgr::buildParts(caf::DisplayCoordTransform* displayCoor
cvf::Vec3d lateralDirection; cvf::Vec3d lateralDirection;
{ {
cvf::Vec3d alongWellPath = (p2 - p1).getNormalized(); cvf::Vec3d alongWellPath = (p2 - p1).getNormalized();
cvf::Vec3d lateralInitialDirection = cvf::Vec3d::Z_AXIS; cvf::Vec3d lateralInitialDirection = cvf::Vec3d::Z_AXIS;
if (RivFishbonesSubsPartMgr::closestMainAxis(alongWellPath) == cvf::Vec3d::Z_AXIS)
{
// Use x-axis if well path is heading close to z-axis
lateralInitialDirection = cvf::Vec3d::X_AXIS;
}
{ {
double intialRotationAngle = m_rimFishbonesSubs->rotationAngle(instanceIndex); double intialRotationAngle = m_rimFishbonesSubs->rotationAngle(instanceIndex);
double lateralOffsetDegrees = 360.0 / lateralLengths.size(); double lateralOffsetDegrees = 360.0 / lateralLengths.size();
@ -231,3 +239,36 @@ void RivFishbonesSubsPartMgr::cylinderWithCenterLineParts(cvf::Collection<cvf::P
} }
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
cvf::Vec3d RivFishbonesSubsPartMgr::closestMainAxis(const cvf::Vec3d& vec)
{
size_t maxComponent = 0;
double maxValue = cvf::Math::abs(vec.x());
if (cvf::Math::abs(vec.y()) > maxValue)
{
maxComponent = 1;
maxValue = cvf::Math::abs(vec.y());
}
if (cvf::Math::abs(vec.z()) > maxValue)
{
maxComponent = 2;
maxValue = cvf::Math::abs(vec.z());
}
if (maxComponent == 0)
{
return cvf::Vec3d::X_AXIS;
}
else if (maxComponent == 1)
{
return cvf::Vec3d::Y_AXIS;
}
else if (maxComponent == 2)
{
return cvf::Vec3d::Z_AXIS;
}
}

View File

@ -61,6 +61,8 @@ private:
static void cylinderWithCenterLineParts(cvf::Collection<cvf::Part>* destinationParts, const std::vector<cvf::Vec3d>& centerCoords, const cvf::Color3f& color, double radius); static void cylinderWithCenterLineParts(cvf::Collection<cvf::Part>* destinationParts, const std::vector<cvf::Vec3d>& centerCoords, const cvf::Color3f& color, double radius);
static cvf::Vec3d closestMainAxis(const cvf::Vec3d& vec);
private: private:
caf::PdmPointer<RimFishbonesMultipleSubs> m_rimFishbonesSubs; caf::PdmPointer<RimFishbonesMultipleSubs> m_rimFishbonesSubs;
cvf::Collection<cvf::Part> m_parts; cvf::Collection<cvf::Part> m_parts;