SuperTuxKart
Loading...
Searching...
No Matches
drive_node_2d.hpp
1//
2// SuperTuxKart - a fun racing game with go-kart
3// Copyright (C) 2016 SuperTuxKart-Team
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 3
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19#ifndef HEADER_DRIVE_NODE_2D_HPP
20#define HEADER_DRIVE_NODE_2D_HPP
21
22#include "tracks/drive_node.hpp"
23#include "utils/cpp2011.hpp"
24
25#include <line2d.h>
26
30class DriveNode2D : public DriveNode
31{
32private:
36 core::vector2df m_lower_center_2d;
37
43 core::line2df m_line;
44
45public:
46 DriveNode2D(const Vec3 &p0, const Vec3 &p1, const Vec3 &p2, const Vec3 &p3,
47 const Vec3 &normal, unsigned int node_index, bool invisible,
48 bool ai_ignore, bool ignored);
49 // ------------------------------------------------------------------------
50 virtual void getDistances(const Vec3 &xyz, Vec3 *result) const OVERRIDE;
51 // ------------------------------------------------------------------------
52 virtual float getDistance2FromPoint(const Vec3 &xyz) const OVERRIDE;
53
54};
55#endif
Definition: drive_node_2d.hpp:31
core::vector2df m_lower_center_2d
The center point of the lower two points (e.g.
Definition: drive_node_2d.hpp:36
core::line2df m_line
Line between lower and upper center, saves computation in getDistance() later.
Definition: drive_node_2d.hpp:43
virtual void getDistances(const Vec3 &xyz, Vec3 *result) const OVERRIDE
Returns the distance a point has from this node in forward and sidewards direction,...
Definition: drive_node_2d.cpp:46
virtual float getDistance2FromPoint(const Vec3 &xyz) const OVERRIDE
Returns the square of the distance between the given point and any point on the 'centre' line,...
Definition: drive_node_2d.cpp:66
This class stores a node of the drive graph, i.e.
Definition: drive_node.hpp:32
A wrapper around bullets btVector3 to include conventient conversion functions (e....
Definition: vec3.hpp:35