1 #ifndef DataFormat_Math_ExtVec_H
2 #define DataFormat_Math_ExtVec_H
7 typedef
float __attribute__( ( vector_size( 16 ) ) ) float32x4_t;
8 typedef
float __attribute__( ( vector_size( 32 ) ) ) float32x8_t;
9 typedef
double __attribute__( ( vector_size( 16 ) ) ) float64x2_t;
10 typedef
double __attribute__( ( vector_size( 32 ) ) ) float64x4_t;
11 typedef
double __attribute__( ( vector_size( 64 ) ) ) float64x8_t;
28 auto
xy(V
v)->
Vec2<typename std::remove_reference<decltype(
v[0])>::type>
42 template<
typename Vec,
typename F>
48 for (
int i=0;
i!=
N;++
i) ret[
i] =
f(v[
i]);
53 template<
typename Vec>
58 Vec x1200{ x[1], x[2], x[0], x[0] };
59 Vec y2010{ y[2], y[0], y[1], y[0] };
60 Vec x2010{ x[2], x[0], x[1], x[0] };
61 Vec y1200{ y[1], y[2], y[0], y[0] };
62 return x1200 * y2010 - x2010 * y1200;
65 template<
typename V1,
typename V2>
68 return x[0]*
y[1]-
x[1]*
y[0];
105 for (
int i=0;
i!=
N;++
i) ret+=
x[
i]*
y[
i];
109 template<
typename V1,
typename V2 >
114 for (
int i=0;
i!=2;++
i) ret+=
x[
i]*
y[
i];
163 constexpr Rot3( T xx, T
xy, T xz, T yx, T yy, T yz, T zx, T zy, T zz) :
193 return Rot3(tr.rotateBack(r.
axis[0]),tr.rotateBack(r.
axis[1]),tr.rotateBack(r.
axis[2]));
197 return Rot3(rotateBack(r.
axis[0]),rotateBack(r.
axis[1]),rotateBack(r.
axis[2]));
209 return lh.rotateBack(rh);
253 return Rot2(tr.rotateBack(r.
axis[0]),tr.rotateBack(r.
axis[1]));
257 return Rot2(rotateBack(r.
axis[0]),rotateBack(r.
axis[1]));
271 return lh.rotateBack(rh);
277 std::ostream &
operator<<(std::ostream &
out, Vec2D
const & v);
278 std::ostream &
operator<<(std::ostream &
out, Vec2F
const & v);
279 std::ostream &
operator<<(std::ostream &
out, Vec4F
const & v);
280 std::ostream &
operator<<(std::ostream &
out, Vec4D
const & v);
282 std::ostream & operator<<(std::ostream & out, As3D<Vec4F>
const &
v);
283 std::ostream & operator<<(std::ostream & out, As3D<Vec4D>
const &
v);
285 std::ostream &
operator<<(std::ostream &
out, Rot3F
const & v);
286 std::ostream &
operator<<(std::ostream &
out, Rot3D
const & v);
287 std::ostream &
operator<<(std::ostream &
out, Rot2F
const & v);
288 std::ostream &
operator<<(std::ostream &
out, Rot2D
const & v);
293 std::ostream &
operator<<(std::ostream &
out, ::Vec4F
const & v) {
294 return out <<
'(' << v[0] <<
", " << v[1] <<
", "<< v[2] <<
", "<< v[3] <<
')';
296 std::ostream &
operator<<(std::ostream &
out, ::Vec4D
const & v) {
297 return out <<
'(' << v[0] <<
", " << v[1] <<
", "<< v[2] <<
", "<< v[3] <<
')';
299 std::ostream &
operator<<(std::ostream &
out, ::Vec2F
const & v) {
300 return out <<
'(' << v[0] <<
", " << v[1] <<
')';
302 std::ostream &
operator<<(std::ostream &
out, ::Vec2D
const & v) {
303 return out <<
'(' << v[0] <<
", " << v[1] <<
')';
306 std::ostream & operator<<(std::ostream & out, ::As3D<Vec4F>
const &
v) {
307 return out <<
'(' << v.v[0] <<
", " << v.v[1] <<
", "<< v.v[2] <<
')';
310 std::ostream & operator<<(std::ostream & out, ::As3D<Vec4D>
const &
v) {
311 return out <<
'(' << v.v[0] <<
", " << v.v[1] <<
", "<< v.v[2] <<
')';
314 std::ostream &
operator<<(std::ostream &
out, ::Rot3F
const & r){
318 std::ostream &
operator<<(std::ostream &
out, ::Rot3D
const & r){
322 std::ostream &
operator<<(std::ostream &
out, ::Rot2F
const & r){
323 return out << r.
axis[0] <<
'\n' << r.
axis[1];
326 std::ostream &
operator<<(std::ostream &
out, ::Rot2D
const & r){
327 return out << r.
axis[0] <<
'\n' << r.
axis[1];
auto cross2(V1 x, V2 y) -> typename std::remove_reference< decltype(x[0])>::type
auto zw(V v) -> Vec2< typenamestd::remove_reference< decltype(v[0])>::type >
typename ExtVecTraits< T, N >::type ExtVec
std::ostream & operator<<(std::ostream &out, const ALILine &li)
T __attribute__((vector_size(N *sizeof(T)))) type
auto dot2(V1 x, V2 y) -> typenamestd::remove_reference< decltype(x[0])>::type
float __attribute__((vector_size(8))) float32x2_t
T dot(const Basic3DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
As3D< V > as3D(V const &v)
MatrixMeschach operator*(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)