feat():initial version
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
//Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_QVM_995547FAAE0E11DE8CF511E755D89593
|
||||
#define BOOST_QVM_995547FAAE0E11DE8CF511E755D89593
|
||||
|
||||
#include <boost/qvm/detail/determinant_impl.hpp>
|
||||
#include <boost/qvm/mat_traits.hpp>
|
||||
#include <boost/qvm/static_assert.hpp>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
qvm
|
||||
{
|
||||
namespace
|
||||
qvm_detail
|
||||
{
|
||||
template <class A>
|
||||
BOOST_QVM_INLINE_OPERATIONS
|
||||
typename deduce_mat<A>::type
|
||||
cofactor_impl( A const & a )
|
||||
{
|
||||
BOOST_QVM_STATIC_ASSERT(mat_traits<A>::rows==mat_traits<A>::cols);
|
||||
int const N=mat_traits<A>::rows;
|
||||
typedef typename mat_traits<A>::scalar_type T;
|
||||
T c[N-1][N-1];
|
||||
typedef typename deduce_mat<A>::type R;
|
||||
R b;
|
||||
for( int j=0; j!=N; ++j )
|
||||
{
|
||||
for( int i=0; i!=N; ++i )
|
||||
{
|
||||
int i1=0;
|
||||
for( int ii=0; ii!=N; ++ii )
|
||||
{
|
||||
if( ii==i )
|
||||
continue;
|
||||
int j1=0;
|
||||
for( int jj=0; jj!=N; ++jj )
|
||||
{
|
||||
if( jj==j )
|
||||
continue;
|
||||
c[i1][j1] = mat_traits<A>::read_element_idx(ii,jj,a);
|
||||
++j1;
|
||||
}
|
||||
++i1;
|
||||
}
|
||||
T det = determinant_impl(c);
|
||||
if( (i+j)&1 )
|
||||
det=-det;
|
||||
mat_traits<R>::write_element_idx(i,j,b) = det;
|
||||
}
|
||||
}
|
||||
return b;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,79 @@
|
||||
//Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_QVM_3DCF6B90AE0E11DE9A315BE555D89593
|
||||
#define BOOST_QVM_3DCF6B90AE0E11DE9A315BE555D89593
|
||||
|
||||
#include <boost/qvm/inline.hpp>
|
||||
#include <boost/qvm/mat_traits_array.hpp>
|
||||
#include <boost/qvm/static_assert.hpp>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
qvm
|
||||
{
|
||||
namespace
|
||||
qvm_detail
|
||||
{
|
||||
template <int N>
|
||||
struct
|
||||
det_size
|
||||
{
|
||||
};
|
||||
|
||||
template <class M>
|
||||
BOOST_QVM_INLINE_TRIVIAL
|
||||
typename mat_traits<M>::scalar_type
|
||||
determinant_impl_( M const & a, det_size<2> )
|
||||
{
|
||||
return
|
||||
mat_traits<M>::template read_element<0,0>(a) * mat_traits<M>::template read_element<1,1>(a) -
|
||||
mat_traits<M>::template read_element<1,0>(a) * mat_traits<M>::template read_element<0,1>(a);
|
||||
}
|
||||
|
||||
template <class M,int N>
|
||||
BOOST_QVM_INLINE_RECURSION
|
||||
typename mat_traits<M>::scalar_type
|
||||
determinant_impl_( M const & a, det_size<N> )
|
||||
{
|
||||
typedef typename mat_traits<M>::scalar_type T;
|
||||
T m[N-1][N-1];
|
||||
T det=T(0);
|
||||
for( int j1=0; j1!=N; ++j1 )
|
||||
{
|
||||
for( int i=1; i!=N; ++i )
|
||||
{
|
||||
int j2 = 0;
|
||||
for( int j=0; j!=N; ++j )
|
||||
{
|
||||
if( j==j1 )
|
||||
continue;
|
||||
m[i-1][j2] = mat_traits<M>::read_element_idx(i,j,a);
|
||||
++j2;
|
||||
}
|
||||
}
|
||||
T d=determinant_impl_(m,det_size<N-1>());
|
||||
if( j1&1 )
|
||||
d=-d;
|
||||
det += mat_traits<M>::read_element_idx(0,j1,a) * d;
|
||||
}
|
||||
return det;
|
||||
}
|
||||
|
||||
template <class M>
|
||||
BOOST_QVM_INLINE_TRIVIAL
|
||||
typename mat_traits<M>::scalar_type
|
||||
determinant_impl( M const & a )
|
||||
{
|
||||
BOOST_QVM_STATIC_ASSERT(mat_traits<M>::rows==mat_traits<M>::cols);
|
||||
return determinant_impl_(a,det_size<mat_traits<M>::rows>());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
75
install/boost_1_75_0/include/boost/qvm/detail/mat_assign.hpp
Normal file
75
install/boost_1_75_0/include/boost/qvm/detail/mat_assign.hpp
Normal file
@@ -0,0 +1,75 @@
|
||||
//Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_QVM_47136D2C385411E7BA27D3B681262D2E
|
||||
#define BOOST_QVM_47136D2C385411E7BA27D3B681262D2E
|
||||
|
||||
#include <boost/qvm/gen/mat_assign2.hpp>
|
||||
#include <boost/qvm/gen/mat_assign3.hpp>
|
||||
#include <boost/qvm/gen/mat_assign4.hpp>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
qvm
|
||||
{
|
||||
namespace
|
||||
qvm_detail
|
||||
{
|
||||
template <int M,int N>
|
||||
struct
|
||||
assign_mm_defined
|
||||
{
|
||||
static bool const value=false;
|
||||
};
|
||||
|
||||
template <int I,int N>
|
||||
struct
|
||||
copy_matrix_elements
|
||||
{
|
||||
template <class A,class B>
|
||||
static
|
||||
BOOST_QVM_INLINE_CRITICAL
|
||||
void
|
||||
f( A & a, B const & b )
|
||||
{
|
||||
mat_traits<A>::template write_element<I/mat_traits<A>::cols,I%mat_traits<A>::cols>(a) =
|
||||
mat_traits<B>::template read_element<I/mat_traits<B>::cols,I%mat_traits<B>::cols>(b);
|
||||
copy_matrix_elements<I+1,N>::f(a,b);
|
||||
}
|
||||
};
|
||||
|
||||
template <int N>
|
||||
struct
|
||||
copy_matrix_elements<N,N>
|
||||
{
|
||||
template <class A,class B>
|
||||
static
|
||||
BOOST_QVM_INLINE_CRITICAL
|
||||
void
|
||||
f( A &, B const & )
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
template <class A,class B>
|
||||
BOOST_QVM_INLINE_TRIVIAL
|
||||
typename boost::enable_if_c<
|
||||
is_mat<A>::value && is_mat<B>::value &&
|
||||
mat_traits<A>::rows==mat_traits<B>::rows &&
|
||||
mat_traits<A>::cols==mat_traits<B>::cols &&
|
||||
!qvm_detail::assign_mm_defined<mat_traits<A>::rows,mat_traits<A>::cols>::value,
|
||||
A &>::type
|
||||
assign( A & a, B const & b )
|
||||
{
|
||||
qvm_detail::copy_matrix_elements<0,mat_traits<A>::rows*mat_traits<A>::cols>::f(a,b);
|
||||
return a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,35 @@
|
||||
//Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_QVM_86A42DA4385511E7822024B881262D2E
|
||||
#define BOOST_QVM_86A42DA4385511E7822024B881262D2E
|
||||
|
||||
#include <boost/qvm/inline.hpp>
|
||||
#include <boost/qvm/enable_if.hpp>
|
||||
#include <boost/qvm/quat_traits.hpp>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
qvm
|
||||
{
|
||||
template <class A,class B>
|
||||
BOOST_QVM_INLINE_OPERATIONS
|
||||
typename enable_if_c<
|
||||
is_quat<A>::value && is_quat<B>::value,
|
||||
A &>::type
|
||||
assign( A & a, B const & b )
|
||||
{
|
||||
quat_traits<A>::template write_element<0>(a) = quat_traits<B>::template read_element<0>(b);
|
||||
quat_traits<A>::template write_element<1>(a) = quat_traits<B>::template read_element<1>(b);
|
||||
quat_traits<A>::template write_element<2>(a) = quat_traits<B>::template read_element<2>(b);
|
||||
quat_traits<A>::template write_element<3>(a) = quat_traits<B>::template read_element<3>(b);
|
||||
return a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,35 @@
|
||||
//Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_QVM_4E340430AE4C11DEBA56149755D89593
|
||||
#define BOOST_QVM_4E340430AE4C11DEBA56149755D89593
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
qvm
|
||||
{
|
||||
namespace
|
||||
qvm_detail
|
||||
{
|
||||
template <class T>
|
||||
struct
|
||||
remove_const
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct
|
||||
remove_const<T const>
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
338
install/boost_1_75_0/include/boost/qvm/detail/swizzle_traits.hpp
Normal file
338
install/boost_1_75_0/include/boost/qvm/detail/swizzle_traits.hpp
Normal file
@@ -0,0 +1,338 @@
|
||||
//Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_QVM_E831FAD6B38F11DE8CECBF0D56D89593
|
||||
#define BOOST_QVM_E831FAD6B38F11DE8CECBF0D56D89593
|
||||
|
||||
#include <boost/qvm/inline.hpp>
|
||||
#include <boost/qvm/deduce_vec.hpp>
|
||||
#include <boost/qvm/enable_if.hpp>
|
||||
#include <boost/qvm/assert.hpp>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
qvm
|
||||
{
|
||||
namespace
|
||||
qvm_detail
|
||||
{
|
||||
BOOST_QVM_INLINE_CRITICAL
|
||||
void const *
|
||||
get_null()
|
||||
{
|
||||
static int const obj=0;
|
||||
return &obj;
|
||||
}
|
||||
|
||||
template <int A,class Next=void> struct swizzle_idx { static int const value=A; typedef Next next; };
|
||||
|
||||
template <class V,int Idx>
|
||||
struct
|
||||
const_value
|
||||
{
|
||||
static
|
||||
BOOST_QVM_INLINE_TRIVIAL
|
||||
typename vec_traits<V>::scalar_type
|
||||
value()
|
||||
{
|
||||
BOOST_QVM_ASSERT(0);
|
||||
return typename vec_traits<V>::scalar_type();
|
||||
}
|
||||
};
|
||||
|
||||
template <class V>
|
||||
struct
|
||||
const_value<V,-1>
|
||||
{
|
||||
static
|
||||
BOOST_QVM_INLINE_TRIVIAL
|
||||
typename vec_traits<V>::scalar_type
|
||||
value()
|
||||
{
|
||||
return scalar_traits<typename vec_traits<V>::scalar_type>::value(0);
|
||||
}
|
||||
};
|
||||
|
||||
template <class V>
|
||||
struct
|
||||
const_value<V,-2>
|
||||
{
|
||||
static
|
||||
BOOST_QVM_INLINE_TRIVIAL
|
||||
typename vec_traits<V>::scalar_type
|
||||
value()
|
||||
{
|
||||
return scalar_traits<typename vec_traits<V>::scalar_type>::value(1);
|
||||
}
|
||||
};
|
||||
|
||||
template <int Index,bool Neg=(Index<0)>
|
||||
struct neg_zero;
|
||||
|
||||
template <int Index>
|
||||
struct
|
||||
neg_zero<Index,true>
|
||||
{
|
||||
static int const value=0;
|
||||
};
|
||||
|
||||
template <int Index>
|
||||
struct
|
||||
neg_zero<Index,false>
|
||||
{
|
||||
static int const value=Index;
|
||||
};
|
||||
|
||||
template <class SwizzleList,int Index,int C=0>
|
||||
struct
|
||||
swizzle
|
||||
{
|
||||
static int const value=swizzle<typename SwizzleList::next,Index,C+1>::value;
|
||||
};
|
||||
|
||||
template <class SwizzleList,int Match>
|
||||
struct
|
||||
swizzle<SwizzleList,Match,Match>
|
||||
{
|
||||
static int const value=SwizzleList::value;
|
||||
};
|
||||
|
||||
template <int Index,int C>
|
||||
struct swizzle<void,Index,C>;
|
||||
|
||||
template <class SwizzleList,int C=0>
|
||||
struct
|
||||
swizzle_list_length
|
||||
{
|
||||
static int const value=swizzle_list_length<typename SwizzleList::next,C+1>::value;
|
||||
};
|
||||
|
||||
template <int C>
|
||||
struct
|
||||
swizzle_list_length<void,C>
|
||||
{
|
||||
static int const value=C;
|
||||
};
|
||||
|
||||
template <class SwizzleList,int D>
|
||||
struct
|
||||
validate_swizzle_list
|
||||
{
|
||||
static bool const value =
|
||||
((SwizzleList::value)<D) && //don't touch extra (), MSVC parsing bug.
|
||||
validate_swizzle_list<typename SwizzleList::next,D>::value;
|
||||
};
|
||||
|
||||
template <int D>
|
||||
struct
|
||||
validate_swizzle_list<void,D>
|
||||
{
|
||||
static bool const value=true;
|
||||
};
|
||||
|
||||
template <class OriginalType,class SwizzleList>
|
||||
class
|
||||
sw_
|
||||
{
|
||||
sw_( sw_ const & );
|
||||
sw_ & operator=( sw_ const & );
|
||||
~sw_();
|
||||
|
||||
BOOST_QVM_STATIC_ASSERT((validate_swizzle_list<SwizzleList,vec_traits<OriginalType>::dim>::value));
|
||||
|
||||
public:
|
||||
|
||||
template <class T>
|
||||
BOOST_QVM_INLINE_TRIVIAL
|
||||
sw_ &
|
||||
operator=( T const & x )
|
||||
{
|
||||
assign(*this,x);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class R>
|
||||
BOOST_QVM_INLINE_TRIVIAL
|
||||
operator R() const
|
||||
{
|
||||
R r;
|
||||
assign(r,*this);
|
||||
return r;
|
||||
}
|
||||
};
|
||||
|
||||
template <class SwizzleList>
|
||||
class
|
||||
sw01_
|
||||
{
|
||||
sw01_( sw01_ const & );
|
||||
sw01_ & operator=( sw01_ const & );
|
||||
~sw01_();
|
||||
|
||||
public:
|
||||
|
||||
template <class R>
|
||||
BOOST_QVM_INLINE_TRIVIAL
|
||||
operator R() const
|
||||
{
|
||||
R r;
|
||||
assign(r,*this);
|
||||
return r;
|
||||
}
|
||||
};
|
||||
|
||||
template <class OriginalType,class SwizzleList>
|
||||
class
|
||||
sws_
|
||||
{
|
||||
sws_( sws_ const & );
|
||||
sws_ & operator=( sws_ const & );
|
||||
~sws_();
|
||||
|
||||
BOOST_QVM_STATIC_ASSERT((validate_swizzle_list<SwizzleList,1>::value));
|
||||
|
||||
public:
|
||||
|
||||
template <class R>
|
||||
BOOST_QVM_INLINE_TRIVIAL
|
||||
operator R() const
|
||||
{
|
||||
R r;
|
||||
assign(r,*this);
|
||||
return r;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
template <class OriginalVector,class SwizzleList>
|
||||
struct
|
||||
vec_traits<qvm_detail::sw_<OriginalVector,SwizzleList> >
|
||||
{
|
||||
typedef qvm_detail::sw_<OriginalVector,SwizzleList> this_vector;
|
||||
typedef typename vec_traits<OriginalVector>::scalar_type scalar_type;
|
||||
static int const dim=qvm_detail::swizzle_list_length<SwizzleList>::value;
|
||||
|
||||
template <int I>
|
||||
static
|
||||
BOOST_QVM_INLINE_CRITICAL
|
||||
scalar_type
|
||||
read_element( this_vector const & x )
|
||||
{
|
||||
BOOST_QVM_STATIC_ASSERT(I>=0);
|
||||
BOOST_QVM_STATIC_ASSERT(I<dim);
|
||||
int const idx=qvm_detail::swizzle<SwizzleList,I>::value;
|
||||
BOOST_QVM_STATIC_ASSERT(idx<vec_traits<OriginalVector>::dim);
|
||||
return idx>=0?
|
||||
vec_traits<OriginalVector>::template read_element<qvm_detail::neg_zero<idx>::value>(reinterpret_cast<OriginalVector const &>(x)) :
|
||||
qvm_detail::const_value<this_vector,idx>::value();
|
||||
}
|
||||
|
||||
template <int I>
|
||||
static
|
||||
BOOST_QVM_INLINE_CRITICAL
|
||||
scalar_type &
|
||||
write_element( this_vector & x )
|
||||
{
|
||||
BOOST_QVM_STATIC_ASSERT(I>=0);
|
||||
BOOST_QVM_STATIC_ASSERT(I<dim);
|
||||
int const idx=qvm_detail::swizzle<SwizzleList,I>::value;
|
||||
BOOST_QVM_STATIC_ASSERT(idx>=0);
|
||||
BOOST_QVM_STATIC_ASSERT(idx<vec_traits<OriginalVector>::dim);
|
||||
return vec_traits<OriginalVector>::template write_element<idx>(reinterpret_cast<OriginalVector &>(x));
|
||||
}
|
||||
};
|
||||
|
||||
template <class SwizzleList>
|
||||
struct
|
||||
vec_traits<qvm_detail::sw01_<SwizzleList> >
|
||||
{
|
||||
typedef qvm_detail::sw01_<SwizzleList> this_vector;
|
||||
typedef int scalar_type;
|
||||
static int const dim=qvm_detail::swizzle_list_length<SwizzleList>::value;
|
||||
|
||||
template <int I>
|
||||
static
|
||||
BOOST_QVM_INLINE_CRITICAL
|
||||
scalar_type
|
||||
read_element( this_vector const & )
|
||||
{
|
||||
BOOST_QVM_STATIC_ASSERT(I>=0);
|
||||
BOOST_QVM_STATIC_ASSERT(I<dim);
|
||||
int const idx=qvm_detail::swizzle<SwizzleList,I>::value;
|
||||
BOOST_QVM_STATIC_ASSERT(idx<0);
|
||||
return qvm_detail::const_value<this_vector,idx>::value();
|
||||
}
|
||||
};
|
||||
|
||||
template <class OriginalScalar,class SwizzleList>
|
||||
struct
|
||||
vec_traits<qvm_detail::sws_<OriginalScalar,SwizzleList> >
|
||||
{
|
||||
typedef qvm_detail::sws_<OriginalScalar,SwizzleList> this_vector;
|
||||
typedef OriginalScalar scalar_type;
|
||||
static int const dim=qvm_detail::swizzle_list_length<SwizzleList>::value;
|
||||
|
||||
template <int I>
|
||||
static
|
||||
BOOST_QVM_INLINE_CRITICAL
|
||||
scalar_type
|
||||
read_element( this_vector const & x )
|
||||
{
|
||||
BOOST_QVM_STATIC_ASSERT(I>=0);
|
||||
BOOST_QVM_STATIC_ASSERT(I<dim);
|
||||
int const idx=qvm_detail::swizzle<SwizzleList,I>::value;
|
||||
BOOST_QVM_STATIC_ASSERT(idx<1);
|
||||
return idx==0?
|
||||
reinterpret_cast<OriginalScalar const &>(x) :
|
||||
qvm_detail::const_value<this_vector,idx>::value();
|
||||
}
|
||||
|
||||
template <int I>
|
||||
static
|
||||
BOOST_QVM_INLINE_CRITICAL
|
||||
scalar_type &
|
||||
write_element( this_vector & x )
|
||||
{
|
||||
BOOST_QVM_STATIC_ASSERT(I>=0);
|
||||
BOOST_QVM_STATIC_ASSERT(I<dim);
|
||||
int const idx=qvm_detail::swizzle<SwizzleList,I>::value;
|
||||
BOOST_QVM_STATIC_ASSERT(idx==0);
|
||||
return reinterpret_cast<OriginalScalar &>(x);
|
||||
}
|
||||
};
|
||||
|
||||
template <class OriginalVector,class SwizzleList,int D>
|
||||
struct
|
||||
deduce_vec<qvm_detail::sw_<OriginalVector,SwizzleList>,D>
|
||||
{
|
||||
typedef vec<typename vec_traits<OriginalVector>::scalar_type,D> type;
|
||||
};
|
||||
|
||||
template <class OriginalVector,class SwizzleList,int D>
|
||||
struct
|
||||
deduce_vec2<qvm_detail::sw_<OriginalVector,SwizzleList>,qvm_detail::sw_<OriginalVector,SwizzleList>,D>
|
||||
{
|
||||
typedef vec<typename vec_traits<OriginalVector>::scalar_type,D> type;
|
||||
};
|
||||
|
||||
template <class Scalar,class SwizzleList,int D>
|
||||
struct
|
||||
deduce_vec<qvm_detail::sws_<Scalar,SwizzleList>,D>
|
||||
{
|
||||
typedef vec<Scalar,D> type;
|
||||
};
|
||||
|
||||
template <class Scalar,class SwizzleList,int D>
|
||||
struct
|
||||
deduce_vec2<qvm_detail::sws_<Scalar,SwizzleList>,qvm_detail::sws_<Scalar,SwizzleList>,D>
|
||||
{
|
||||
typedef vec<Scalar,D> type;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
128
install/boost_1_75_0/include/boost/qvm/detail/transp_impl.hpp
Normal file
128
install/boost_1_75_0/include/boost/qvm/detail/transp_impl.hpp
Normal file
@@ -0,0 +1,128 @@
|
||||
//Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_QVM_B3B8081A277711E09E007F2DDFD72085
|
||||
#define BOOST_QVM_B3B8081A277711E09E007F2DDFD72085
|
||||
|
||||
#include <boost/qvm/deduce_mat.hpp>
|
||||
#include <boost/qvm/static_assert.hpp>
|
||||
#include <boost/qvm/assert.hpp>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
qvm
|
||||
{
|
||||
namespace
|
||||
qvm_detail
|
||||
{
|
||||
template <class OriginalMatrix>
|
||||
class
|
||||
transposed_
|
||||
{
|
||||
transposed_( transposed_ const & );
|
||||
transposed_ & operator=( transposed_ const & );
|
||||
~transposed_();
|
||||
|
||||
public:
|
||||
|
||||
template <class T>
|
||||
BOOST_QVM_INLINE_TRIVIAL
|
||||
transposed_ &
|
||||
operator=( T const & x )
|
||||
{
|
||||
assign(*this,x);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class R>
|
||||
BOOST_QVM_INLINE_TRIVIAL
|
||||
operator R() const
|
||||
{
|
||||
R r;
|
||||
assign(r,*this);
|
||||
return r;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
template <class OriginalMatrix>
|
||||
struct
|
||||
mat_traits< qvm_detail::transposed_<OriginalMatrix> >
|
||||
{
|
||||
typedef typename mat_traits<OriginalMatrix>::scalar_type scalar_type;
|
||||
typedef qvm_detail::transposed_<OriginalMatrix> this_matrix;
|
||||
static int const rows=mat_traits<OriginalMatrix>::cols;
|
||||
static int const cols=mat_traits<OriginalMatrix>::rows;
|
||||
|
||||
template <int Row,int Col>
|
||||
static
|
||||
BOOST_QVM_INLINE_CRITICAL
|
||||
scalar_type
|
||||
read_element( this_matrix const & x )
|
||||
{
|
||||
BOOST_QVM_STATIC_ASSERT(Row>=0);
|
||||
BOOST_QVM_STATIC_ASSERT(Row<rows);
|
||||
BOOST_QVM_STATIC_ASSERT(Col>=0);
|
||||
BOOST_QVM_STATIC_ASSERT(Col<cols);
|
||||
return mat_traits<OriginalMatrix>::template read_element<Col,Row>(reinterpret_cast<OriginalMatrix const &>(x));
|
||||
}
|
||||
|
||||
template <int Row,int Col>
|
||||
static
|
||||
BOOST_QVM_INLINE_CRITICAL
|
||||
scalar_type &
|
||||
write_element( this_matrix & x )
|
||||
{
|
||||
BOOST_QVM_STATIC_ASSERT(Row>=0);
|
||||
BOOST_QVM_STATIC_ASSERT(Row<rows);
|
||||
BOOST_QVM_STATIC_ASSERT(Col>=0);
|
||||
BOOST_QVM_STATIC_ASSERT(Col<cols);
|
||||
return mat_traits<OriginalMatrix>::template write_element<Col,Row>(reinterpret_cast<OriginalMatrix &>(x));
|
||||
}
|
||||
|
||||
static
|
||||
BOOST_QVM_INLINE_CRITICAL
|
||||
scalar_type
|
||||
read_element_idx( int row, int col, this_matrix const & x )
|
||||
{
|
||||
BOOST_QVM_ASSERT(row>=0);
|
||||
BOOST_QVM_ASSERT(row<rows);
|
||||
BOOST_QVM_ASSERT(col>=0);
|
||||
BOOST_QVM_ASSERT(col<cols);
|
||||
return mat_traits<OriginalMatrix>::read_element_idx(col,row,reinterpret_cast<OriginalMatrix const &>(x));
|
||||
}
|
||||
|
||||
static
|
||||
BOOST_QVM_INLINE_CRITICAL
|
||||
scalar_type &
|
||||
write_element_idx( int row, int col, this_matrix & x )
|
||||
{
|
||||
BOOST_QVM_ASSERT(row>=0);
|
||||
BOOST_QVM_ASSERT(row<rows);
|
||||
BOOST_QVM_ASSERT(col>=0);
|
||||
BOOST_QVM_ASSERT(col<cols);
|
||||
return mat_traits<OriginalMatrix>::write_element_idx(col,row,reinterpret_cast<OriginalMatrix &>(x));
|
||||
}
|
||||
};
|
||||
|
||||
template <class OriginalMatrix,int R,int C>
|
||||
struct
|
||||
deduce_mat<qvm_detail::transposed_<OriginalMatrix>,R,C>
|
||||
{
|
||||
typedef mat<typename mat_traits<OriginalMatrix>::scalar_type,R,C> type;
|
||||
};
|
||||
|
||||
template <class OriginalMatrix,int R,int C>
|
||||
struct
|
||||
deduce_mat2<qvm_detail::transposed_<OriginalMatrix>,qvm_detail::transposed_<OriginalMatrix>,R,C>
|
||||
{
|
||||
typedef mat<typename mat_traits<OriginalMatrix>::scalar_type,R,C> type;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
71
install/boost_1_75_0/include/boost/qvm/detail/vec_assign.hpp
Normal file
71
install/boost_1_75_0/include/boost/qvm/detail/vec_assign.hpp
Normal file
@@ -0,0 +1,71 @@
|
||||
//Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_QVM_185557CE385511E780ACD7B781262D2E
|
||||
#define BOOST_QVM_185557CE385511E780ACD7B781262D2E
|
||||
|
||||
#include <boost/qvm/gen/vec_assign2.hpp>
|
||||
#include <boost/qvm/gen/vec_assign3.hpp>
|
||||
#include <boost/qvm/gen/vec_assign4.hpp>
|
||||
|
||||
namespace
|
||||
boost
|
||||
{
|
||||
namespace
|
||||
qvm
|
||||
{
|
||||
namespace
|
||||
qvm_detail
|
||||
{
|
||||
template <int D>
|
||||
struct
|
||||
assign_vv_defined
|
||||
{
|
||||
static bool const value=false;
|
||||
};
|
||||
|
||||
template <int I,int N>
|
||||
struct
|
||||
copy_vector_elements
|
||||
{
|
||||
template <class A,class B>
|
||||
static
|
||||
void
|
||||
f( A & a, B const & b )
|
||||
{
|
||||
vec_traits<A>::template write_element<I>(a)=vec_traits<B>::template read_element<I>(b);
|
||||
copy_vector_elements<I+1,N>::f(a,b);
|
||||
}
|
||||
};
|
||||
|
||||
template <int N>
|
||||
struct
|
||||
copy_vector_elements<N,N>
|
||||
{
|
||||
template <class A,class B>
|
||||
static
|
||||
void
|
||||
f( A &, B const & )
|
||||
{
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
template <class A,class B>
|
||||
inline
|
||||
typename boost::enable_if_c<
|
||||
is_vec<A>::value && is_vec<B>::value &&
|
||||
vec_traits<A>::dim==vec_traits<B>::dim &&
|
||||
!qvm_detail::assign_vv_defined<vec_traits<A>::dim>::value,
|
||||
A &>::type
|
||||
assign( A & a, B const & b )
|
||||
{
|
||||
qvm_detail::copy_vector_elements<0,vec_traits<A>::dim>::f(a,b);
|
||||
return a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,138 @@
|
||||
//Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.
|
||||
//Copyright (c) 2018 agate-pris
|
||||
|
||||
//Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
//file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_QVM_DETAIL_VEC_REGISTER_IMPL_HPP
|
||||
#define BOOST_QVM_DETAIL_VEC_REGISTER_IMPL_HPP
|
||||
|
||||
#include <boost/qvm/assert.hpp>
|
||||
#include <boost/qvm/inline.hpp>
|
||||
#include <boost/qvm/static_assert.hpp>
|
||||
#include <boost/qvm/vec_traits.hpp>
|
||||
|
||||
namespace boost { namespace qvm { namespace qvm_detail {
|
||||
|
||||
template<class VecType, class ScalarType, int Dim>
|
||||
struct vec_register_common
|
||||
{
|
||||
typedef VecType vec_type;
|
||||
typedef ScalarType scalar_type;
|
||||
static int const dim = Dim;
|
||||
};
|
||||
|
||||
template<class VecType, class ScalarType, int Dim>
|
||||
struct vec_register_read
|
||||
{
|
||||
template<int I> static ScalarType read_element(VecType const& v);
|
||||
|
||||
template<int I, int N> struct read_element_idx_detail
|
||||
{
|
||||
static BOOST_QVM_INLINE_CRITICAL ScalarType impl(int const i, VecType const& v)
|
||||
{
|
||||
return I == i
|
||||
? read_element<I>(v)
|
||||
: read_element_idx_detail<I + 1, N>::impl(i, v);
|
||||
}
|
||||
};
|
||||
|
||||
template<int N> struct read_element_idx_detail<N, N>
|
||||
{
|
||||
static BOOST_QVM_INLINE_TRIVIAL ScalarType impl(int, VecType const& v)
|
||||
{
|
||||
BOOST_QVM_ASSERT(0);
|
||||
return read_element<0>(v);
|
||||
}
|
||||
};
|
||||
|
||||
static BOOST_QVM_INLINE_CRITICAL ScalarType read_element_idx(int const i, VecType const& v)
|
||||
{
|
||||
return read_element_idx_detail<0, Dim>::impl(i, v);
|
||||
}
|
||||
};
|
||||
|
||||
template<class VecType, class ScalarType, int Dim>
|
||||
struct vec_register_write
|
||||
{
|
||||
template<int I> static ScalarType& write_element(VecType& v);
|
||||
|
||||
template<int I, int N> struct write_element_idx_detail
|
||||
{
|
||||
static BOOST_QVM_INLINE_CRITICAL ScalarType& impl(int const i, VecType& v)
|
||||
{
|
||||
return I == i
|
||||
? write_element<I>(v)
|
||||
: write_element_idx_detail<I + 1, N>::impl(i, v);
|
||||
}
|
||||
};
|
||||
|
||||
template<int N> struct write_element_idx_detail<N, N>
|
||||
{
|
||||
static BOOST_QVM_INLINE_TRIVIAL ScalarType& impl(int, VecType& v)
|
||||
{
|
||||
BOOST_QVM_ASSERT(0);
|
||||
return write_element<0>(v);
|
||||
}
|
||||
};
|
||||
|
||||
static BOOST_QVM_INLINE_CRITICAL ScalarType& write_element_idx(int const i, VecType& v)
|
||||
{
|
||||
return write_element_idx_detail<0, Dim>::impl(i, v);
|
||||
}
|
||||
};
|
||||
|
||||
}}}
|
||||
|
||||
#define BOOST_QVM_DETAIL_SPECIALIZE_QVM_DETAIL_VEC_REGISTER_READ(VecType, ScalarType, Dim, I, Read) \
|
||||
namespace boost { namespace qvm {namespace qvm_detail{ \
|
||||
template<> \
|
||||
template<> \
|
||||
BOOST_QVM_INLINE_CRITICAL \
|
||||
ScalarType vec_register_read<VecType, ScalarType, Dim>::read_element<I>(VecType const& v) \
|
||||
{ \
|
||||
BOOST_QVM_STATIC_ASSERT(I>=0); \
|
||||
BOOST_QVM_STATIC_ASSERT(I<Dim); \
|
||||
return v. Read; \
|
||||
} \
|
||||
}}}
|
||||
|
||||
#define BOOST_QVM_DETAIL_SPECIALIZE_QVM_DETAIL_VEC_REGISTER_WRITE(VecType, ScalarType, Dim, I, Write) \
|
||||
namespace boost { namespace qvm {namespace qvm_detail{ \
|
||||
template<> \
|
||||
template<> \
|
||||
BOOST_QVM_INLINE_CRITICAL \
|
||||
ScalarType& vec_register_write<VecType, ScalarType, Dim>::write_element<I>(VecType& v) \
|
||||
{ \
|
||||
BOOST_QVM_STATIC_ASSERT(I>=0); \
|
||||
BOOST_QVM_STATIC_ASSERT(I<Dim); \
|
||||
return v. Write; \
|
||||
}; \
|
||||
}}}
|
||||
|
||||
#define BOOST_QVM_DETAIL_SPECIALIZE_QVM_DETAIL_VEC_REGISTER_READ_WRITE(VecType, ScalarType, Dim, I, Read, Write)\
|
||||
BOOST_QVM_DETAIL_SPECIALIZE_QVM_DETAIL_VEC_REGISTER_READ(VecType, ScalarType, Dim, I, Read) \
|
||||
BOOST_QVM_DETAIL_SPECIALIZE_QVM_DETAIL_VEC_REGISTER_WRITE(VecType, ScalarType, Dim, I, Write)
|
||||
|
||||
#define BOOST_QVM_DETAIL_REGISTER_VEC_SPECIALIZE_VEC_TRAITS_READ(VecType, ScalarType, Dim) \
|
||||
namespace boost { namespace qvm { \
|
||||
template<> \
|
||||
struct vec_traits<VecType> \
|
||||
: qvm_detail::vec_register_common<VecType, ScalarType, Dim> \
|
||||
, qvm_detail::vec_register_read<VecType, ScalarType, Dim> \
|
||||
{ \
|
||||
}; \
|
||||
}}
|
||||
|
||||
#define BOOST_QVM_DETAIL_REGISTER_VEC_SPECIALIZE_VEC_TRAITS_READ_WRITE(VecType, ScalarType, Dim)\
|
||||
namespace boost { namespace qvm { \
|
||||
template<> \
|
||||
struct vec_traits<VecType> \
|
||||
: qvm_detail::vec_register_common<VecType, ScalarType, Dim> \
|
||||
, qvm_detail::vec_register_read<VecType, ScalarType, Dim> \
|
||||
, qvm_detail::vec_register_write<VecType, ScalarType, Dim> \
|
||||
{ \
|
||||
}; \
|
||||
}}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user