LIBRCSC Docs
Documentation for HELIOS's BASE LIBRCSC library for RoboCup 2D Simulation League.
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
formation_dt.h
Go to the documentation of this file.
1// -*-c++-*-
2
8/*
9 *Copyright:
10
11 Copyright (C) Hidehisa AKIYAMA
12
13 This code is free software; you can redistribute it and/or
14 modify it under the terms of the GNU Lesser General Public
15 License as published by the Free Software Foundation; either
16 version 3 of the License, or (at your option) any later version.
17
18 This library is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 Lesser General Public License for more details.
22
23 You should have received a copy of the GNU Lesser General Public
24 License along with this library; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
27 *EndCopyright:
28 */
29
31
32#ifndef RCSC_FORMATION_FORMATION_DT_H
33#define RCSC_FORMATION_FORMATION_DT_H
34
37#include <iostream>
38
39namespace rcsc {
40
46 : public Formation {
47public:
48
49 static const std::string NAME;
50
51private:
53 std::vector< FormationData::Data > M_points;
54
56 DelaunayTriangulation M_triangulation;
57
58public:
59
64
69 static
70 Formation::Ptr create()
71 {
72 return Formation::Ptr( new FormationDT() );
73 }
74
79 const std::vector< FormationData::Data > & points() const
80 {
81 return M_points;
82 }
83
89 {
90 return M_triangulation;
91 }
92
97 virtual
98 std::string methodName() const override;
99
105 virtual
106 Vector2D getPosition( const int num,
107 const Vector2D & focus_point ) const override;
108
114 virtual
115 void getPositions( const Vector2D & focus_point,
116 std::vector< Vector2D > & positions ) const override;
117
118private:
119
120 Vector2D interpolate( const int num,
121 const Vector2D & focus_point,
122 const DelaunayTriangulation::Triangle * tri ) const;
123
124public:
125
131 virtual
132 bool train( const FormationData & data ) override;
133
138 virtual
139 FormationData::Ptr toData() const override;
140
141protected:
142
148 virtual
149 bool printData( std::ostream & os ) const override;
150};
151
152}
153
154#endif
triangle data
Definition: delaunay_triangulation.h:315
Delaunay triangulation.
Definition: delaunay_triangulation.h:49
formation which utilizes Delaunay Triangulation
Definition: formation_dt.h:46
virtual std::string methodName() const override
get the method name of the formation model
virtual bool printData(std::ostream &os) const override
print model data
FormationDT()
just call the base class constructor to initialize formation method name
virtual FormationData::Ptr toData() const override
create data for the editor
virtual Vector2D getPosition(const int num, const Vector2D &focus_point) const override
get position for the current focus point
const DelaunayTriangulation & triangulation() const
get the delaunay triangulation
Definition: formation_dt.h:88
static const std::string NAME
type name
Definition: formation_dt.h:49
virtual bool train(const FormationData &data) override
update formation paramter using training data set
virtual void getPositions(const Vector2D &focus_point, std::vector< Vector2D > &positions) const override
get all positions for the current focus point
const std::vector< FormationData::Data > & points() const
get the sample data array
Definition: formation_dt.h:79
static Formation::Ptr create()
static factory method. create new object
Definition: formation_dt.h:70
data for constructing the formation
Definition: formation_data.h:51
abstarct formation class
Definition: formation.h:52
2D point vector class
Definition: vector_2d.h:46
Delaunay Triangulation class Header File.
abstract formation classes Header File.