Skip to content

Commit cc55c85

Browse files
author
deseilligny
committed
In bundle line, ready to branch ?
1 parent 4c08915 commit cc55c85

File tree

11 files changed

+350
-137
lines changed

11 files changed

+350
-137
lines changed

MMVII/include/MMVII_Manifolds.h

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "MMVII_Mappings.h"
55
#include "MMVII_Geom2D.h"
6+
#include "MMVII_PCSens.h"
67

78

89
namespace MMVII
@@ -23,6 +24,7 @@ template <const int DimM,const int DimE> class cManifold
2324
typedef std::pair<int,tPtM> tResPOP; // Type result Param of Pt
2425

2526
cManifold(int aNbMap=1,const tREAL8 aEpsDeriv = 1e-4);
27+
virtual ~cManifold();
2628
int NbMap() const; //< Accessor
2729

2830
/// return the num map of a point, defaults assume mNbMap==1
@@ -62,10 +64,33 @@ template<int DimE> class cLineManifold : public cManifold<1,DimE>
6264
tResPOP ParamOfPt(const tPtE &) const override;
6365
tPtE ApproxProj(const tPtE &) const override ;
6466

67+
cLineManifold(const tSeg & aSeg);
68+
6569
private :
6670
tSeg mSeg;
6771
};
6872

73+
template<int DimE> class cSphereManifold : public cManifold<DimE-1,DimE>
74+
{
75+
public :
76+
// virtual tPtE PtOfParam(const tPtM &,int aNumMap) const ;
77+
static const int DimM = DimE-1;
78+
static const int DimC = DimE - DimM;
79+
80+
typedef cPtxd<tREAL8,DimM> tPtM;
81+
typedef cPtxd<tREAL8,DimE> tPtE;
82+
typedef cSegmentCompiled<tREAL8,DimE> tSeg;
83+
typedef std::pair<int,tPtM> tResPOP; // Type result Param of Pt
84+
85+
cSphereManifold(const tPtE & aPPerturb = tPtE::PCste(0.0) );
86+
tPtE PtOfParam(const tResPOP&) const override;
87+
tResPOP ParamOfPt(const tPtE &) const override;
88+
tPtE ApproxProj(const tPtE &) const override ;
89+
90+
private :
91+
bool mIsPerturb; //< do use artificial perturbation, just 4 bench
92+
tPtE mPPerturb; //< Value to use 4 articial perturbation
93+
};
6994

7095
template <const int DimM,const int DimE> class cManifoldFromMapping : public cManifold<DimM,DimE>
7196
{
@@ -86,6 +111,8 @@ template <const int DimM,const int DimE> class cManifoldFromMapping : public cM
86111
tResPOP ParamOfPt(const tPtE &) const override;
87112
tPtE ApproxProj(const tPtE &) const override ;
88113

114+
tMan * Man(); //< Accessor
115+
tMap * Map(); //< Accessor
89116

90117

91118
private :
@@ -94,6 +121,31 @@ template <const int DimM,const int DimE> class cManifoldFromMapping : public cM
94121

95122
};
96123

124+
125+
class cLineDist_Manifold;
126+
/// Helper class to cLineDist_Manifold so that data can be created before cManifoldFromMapping
127+
class cAux_LineDist_Manifold
128+
{
129+
public :
130+
friend cLineDist_Manifold;
131+
cAux_LineDist_Manifold(const tSeg2dr & aSeg,cPerspCamIntrCalib * aCalib );
132+
private :
133+
cCamUDReD_Map mMap_Ud_Red;
134+
cDataInvertOfMapping<tREAL8,2> mMap_Red_Ud;
135+
cLineManifold <2> mLineMan;
136+
};
137+
138+
/// class to present the distortion of line by a camera as a Manifold
139+
class cLineDist_Manifold : public cAux_LineDist_Manifold,
140+
public cManifoldFromMapping<1,2>
141+
{
142+
public :
143+
cLineDist_Manifold(const tSeg2dr & aSeg,cPerspCamIntrCalib * aCalib );
144+
//virtual ~cLineDist_Manifold() ;
145+
private:
146+
};
147+
148+
97149
};
98150

99151
#endif // __MMVII_MANIFOLDS_H_

MMVII/include/MMVII_Mappings.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ template <class Type,const int Dim> class cSphereBoundedSet;// cDataBoundedSet
4040
template <class Type,const int DimIn,const int DimOut> class cMapping;
4141
template <class Type,const int DimIn,const int DimOut> class cDataMapping;
4242
template <class Type,const int Dim> class cDataInvertibleMapping ;// : public cDataMapping<Type,Dim,Dim>
43+
template <class Type,const int Dim> class cDataInvertOfMapping; // : public cDataInvertibleMapping <Type,Dim>
44+
4345
template <class Type,const int Dim> class cDataIterInvertMapping ;// : public cDataInvertibleMapping<Type,Dim>
4446
template <class Type,const int Dim> class cDataIIMFromMap ; // : public cDataIterInvertMapping<Type,Dim>
4547

@@ -439,6 +441,7 @@ template <class Type,const int Dim> class cDataInvertibleMapping : public cData
439441
#endif
440442
};
441443

444+
/// If we have a Map M, create M-1, just by "swapping" Inverses & Values
442445
template <class Type,const int Dim> class cDataInvertOfMapping : public cDataInvertibleMapping <Type,Dim>
443446
{
444447
public :

MMVII/include/MMVII_PCSens.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,8 @@ class cPerspCamIntrCalib : public cObj2DelAtEnd,
316316

317317
/// return calculator adapted to model of camera (degree, projection)
318318
cCalculator<double> * EqColinearity(bool WithDerives,int aSzBuf,bool ReUse);
319+
/// return the calculator if first time, else recycle it
320+
cCalculator<double> * SetAndGet_EqProjSeg();
319321

320322
void UpdateMapProj2Im(); ///< when PP/F modified
321323

@@ -366,6 +368,8 @@ class cPerspCamIntrCalib : public cObj2DelAtEnd,
366368
void CheckBeforeInverse(const tVecOut &) const;
367369
void CheckBeforeInverse(const tPtOut & ) const;
368370

371+
/// return calculator adapted to model the projection of 3d seg on a curve
372+
cCalculator<double> * EqProjSeg(bool WithDerives,int aSzBuf,bool ReUse);
369373

370374
// ================== DATA PART ===================
371375
//
@@ -405,6 +409,7 @@ class cPerspCamIntrCalib : public cObj2DelAtEnd,
405409
bool mInvIsUpToDate;
406410
cTabuMapInv<2>* mTabulDUD; ///< Possibly store a tabulation of D/UD to replace call Undist/Redist
407411
// cDataMapCalcSymbDer<tREAL8,3,2> * mProjInv;
412+
cCalculator<double> * mEqProjSeg;
408413
};
409414

410415

@@ -605,6 +610,7 @@ class cSensorCamPC : public cSensorImage
605610
cPt3dr Vec_L2W(const cPt3dr &) const; ///< Coordinat local of cam to coordinate word for a "vector"
606611
cPt3dr Vec_W2L(const cPt3dr &) const; ///< Coordinat word to coordinate local of cam for a "vector"
607612

613+
cCalculator<double> * EqProjSeg();
608614

609615
// Cast to possible heriting class
610616
bool IsSensorCamPC() const override ;

MMVII/include/MMVII_Ptxd.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -894,19 +894,21 @@ template <class Type,const int Dim> class cSegment
894894
cSegment(const tPt& aP1,const tPt& aP2);
895895
/// Estimate fonc linear, with gradient paral to tangent, given value in P1 and P2, will be F(Q) = R.first + R.second Q
896896
void CompileFoncLinear(Type & aVal,tPt & aVec,const Type &aV1,const Type & aV2) const;
897-
const tPt& P1() const; ///< Accessor
898-
const tPt& P2() const; ///< Accessor
899-
tPt& P1() ; ///< Accessor
900-
tPt& P2() ; ///< Accessor
897+
const tPt& P1() const {return mVPts.at(0);} ; ///< Accessor
898+
const tPt& P2() const {return mVPts.at(1);} ; ///< Accessor
899+
tPt& P1() {return mVPts.at(0);} ; ///< Accessor
900+
tPt& P2() {return mVPts.at(1);} ; ///< Accessor
901901
void Swap(); ///< swap P1 P2 in place
902+
const std::vector<tPt> & VPts() const;
902903

903904
tPt V12() const; ///< Vector P1->P2
904905
tPt Middle() const; ///< P middle
905906
/// Used for "generik" object that must describes its box
906907
cTplBox<Type,Dim> GetBoxEnglob() const;
907908
protected :
908-
tPt mP1;
909-
tPt mP2;
909+
std::vector<tPt> mVPts;
910+
// tPt mP1;
911+
// tPt mP2;
910912
};
911913

912914
template <class Type,const int Dim> class cSegmentCompiled : public cSegment<Type,Dim>

0 commit comments

Comments
 (0)