polar2d.cpp
Go to the documentation of this file.
1 #include <memory>
2 #include <tuw_geometry/polar2d.h>
3 
4 using namespace tuw;
5 
6 Polar2D::Polar2D () : Point2D ( 0,0 ) {};
7 Polar2D::Polar2D ( const Point2D &p ) : Point2D ( atan2( p.y(), p.x()), sqrt( p.x() * p.x() + p.y()* p.y() ), 1 ) {};
8 Polar2D::Polar2D ( double alpha, double rho ) : Point2D ( alpha,rho ) {};
9 Polar2D::Polar2D ( double alpha, double rho, double h ) : Point2D ( alpha, rho, h ) {};
10 
14 const double &Polar2D::alpha () const {
15  return x();
16 }
20 double &Polar2D::alpha () {
21  return x();
22 }
26 const double &Polar2D::rho () const {
27  return y();
28 }
32 double &Polar2D::rho () {
33  return y();
34 }
39  return Point2D(cos(alpha()) * rho(), sin(alpha()) * rho());
40 }
tuw::Point2D::y
const double & y() const
Definition: point2d.cpp:49
tuw::Polar2D::Polar2D
Polar2D()
Definition: polar2d.cpp:6
test_point2d.p
p
Definition: test_point2d.py:20
tuw::Point2D::x
const double & x() const
Definition: point2d.cpp:35
tuw
Definition: command.h:8
tuw::Polar2D::alpha
const double & alpha() const
Definition: polar2d.cpp:14
tuw::Polar2D::rho
const double & rho() const
Definition: polar2d.cpp:26
tuw::Point2D
Definition: point2d.h:19
tuw::Polar2D::point
Point2D point() const
Definition: polar2d.cpp:38
polar2d.h
tuw::Point2D::Point2D
Point2D()
Definition: point2d.cpp:5


tuw_geometry
Author(s): Markus Bader
autogenerated on Sun Feb 26 2023 03:25:40