Refactored a bit to allow the conversion of shot and cameras from float to double (added the notoriuous vcg style Construct)
This commit is contained in:
parent
bb49f1c657
commit
181cef32fa
|
@ -172,6 +172,25 @@ public:
|
|||
|
||||
int cameraType; /// Type of camera: PERSPECTIVE,ORTHO,ISOMETRIC,CAVALIERI
|
||||
|
||||
|
||||
|
||||
template <class Q>
|
||||
static inline Camera Construct( const Camera<Q> &t)
|
||||
{
|
||||
Camera n;
|
||||
n.FocalMm = t.FocalMm;
|
||||
n.ViewportPx.Import(t.ViewportPx);
|
||||
n.PixelSizeMm.Import(t.PixelSizeMm);
|
||||
n.CenterPx.Import(t.CenterPx);
|
||||
n.DistorCenterPx.Import(t.DistorCenterPx);
|
||||
n.cameraType =t.cameraType;
|
||||
n.k[0] = t.k[0];
|
||||
n.k[1] = t.k[1];
|
||||
n.k[2] = t.k[2];
|
||||
n.k[3] = t.k[3];
|
||||
return n;
|
||||
}
|
||||
|
||||
void SetOrtho( S l,S r, S b, S t, vcg::Point2<int> viewport)
|
||||
{
|
||||
cameraType = ORTHO;
|
||||
|
|
|
@ -75,6 +75,8 @@ public:
|
|||
RotoType rot; // rotation
|
||||
Point3<S> tra; // viewpoint
|
||||
public:
|
||||
ReferenceFrame(){}
|
||||
|
||||
void SetIdentity(){ rot.SetIdentity(); tra = Point3<S>(0.0,0.0,0.0);}
|
||||
void SetTra(const Point3<S> & tr) {tra = tr;}
|
||||
void SetRot(const RotoType & rt) {rot = rt;}
|
||||
|
@ -82,11 +84,15 @@ public:
|
|||
RotoType Rot() const { return rot;}
|
||||
};
|
||||
|
||||
Camera<S> Intrinsics; // the camera that made the shot
|
||||
ReferenceFrame<S,RotationType> Extrinsics; // the position and orientation of the camera
|
||||
Camera<S> Intrinsics; // the camera that made the shot
|
||||
ReferenceFrame<S,RotationType> Extrinsics; // the position and orientation of the camera
|
||||
Shot(const Camera<S> &i, const ReferenceFrame<S,RotationType> &e)
|
||||
{
|
||||
Intrinsics = i;
|
||||
Extrinsics = e;
|
||||
}
|
||||
|
||||
|
||||
Shot(Camera<S> c)
|
||||
Shot(const Camera<S> &c)
|
||||
{
|
||||
Intrinsics = c;
|
||||
Extrinsics.SetIdentity();
|
||||
|
@ -97,6 +103,15 @@ public:
|
|||
Extrinsics.SetIdentity();
|
||||
}
|
||||
|
||||
template <class Q>
|
||||
static inline Shot Construct( const Shot<Q> & b )
|
||||
{
|
||||
ReferenceFrame<S,RotationType> r;
|
||||
r.SetRot(Matrix44<S>::Construct(b.Extrinsics.Rot()));
|
||||
r.SetTra(Point3<S>::Construct(b.Extrinsics.Tra()));
|
||||
return Shot(Camera<S>::Construct(b.Intrinsics), r);
|
||||
}
|
||||
|
||||
|
||||
/// GET the i-th axis of the coordinate system of the camera
|
||||
vcg::Point3<S> Axis(const int & i)const;
|
||||
|
|
Loading…
Reference in New Issue