7 #include "../math/utility.h"
8 #include "../math/LinearTransformations.h"
9 #include "../math/methods.h"
10 #include "../oo/ObjBase.h"
32 Myself(): fixed2D_(2) {
35 Myself(Myself
const& v):
36 photo_(v.photo_), rot_(v.rot_), fixed2D_(v.fixed2D_) {
90 return self()->photo_;
97 self()->photo_.copyFrom(pho);
127 return self->fixed2D_;
134 return self()->fixed2D_;
151 return self->fixed2D_.identityPoint(i);
158 return self->photo_.inside(
166 return self->photo_.color(
181 bool write(FILE* f,
bool bin,
unsigned int fg)
const {
184 for (
size_t i = 0; i < 3; ++i) {
185 if (fwrite(&(tmp =
rotation().theta(i)),
sizeof(tmp), 1, f) < 1)
190 for (
size_t i = 0; i < 3; ++i) {
191 if (fprintf(f,
"%f ",
rotation().theta(i)) < 1)
return false;
202 bool read(FILE* f,
bool bin,
unsigned int fg) {
205 for (
size_t i = 0; i < 3; ++i) {
206 if (fread(&tmp,
sizeof(tmp), 1, f) < 1) {
214 for (
size_t i = 0; i < 3; ++i) {
215 if (fscanf(f,
"%lf", &a) < 1)
return false;
247 return typeid(*this).name();
255 return std::string(
ctype());
261 #endif // gra_Camera_H__
Rotation3D & copyFrom(Rotation3D const &b)
Copy data.
size_t dimension() const
回傳dimension
Scalar const & theta(size_t i) const
Get the i -th theta.
std::string type() const
回傳class的type
Photo< Pixel > photo() const
取得 photo
把一個 std::map<Identity, Point > 包起來
Rotation3D< double > rotation(Rotation3D< double > const &rot)
設定rotation
Camera & copyFrom(Camera const &b)
複製資料
bool inside(Vector3D< double > const &p) const
詢問某點是否在底片範圍內
Camera & operator=(Camera const &b)
same as copyFrom(b)
Rotation3D< double > rotation() const
取得rotation
bool write(FILE *f, bool bin, unsigned int fg) const
將資料寫入檔案
Rotation3D< double > & rotationGet()
取得rotation (non-constant)
Photo< Pixel > & photoGet()
取得 photo (non-constant)
一切物件的Base, 並要求每個物件都要有read, write, create, ... 等功能
Photo< Pixel > photo(Photo< Pixel > const &pho)
設定 photo
ObjBase * create() const
new一個自己
char const * ctype() const
回傳class的type
Matrix< Scalar > matrix() const
return a 3x1 matrix form of itself
Vector< double > fixedPoint2D(int i)
取得編號為i的fixed points 2d
Pixel color(Vector3D< double > const &p) const
取得底片color
ObjBase * copyFrom(ObjBase const *b)
複製資料
FixedPoints2D fixedPoints2D(FixedPoints2D const &fps2d) const
設定FixedPoint
IdentityPoints & copyFrom(IdentityPoints const &b)
複製資料
FixedPoints2D fixedPoints2D() const
取得所有FixedPoint
bool read(FILE *f, bool bin, unsigned int fg)
將資料讀入
Camera & referenceFrom(Camera const &b)
參照
Camera(Camera const &b)
copy constructor
FixedPoints2D & fixedPoints2DGet() const
取得所有FixedPoint(non-constant reference)
IdentityPoints< int, double, Vector2D< double > > FixedPoints2D