21 for (
unsigned int i = 0; i < 3; ++i) {
22 for (
unsigned int j = 0; j < 4; ++j) {
23 tmat[i][j] = (i == j ? 1 : 0);
29 for (
unsigned int i = 0; i < 3; ++i) {
38 for (
unsigned int i = 0; i < 3; ++i) {
39 for (
unsigned int j = 0; j < 4; ++j) {
52 double x =
tmat[0][0] * point[0] +
tmat[0][1] * point[1] +
tmat[0][2] * point[2] +
tmat[0][3] * point[3];
53 double y =
tmat[1][0] * point[0] +
tmat[1][1] * point[1] +
tmat[1][2] * point[2] +
tmat[1][3] * point[3];
54 double w =
tmat[2][0] * point[0] +
tmat[2][1] * point[1] +
tmat[2][2] * point[2] +
tmat[2][3] * point[3];
61 const double init_val = std::numeric_limits<double>::quiet_NaN();
62 double x[4] = { init_val, init_val, init_val, init_val };
64 int index = (int) axis;
70 g_warning (
"No solution. Please investigate.");
72 g_warning (
"Infinitely many solutions. Please investigate.");
75 return Pt3(x[0], x[1], x[2], x[3]);
81 for (
int i = 0; i < 3; ++i) {
82 tmat[i][axis] = pt[i];
88 g_return_if_fail (axis !=
Proj::W);
106 os <<
tmat[0][axis] <<
" : "
107 <<
tmat[1][axis] <<
" : "
109 return g_strdup(os.
str().c_str());
117 for (
int i = 0; i < 3; ++i) {
133 for (
int j = 0; j < 4; ++j) {
152 for (
int i = 0; i < 3; ++i) {
153 for (
int j = 0; j < 4; ++j) {
154 rhs[i][j] =
tmat[i][j];
161 g_print (
"Transformation matrix:\n");
162 for (
const auto & i :
tmat) {
165 g_print (
"%8.2f ", j);
3x3 affine transformation matrix.
3x3 matrix representing an affine transformation.
Two-dimensional point that doubles as a vector.
Pt2 column(Proj::Axis axis) const
void toggle_finite(Proj::Axis axis)
TransfMat3x4 & operator*=(Geom::Affine const &A)
Pt3 preimage(Geom::Point const &pt, double coord=0, Axis=Z)
void normalize_column(Proj::Axis axis)
void set_image_pt(Proj::Axis axis, Proj::Pt2 const &pt)
bool operator==(const TransfMat3x4 &rhs) const
Pt2 image(Pt3 const &point)
bool has_finite_image(Proj::Axis axis)
void copy_tmat(double rhs[3][4])
void set_column(Proj::Axis axis, Proj::Pt2 pt)
TransfMat3x4 operator*(Geom::Affine const &A) const
char * pt_to_str(Proj::Axis axis)
Generic auxiliary routines for 3D axes.
TODO: insert short description here.