mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 21:53:41 +00:00
common/math: added minor math functions.
This commit is contained in:
parent
bda93d99d9
commit
1b9e6ef5a2
2 changed files with 16 additions and 2 deletions
|
@ -111,3 +111,11 @@ void operator*=(Point& pt, const Matrix& m)
|
||||||
pt.x = tx;
|
pt.x = tx;
|
||||||
pt.y = ty;
|
pt.y = ty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Point operator*(const Point& pt, const Matrix& m)
|
||||||
|
{
|
||||||
|
auto tx = pt.x * m.e11 + pt.y * m.e12 + m.e13;
|
||||||
|
auto ty = pt.x * m.e21 + pt.y * m.e22 + m.e23;
|
||||||
|
return {tx, ty};
|
||||||
|
}
|
|
@ -152,9 +152,9 @@ static inline void operator*=(Matrix& lhs, const Matrix& rhs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static inline void mathLog(Matrix* m)
|
static inline void mathLog(const Matrix& m)
|
||||||
{
|
{
|
||||||
TVGLOG("MATH", "Matrix: [%f %f %f] [%f %f %f] [%f %f %f]", m->e11, m->e12, m->e13, m->e21, m->e22, m->e23, m->e31, m->e32, m->e33);
|
TVGLOG("COMMON", "Matrix: [%f %f %f] [%f %f %f] [%f %f %f]", m.e11, m.e12, m.e13, m.e21, m.e22, m.e23, m.e31, m.e32, m.e33);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -163,6 +163,7 @@ static inline void mathLog(Matrix* m)
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
||||||
void operator*=(Point& pt, const Matrix& m);
|
void operator*=(Point& pt, const Matrix& m);
|
||||||
|
Point operator*(const Point& pt, const Matrix& m);
|
||||||
|
|
||||||
|
|
||||||
static inline bool mathZero(const Point& p)
|
static inline bool mathZero(const Point& p)
|
||||||
|
@ -231,6 +232,11 @@ static inline Point operator/(const Point& lhs, const float rhs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static inline void mathLog(const Point& pt)
|
||||||
|
{
|
||||||
|
TVGLOG("COMMON", "Point: [%f %f]", pt.x, pt.y);
|
||||||
|
}
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/* Interpolation functions */
|
/* Interpolation functions */
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
|
|
Loading…
Add table
Reference in a new issue