Code

No more NRMatrix or NRPoint.
[inkscape.git] / src / libnr / nr-matrix-fns.h
1 #ifndef SEEN_NR_MATRIX_FNS_H
2 #define SEEN_NR_MATRIX_FNS_H
4 #include "nr-matrix.h"
5 #include <math.h>
7 namespace NR {
9 /** Given a matrix m such that unit_circle = m*x, this returns the
10  * quadratic form x*A*x = 1. */
11 Matrix elliptic_quadratic_form(Matrix const &m);
13 /** Given a matrix (ignoring the translation) this returns the eigen
14  * values and vectors. */
15 class Eigen{
16 public:
17     Point vectors[2];
18     Point values;
19     Eigen(Matrix const &m);
20 };
22 // Matrix factories
23 Matrix from_basis(const Point x_basis, const Point y_basis, const Point offset=Point(0,0));
25 Matrix identity();
27 double expansion(Matrix const &m);
28 inline double expansionX(Matrix const &m) { return hypot(m[0], m[1]); }
29 inline double expansionY(Matrix const &m) { return hypot(m[2], m[3]); }
31 bool transform_equalp(Matrix const &m0, Matrix const &m1, NR::Coord const epsilon);
32 bool translate_equalp(Matrix const &m0, Matrix const &m1, NR::Coord const epsilon);
33 bool matrix_equalp(Matrix const &m0, Matrix const &m1, NR::Coord const epsilon);
35 Matrix transform(Matrix const &m);
36 translate get_translation(Matrix const &m);
38 void matrix_print(const gchar *say, Matrix const &m);
40 }  // namespace NR
42 #endif /* !SEEN_NR_MATRIX_FNS_H */
44 /*
45   Local Variables:
46   mode:c++
47   c-file-style:"stroustrup"
48   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
49   indent-tabs-mode:nil
50   fill-column:99
51   End:
52 */
53 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :