VM2D 1.14
Vortex methods for 2D flows simulation
Loading...
Searching...
No Matches
Point2D Class Reference

#include <Point2D.h>

Inheritance diagram for Point2D:
Collaboration diagram for Point2D:

Public Member Functions

 Point2D ()
 Пустой конструктор
 Point2D (const numvector< double, 2 > &_r)
 Конструктор и приведение типа из numvector<double, 2>.
 Point2D (const Point2D &_r)
 Конструктор копирования
 Point2D (const std::initializer_list< double > &z)
 Конструктор инициализации списком
 ~Point2D ()
 Деструктор
Point2D rotated (const double angle=1.5707963267948966) const
 Поворот вектора на произвольный угол против часовой стрелки (по умолчанию 90 градусов).

Static Public Member Functions

template<char letter>
static bool cmp (const Point2D &ptA, const Point2D &ptB)

Detailed Description

Definition at line 138 of file Point2D.h.

Constructor & Destructor Documentation

◆ Point2D() [1/4]

Пустой конструктор

Definition at line 143 of file Point2D.h.

143{ };

◆ Point2D() [2/4]

VMlib::Point2D::Point2D ( const numvector< double, 2 > & _r)
inline

Конструктор и приведение типа из numvector<double, 2>.

Parameters
[in]_rконстантная ссылка на копируемый объект типа numvector<double, 2>

Definition at line 148 of file Point2D.h.

148 {
149 data[0] = _r[0];
150 data[1] = _r[1];
151 };

◆ Point2D() [3/4]

VMlib::Point2D::Point2D ( const Point2D & _r)
inline

Конструктор копирования

Parameters
[in]_rконстантная ссылка на копируемый вектор

Definition at line 156 of file Point2D.h.

156 {
157 data[0] = _r[0];
158 data[1] = _r[1];
159 }

◆ Point2D() [4/4]

Point2D::Point2D ( const std::initializer_list< double > & z)

Конструктор инициализации списком

Parameters
[in]zконстантная ссылка на список инициализации из чисел типа double
Warning
Длина списка инициализации не проверяется, от него берутся только 2 первых элемента

Definition at line 67 of file Point2D.cpp.

68{
69 for (size_t i = 0; i < 2; ++i)
70 data[i] = *(z.begin() + i);
71}//Point2D(...)

◆ ~Point2D()

Деструктор

Definition at line 170 of file Point2D.h.

170{ };

Member Function Documentation

◆ cmp()

template<char letter>
bool VMlib::Point2D::cmp ( const Point2D & ptA,
const Point2D & ptB )
inlinestatic

Definition at line 187 of file Point2D.h.

188 {
189 switch (letter)
190 {
191 case 0:
192 case 'x':
193 return (ptA[0] < ptB[0]);
194 case 1:
195 case 'y':
196 return (ptA[1] < ptB[1]);
197 case 'r':
198 return ((ptA[0] * ptA[0] + ptA[1] * ptA[1]) < (ptB[0] * ptB[0] + ptB[1] * ptB[1]));
199 default:
200#ifndef __CUDACC__
201 throw(-1);
202#endif
203 return true;
204 }
205 }

◆ rotated()

Point2D VMlib::Point2D::rotated ( const double angle = 1.5707963267948966) const
inline

Поворот вектора на произвольный угол против часовой стрелки (по умолчанию 90 градусов).

Parameters
[in]angleугол поворота в радианах (по умолчанию \( \frac{\pi}{2} \))
Returns
новый вектор, полученный поворотом старого

Definition at line 176 of file Point2D.h.

176 {
177 Point2D res;
178 double cosa = cos(angle);
179 double sina = sin(angle);
180
181 res[0] = data[0] * cosa - data[1] * sina;
182 res[1] = data[0] * sina + data[1] * cosa;
183 return res;
184 }
Point2D()
Пустой конструктор
Definition Point2D.h:143

The documentation for this class was generated from the following files: