37template<
class T, u
int N>
class Vec {
54 template<
class U>
explicit inline Vec(
const U tab[
N])
61 template<
class U>
explicit inline Vec(
const std::vector<U> &tab)
99 return (*
this) * (*this);
265 MEM_CXX_CLASS_ALLOC_FUNCS(
"Freestyle:VecMat:Vec")
274template<
class T>
class Vec2 :
public Vec<T, 2> {
280 template<
class U>
explicit inline Vec2(
const U tab[2]) :
Vec<
T, 2>(tab) {}
282 template<
class U>
explicit inline Vec2(
const std::vector<U> &tab) :
Vec<
T, 2>(tab) {}
376 template<
class U>
explicit inline HVec3(
const U tab[4]) :
Vec<
T, 4>(tab) {}
378 template<
class U>
explicit inline HVec3(
const std::vector<U> &tab) :
Vec<
T, 4>(tab) {}
463template<
class T>
class Vec3 :
public Vec<T, 3> {
469 template<
class U>
explicit inline Vec3(
const U tab[3]) :
Vec<
T, 3>(tab) {}
471 template<
class U>
explicit inline Vec3(
const std::vector<U> &tab) :
Vec<
T, 3>(tab) {}
580 Vec3<T> res((*
this)[1] *
v[2] - (*
this)[2] *
v[1],
581 (*
this)[2] *
v[0] - (*
this)[0] *
v[2],
582 (*
this)[0] *
v[1] - (*
this)[1] *
v[0]);
589 Vec3<T> res((*
this)[1] *
v[2] - (*
this)[2] *
v[1],
590 (*
this)[2] *
v[0] - (*
this)[0] *
v[2],
591 (*
this)[0] *
v[1] - (*
this)[1] *
v[0]);
607template<
class T, u
int M, u
int N>
class Matrix {
631 template<
class U>
explicit inline Matrix(
const std::vector<U> &tab)
641 for (
uint j = 0; j <
N; j++) {
671 for (
uint j = 0; j <
N; j++) {
683 for (
uint j = 0; j <
N; j++) {
694 for (
uint j = 0; j <
N; j++) {
704 for (
uint j = 0; j <
N; j++) {
714 for (
uint j = 0; j <
N; j++) {
725 for (
uint j = 0; j <
N; j++) {
736 MEM_CXX_CLASS_ALLOC_FUNCS(
"Freestyle:VecMat:Matrix")
783template<
class T, u
int N>
inline Vec<T, N>
operator+(
const Vec<T, N> &v1,
const Vec<T, N> &
v2)
790template<
class T, u
int N>
inline Vec<T, N>
operator-(
const Vec<T, N> &v1,
const Vec<T, N> &
v2)
797template<
class T, u
int N>
806template<
class T, u
int N>
815template<
class T, u
int N>
826template<
class T, u
int N>
840 v1[1] *
v2[2] - v1[2] *
v2[1], v1[2] *
v2[0] - v1[0] *
v2[2], v1[0] *
v2[1] - v1[1] *
v2[0]);
850 for (
i = 0;
i <
N - 1;
i++) {
862template<
class T, u
int M, u
int N>
870template<
class T, u
int M, u
int N>
878template<
class T, u
int M, u
int N>
887template<
class T, u
int M, u
int N>
896template<
class T, u
int M, u
int N>
905template<
class T, u
int M, u
int N, u
int P>
912 for (j = 0; j <
P; j++) {
913 for (k = 0; k <
N; k++) {
915 for (
i = 0;
i <
N;
i++) {
916 res(
i, j) += m1(
i, k) * scale;
923template<
class T, u
int M, u
int N>
929 for (
uint j = 0; j <
M; j++) {
932 res[
i] += m(
i, j) * scale;
939template<
class T, u
int M, u
int N>
943 for (
i = 0;
i <
M;
i++) {
945 for (j = 0; j <
N - 1; j++) {
946 s << m(
i, j) <<
", ";
948 s << m(
i, j) <<
"]" << std::endl;
Read Guarded memory(de)allocation.
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert * v
static T sum(const btAlignedObjectArray< T > &items)
HVec3(const Vec< U, 4 > &v)
HVec3(const std::vector< U > &tab)
HVec3(const Vec< U, 3 > &sv, const U s=1)
HVec3(const value_type sx, const value_type sy=0, const value_type sz=0, const value_type s=1)
Vec< uint, 4 >::value_type value_type
Matrix< T, M, N > & operator+=(const Matrix< U, M, N > &m) &
Matrix(const std::vector< U > &tab)
Matrix(const Matrix< U, M, N > &m)
Matrix< T, M, N > & operator*=(const U lambda) &
Matrix(const U tab[_SIZE])
value_type operator()(const uint i, const uint j) const
value_type & operator()(const uint i, const uint j)
Matrix< T, M, N > & operator/=(const U lambda) &
Matrix< T, M, N > & operator-=(const Matrix< U, M, N > &m) &
Matrix< T, M, N > & transpose() const
Matrix< T, M, N > & operator=(const Matrix< U, M, N > &m)
static SquareMatrix< T, N > identity()
SquareMatrix(const std::vector< U > &tab)
SquareMatrix(const Matrix< U, N, N > &m)
SquareMatrix(const U tab[_SIZE])
Vec2< T > operator*(const value_type r) const
value_type operator*(const Vec2< T > &v) const
Vec< uint, 2 >::value_type value_type
void setX(const value_type v)
Vec2(const Vec< U, 2 > &v)
Vec2< T > operator/(const value_type r) const
Vec2< T > operator+(const Vec2< T > &v) const
void setY(const value_type v)
Vec2< T > operator-(const Vec2< T > &v) const
Vec2(const value_type x, const value_type y=0)
Vec2(const std::vector< U > &tab)
Vec3(const std::vector< U > &tab)
Vec3< T > operator^(const Vec3< T > &v) const
Vec< uint, 3 >::value_type value_type
void setX(const value_type v)
value_type operator*(const Vec3< T > &v) const
Vec3< T > operator-(const Vec3< T > &v) const
void setY(const value_type v)
Vec3< T > operator/(const value_type r) const
Vec3< T > operator*(const value_type r) const
Vec3(const value_type x, const value_type y=0, const value_type z=0)
Vec3(const HVec3< U > &v)
Vec3< T > operator^(const Vec< U, 3 > &v) const
void setZ(const value_type v)
Vec3(const Vec< U, 3 > &v)
Vec3< T > operator+(const Vec3< T > &v) const
Vec< T, N > operator+(const Vec< T, N > &v) const
Vec< T, N > & normalizeSafe()
value_type squareNorm() const
Vec< T, N > & operator=(const Vec< U, N > &v)
value_type operator[](const uint i) const
Vec< T, N > operator/(const typename Vec< T, N >::value_type r) const
value_type & operator[](const uint i)
Vec< T, N > & operator/=(const U r) &
Vec< T, N > & operator-=(const Vec< U, N > &v) &
Vec< T, N > operator*(const typename Vec< T, N >::value_type r) const
bool operator>(const Vec< T, N > &v) const
Vec< T, N > operator-(const Vec< T, N > &v) const
Vec(const Vec< U, N > &v)
bool operator!=(const Vec< T, N > &v) const
Vec< T, N > & normalize()
Vec< T, N > & operator+=(const Vec< U, N > &v) &
bool operator==(const Vec< T, N > &v) const
value_type operator*(const Vec< T, N > &v) const
Vec(const std::vector< U > &tab)
Vec< T, N > & operator*=(const U r) &
bool operator<(const Vec< T, N > &v) const
ccl_device_inline float4 operator^(const float4 a, const float4 b)
Matrix< T, M, N > operator/(const Matrix< T, M, N > &m1, const typename Matrix< T, M, N >::value_type lambda)
Matrix< T, M, N > operator+(const Matrix< T, M, N > &m1, const Matrix< T, M, N > &m2)
std::ostream & operator<<(std::ostream &s, const Vec< T, N > &v)
Vec< T, N > operator*(const typename Vec< T, N >::value_type r, const Vec< T, N > &v)
Matrix< T, M, N > operator-(const Matrix< T, M, N > &m1, const Matrix< T, M, N > &m2)