1 #ifndef DataFormat_Math_ExtVec_H
2 #define DataFormat_Math_ExtVec_H
7 #define VECTOR_EXT(N) __attribute__( ( ext_vector_type( N ) ) )
9 #define VECTOR_EXT(N) __attribute__( ( vector_size( N ) ) )
54 auto xy(V
v)->
Vec2<typename std::remove_reference<decltype(
v[0])>::type>
68 template<
typename Vec,
typename F>
74 for (
int i=0;
i!=
N;++
i) ret[
i] =
f(v[
i]);
79 template<
typename Vec>
84 Vec x1200{ x[1], x[2], x[0], x[0] };
85 Vec y2010{ y[2], y[0], y[1], y[0] };
86 Vec x2010{ x[2], x[0], x[1], x[0] };
87 Vec y1200{ y[1], y[2], y[0], y[0] };
88 return x1200 * y2010 - x2010 * y1200;
91 template<
typename V1,
typename V2>
94 return x[0]*
y[1]-
x[1]*
y[0];
131 for (
int i=0;
i!=
N;++
i) ret+=
x[
i]*
y[
i];
135 template<
typename V1,
typename V2 >
140 for (
int i=0;
i!=2;++
i) ret+=
x[
i]*
y[
i];
181 axis{ (
Vec){
T(1),0,0,0},
190 axis{ (Vec){xx,
xy,xz,0},
196 return Rot3( axis[0][0], axis[1][0], axis[2][0],
197 axis[0][1], axis[1][1], axis[2][1],
198 axis[0][2], axis[1][2], axis[2][2]
214 return v[0]*axis[0] + v[1]*axis[1] + v[2]*axis[2];
219 return Rot3(tr.rotateBack(r.
axis[0]),tr.rotateBack(r.
axis[1]),tr.rotateBack(r.
axis[2]));
223 return Rot3(rotateBack(r.
axis[0]),rotateBack(r.
axis[1]),rotateBack(r.
axis[2]));
235 return lh.rotateBack(rh);
258 return Rot2( axis[0][0], axis[1][0],
259 axis[0][1], axis[1][1]
274 return v[0]*axis[0] + v[1]*axis[1];
279 return Rot2(tr.rotateBack(r.
axis[0]),tr.rotateBack(r.
axis[1]));
283 return Rot2(rotateBack(r.
axis[0]),rotateBack(r.
axis[1]));
297 return lh.rotateBack(rh);
303 std::ostream &
operator<<(std::ostream &
out, Vec2D
const & v);
304 std::ostream &
operator<<(std::ostream &
out, Vec2F
const & v);
305 std::ostream &
operator<<(std::ostream &
out, Vec4F
const & v);
306 std::ostream &
operator<<(std::ostream &
out, Vec4D
const & v);
308 std::ostream & operator<<(std::ostream & out, As3D<Vec4F>
const &
v);
309 std::ostream & operator<<(std::ostream & out, As3D<Vec4D>
const &
v);
311 std::ostream &
operator<<(std::ostream &
out, Rot3F
const & v);
312 std::ostream &
operator<<(std::ostream &
out, Rot3D
const & v);
313 std::ostream &
operator<<(std::ostream &
out, Rot2F
const & v);
314 std::ostream &
operator<<(std::ostream &
out, Rot2D
const & v);
319 std::ostream &
operator<<(std::ostream &
out, ::Vec4F
const & v) {
320 return out <<
'(' << v[0] <<
", " << v[1] <<
", "<< v[2] <<
", "<< v[3] <<
')';
322 std::ostream &
operator<<(std::ostream &
out, ::Vec4D
const & v) {
323 return out <<
'(' << v[0] <<
", " << v[1] <<
", "<< v[2] <<
", "<< v[3] <<
')';
325 std::ostream &
operator<<(std::ostream &
out, ::Vec2F
const & v) {
326 return out <<
'(' << v[0] <<
", " << v[1] <<
')';
328 std::ostream &
operator<<(std::ostream &
out, ::Vec2D
const & v) {
329 return out <<
'(' << v[0] <<
", " << v[1] <<
')';
332 std::ostream & operator<<(std::ostream & out, ::As3D<Vec4F>
const &
v) {
333 return out <<
'(' << v.v[0] <<
", " << v.v[1] <<
", "<< v.v[2] <<
')';
336 std::ostream & operator<<(std::ostream & out, ::As3D<Vec4D>
const &
v) {
337 return out <<
'(' << v.v[0] <<
", " << v.v[1] <<
", "<< v.v[2] <<
')';
340 std::ostream &
operator<<(std::ostream &
out, ::Rot3F
const & r){
344 std::ostream &
operator<<(std::ostream &
out, ::Rot3D
const & r){
348 std::ostream &
operator<<(std::ostream &
out, ::Rot2F
const & r){
349 return out << r.
axis[0] <<
'\n' << r.
axis[1];
352 std::ostream &
operator<<(std::ostream &
out, ::Rot2D
const & r){
353 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)
auto dot2(V1 x, V2 y) -> typenamestd::remove_reference< decltype(x[0])>::type
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)