14 #include <argos3/core/utility/math/vector2.h>
27 m_cStart(c_start), m_cEnd(c_end) {
33 Set(c_start, c_direction, f_length);
62 m_cEnd += f_length * c_direction;
82 return (m_cEnd - m_cStart).Length();
108 (c_ray.m_cEnd.
GetY() - c_ray.m_cStart.
GetY()) *
110 (c_ray.m_cEnd.
GetX() - c_ray.m_cStart.
GetX()) *
112 if(
Abs(fDiscriminant) < 1e-4) {
119 (m_cStart.
GetX() - c_ray.m_cStart.
GetX()) *
120 (c_ray.m_cEnd.
GetY() - c_ray.m_cStart.
GetY()) -
121 (m_cStart.
GetY() - c_ray.m_cStart.
GetY()) *
122 (c_ray.m_cEnd.
GetX() - c_ray.m_cStart.
GetX());
124 if(fT1 < 0.0 || fT1 > 1.0)
return false;
127 if(
Abs(c_ray.m_cEnd.
GetY() - c_ray.m_cStart.
GetY()) > 1e-4) {
130 (m_cStart.
GetY() - c_ray.m_cStart.
GetY()) +
133 (c_ray.m_cEnd.
GetY() - c_ray.m_cStart.
GetY());
138 (m_cStart.
GetX() - c_ray.m_cStart.
GetX()) +
141 (c_ray.m_cEnd.
GetX() - c_ray.m_cStart.
GetX());
144 return(fT2 >= 0.0 && fT2 <= 1.0);
154 const CRay2& c_ray) {
float Real
Collects all ARGoS code.
The namespace containing all the ARGoS related code.
T Square(const T &t_v)
Returns the square of the value of the passed argument.
T Abs(const T &t_v)
Returns the absolute value of the passed argument.
void ToVector(CVector2 &c_buffer) const
CRay2(const CVector2 &c_start, const CVector2 &c_end)
void Set(const CVector2 &c_start, const CVector2 &c_end)
void GetInverseDirection(CVector2 &c_buffer) const
void SetEnd(const CVector2 &c_end)
const CVector2 & GetEnd() const
const CVector2 & GetStart() const
friend std::ostream & operator<<(std::ostream &c_os, const CRay2 &c_ray)
Serializes the contents of the passed ray onto a stream.
void GetPoint(CVector2 &c_point, Real f_t) const
void Set(const CVector2 &c_start, const CVector2 &c_direction, Real f_length)
void SetStart(const CVector2 &c_start)
bool Intersects(const CRay2 &c_ray) const
void GetDirection(CVector2 &c_buffer) const
CRay2(const CVector2 &c_start, const CVector2 &c_direction, Real f_length)
Real GetDistance(Real f_t) const
Real GetY() const
Returns the y coordinate of this vector.
CVector2 & Normalize()
Normalizes this vector.
void SetY(Real f_y)
Sets the y coordinate of this vector.
void SetX(Real f_x)
Sets the x coordinate of this vector.
Real GetX() const
Returns the x coordinate of this vector.