Locus No Pilotus
Project of four first grade MIPT DAFE/RSE students (for engineering practical work in the second semester) in Qt C++
Loading...
Searching...
No Matches
math::PolygonObstacle Class Reference

Многоугольное препятствие More...

#include <obstacles.h>

Collaboration diagram for math::PolygonObstacle:

Public Member Functions

 PolygonObstacle ()=default
 
 PolygonObstacle (const std::vector< Point > &vertexes)
 Инициализирует экземпляр PolygonObstacle.
 
void AddTangentPoint (const Point &tangent_point)
 
Point GetCenter () const
 
std::vector< PointGetTangentPoints ()
 
std::vector< PointGetVertexes () const
 
bool operator!= (const PolygonObstacle &other)
 
bool operator== (const PolygonObstacle &other)
 

Private Attributes

Point center_
 
std::vector< Pointtangent_points_
 
std::vector< Pointvertexes_
 

Detailed Description

Многоугольное препятствие

Constructor & Destructor Documentation

◆ PolygonObstacle() [1/2]

math::PolygonObstacle::PolygonObstacle ( )
default

◆ PolygonObstacle() [2/2]

math::PolygonObstacle::PolygonObstacle ( const std::vector< Point > & vertexes)
inline

Инициализирует экземпляр PolygonObstacle.

Parameters
vertexesвершины многоугольника
107 : vertexes_{vertexes} {
108 center_ = Point(0, 0);
109 for (auto& elem : vertexes_) {
110 center_.x += elem.x;
111 center_.y += elem.y;
112 }
113 center_.x /= (double)vertexes_.size();
114 center_.y /= (double)vertexes_.size();
115 }
Point center_
Definition obstacles.h:137
std::vector< Point > vertexes_
Definition obstacles.h:140
double y
Definition point.h:18
double x
Definition point.h:17

Member Function Documentation

◆ AddTangentPoint()

void math::PolygonObstacle::AddTangentPoint ( const Point & tangent_point)
inline
123 {
124 tangent_points_.push_back(tangent_point);
125 }
std::vector< Point > tangent_points_
Definition obstacles.h:143

◆ GetCenter()

Point math::PolygonObstacle::GetCenter ( ) const
inline
117{ return center_; }
Here is the caller graph for this function:

◆ GetTangentPoints()

std::vector< Point > math::PolygonObstacle::GetTangentPoints ( )
inline
121{ return tangent_points_; }

◆ GetVertexes()

std::vector< Point > math::PolygonObstacle::GetVertexes ( ) const
inline
119{ return vertexes_; }
Here is the caller graph for this function:

◆ operator!=()

bool math::PolygonObstacle::operator!= ( const PolygonObstacle & other)
inline
131 {
132 return vertexes_ != other.vertexes_;
133 }

◆ operator==()

bool math::PolygonObstacle::operator== ( const PolygonObstacle & other)
inline
127 {
128 return vertexes_ == other.vertexes_;
129 }

Member Data Documentation

◆ center_

Point math::PolygonObstacle::center_
private

◆ tangent_points_

std::vector<Point> math::PolygonObstacle::tangent_points_
private

◆ vertexes_

std::vector<Point> math::PolygonObstacle::vertexes_
private

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