Add polar to cartesian operation for vectors
This commit is contained in:
parent
1f37a8d04c
commit
b4228aca1e
@ -266,6 +266,12 @@ util::vector<S>::normalised (void) const {
|
||||
return out;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
util::vector<2>
|
||||
util::polar_to_cartesian (const util::vector<2> &v) {
|
||||
return { v.r * std::cos (v.t),
|
||||
v.r * std::sin (v.t) };
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template <size_t S>
|
||||
|
@ -78,16 +78,15 @@ namespace util {
|
||||
void sanity (void) const;
|
||||
};
|
||||
|
||||
vector<3> cross (const vector<3>&, const vector<3>&);
|
||||
vector<2> polar_to_cartesian (const vector<2>&);
|
||||
|
||||
vector<3> cross (const vector<3>&, const vector<3>&);
|
||||
vector<3> spherical_to_cartesian (const util::vector <3>&);
|
||||
vector<3> cartesian_to_spherical (const util::vector <3>&);
|
||||
|
||||
|
||||
typedef vector<2> vector2;
|
||||
typedef vector<3> vector3;
|
||||
|
||||
|
||||
template <size_t S> util::vector<S> operator* (double, const util::vector<S>&);
|
||||
template <size_t S> util::vector<S> operator+ (double, const util::vector<S>&);
|
||||
template <size_t S> util::vector<S> operator- (double, const util::vector<S>&);
|
||||
|
Loading…
Reference in New Issue
Block a user