mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
parent
9025cedecb
commit
088dd61fd8
@ -30,6 +30,8 @@ RiaArcCurveCalculator::RiaArcCurveCalculator(cvf::Vec3d p1, cvf::Vec3d t1, cvf::
|
||||
: m_isCalculationOK(false)
|
||||
, m_radius(std::numeric_limits<double>::infinity())
|
||||
, m_arcCS(cvf::Mat4d::ZERO)
|
||||
, m_endAzi(0)
|
||||
, m_endInc(0)
|
||||
{
|
||||
bool isOk = t1.normalize();
|
||||
if (!isOk)
|
||||
@ -50,6 +52,9 @@ RiaArcCurveCalculator::RiaArcCurveCalculator(cvf::Vec3d p1, cvf::Vec3d t1, cvf::
|
||||
if (!isOk)
|
||||
{
|
||||
// P2 is on the p1 + k*t1 line. We have a straight line
|
||||
RiaOffshoreSphericalCoords endTangent(t1);
|
||||
m_endAzi = endTangent.azi();
|
||||
m_endInc = endTangent.inc();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -63,6 +68,13 @@ RiaArcCurveCalculator::RiaArcCurveCalculator(cvf::Vec3d p1, cvf::Vec3d t1, cvf::
|
||||
m_arcCS = cvf::Mat4d::fromCoordSystemAxes( &nTr1, &t1, &N );
|
||||
|
||||
m_arcCS.setTranslation(C);
|
||||
|
||||
cvf::Vec3d t2 = N ^ (p2 - C).getNormalized();
|
||||
|
||||
RiaOffshoreSphericalCoords endTangent(t2);
|
||||
m_endAzi = endTangent.azi();
|
||||
m_endInc = endTangent.inc();
|
||||
|
||||
m_isCalculationOK = true;
|
||||
}
|
||||
|
||||
|
@ -41,11 +41,18 @@ public:
|
||||
cvf::Vec3d center() const { return m_arcCS.translation();}
|
||||
cvf::Vec3d normal() const { return cvf::Vec3d(m_arcCS.col(2));}
|
||||
|
||||
double endAzimuth() const { return m_endAzi; }
|
||||
double endInclination() const { return m_endInc; }
|
||||
|
||||
private:
|
||||
bool m_isCalculationOK;
|
||||
|
||||
double m_radius;
|
||||
cvf::Mat4d m_arcCS;
|
||||
|
||||
double m_endAzi;
|
||||
double m_endInc;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -26,7 +26,9 @@
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaJCurveCalculator::RiaJCurveCalculator(cvf::Vec3d p1, double azi1, double inc1, double r1,
|
||||
cvf::Vec3d p2)
|
||||
: m_isCalculationOK(false)
|
||||
: m_isCalculationOK(false)
|
||||
, m_c1( cvf::Vec3d::UNDEFINED)
|
||||
, m_n1( cvf::Vec3d::UNDEFINED)
|
||||
|
||||
{
|
||||
cvf::Vec3d t1 (RiaOffshoreSphericalCoords::unitVectorFromAziInc(azi1, inc1));
|
||||
@ -39,8 +41,8 @@ RiaJCurveCalculator::RiaJCurveCalculator(cvf::Vec3d p1, double azi1, double inc1
|
||||
{
|
||||
// p2 is on the p1 + t12 line. Degenerates to a line.
|
||||
m_firstArcEndpoint = p2;
|
||||
m_c1 = cvf::Vec3d::UNDEFINED;
|
||||
m_n1 = cvf::Vec3d::UNDEFINED;
|
||||
m_endAzi = azi1;
|
||||
m_endInc = inc1;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -53,9 +55,20 @@ RiaJCurveCalculator::RiaJCurveCalculator(cvf::Vec3d p1, double azi1, double inc1
|
||||
// Radius is too big. We can not get to point 2 using the requested radius.
|
||||
m_isCalculationOK = false;
|
||||
RiaArcCurveCalculator arc(p1, t1, p2);
|
||||
m_c1 = arc.center();
|
||||
m_n1 = arc.normal();
|
||||
m_firstArcEndpoint = p2;
|
||||
if ( arc.isOk() )
|
||||
{
|
||||
m_c1 = arc.center();
|
||||
m_n1 = arc.normal();
|
||||
m_firstArcEndpoint = p2;
|
||||
m_endAzi = arc.endAzimuth();
|
||||
m_endInc = arc.endInclination();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_firstArcEndpoint = p2;
|
||||
m_endAzi = azi1;
|
||||
m_endInc = inc1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -72,6 +85,10 @@ RiaJCurveCalculator::RiaJCurveCalculator(cvf::Vec3d p1, double azi1, double inc1
|
||||
m_n1 = nc1;
|
||||
m_isCalculationOK = true;
|
||||
|
||||
RiaOffshoreSphericalCoords endTangent(tp11p2);
|
||||
m_endAzi = endTangent.azi();
|
||||
m_endInc = endTangent.inc();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -32,12 +32,17 @@ public:
|
||||
cvf::Vec3d firstCenter() const { return m_c1; }
|
||||
cvf::Vec3d firstNormal() const { return m_n1; }
|
||||
|
||||
double endAzimuth() const { return m_endAzi; }
|
||||
double endInclination() const { return m_endInc; }
|
||||
|
||||
private:
|
||||
bool m_isCalculationOK;
|
||||
bool m_isCalculationOK;
|
||||
|
||||
cvf::Vec3d m_firstArcEndpoint;
|
||||
cvf::Vec3d m_c1;
|
||||
cvf::Vec3d m_n1;
|
||||
double m_endAzi;
|
||||
double m_endInc;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user