Menu

[r103]: / trunk / include / small / dcovec2-function.hpp  Maximize  Restore  History

Download this file

32 lines (27 with data), 1.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//=============================================================================
/*! calculate vector product only for 2D vector */
inline double operator/(const dcovec2& A, const dcovec2& B)
{
return A(0)*B(1) -A(1)*B(0);
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//=============================================================================
/*! */
inline double v2t(const dcovec2& v)
{
return atan2(v(1),v(0));
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
//=============================================================================
/*! */
inline dcovec2 rotate(const dcovec2& v, const double& t)
{
dcovec2 w;
w(0)=v(0)*cos(t)-v(1)*sin(t);
w(1)=v(0)*sin(t)+v(1)*cos(t);
return w;
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.