Public Member Functions | Private Attributes
Line2D Class Reference

#include <Line2D.h>

List of all members.

Public Member Functions

float distance (Point2D point) const
Point2D end () const
Point2D getClosestPoint (Point2D point) const
Point2D getIntersectionPoint (Line2D line) const
float getIntersectionPointParameter (Line2D line) const
CVec2 getNormal () const
Point2D getRootPoint (Point2D point) const
float gradient () const
float length () const
 Line2D (Point2D start, Point2D end)
 Line2D (Point2D start, CVec2 vec)
bool operator== (const Line2D &line) const
void rotate (float angle)
void setEnd (const Point2D end)
void setStart (const Point2D start)
Point2D start () const
std::string toString () const
CVec2 vec () const
std::vector< Point2D > vertices (unsigned substeps=0)
 ~Line2D ()

Private Attributes

Point2D m_Start
CVec2 m_Vec

Detailed Description

Author:
Susanne Maur

Definition at line 28 of file Line2D.h.


Constructor & Destructor Documentation

Line2D::Line2D ( Point2D  start,
Point2D  end 
) [inline]

Creates a new line.

Parameters:
startStart point of the line.
endEnd point of the line.

Definition at line 38 of file Line2D.h.

Line2D::Line2D ( Point2D  start,
CVec2  vec 
) [inline]

Creates a new line.

Parameters:
startStart point of the line.
vecThe vector from start to end point of the line.

Definition at line 50 of file Line2D.h.

Line2D::~Line2D ( ) [inline]

Destructor does nothing.

Definition at line 59 of file Line2D.h.


Member Function Documentation

float Line2D::distance ( Point2D  point) const [inline]

Returns the minimum euclidean distance of the given point to the line.

Parameters:
pointPoint of which the distance to the line will be calculated.
Returns:
Distance of point to line.

Definition at line 133 of file Line2D.h.

Point2D Line2D::end ( ) const [inline]

Returns the end point of the line.

Returns:
End point of the line.

Definition at line 95 of file Line2D.h.

Point2D Line2D::getClosestPoint ( Point2D  point) const

Returns the point of the line with the minimal distance to a given point. This algorithm returns always a point which lies on the line. Therefor it is not always the root point. See also: getRootPoint.

Parameters:
pointPoint to which the distance is calculated.
Returns:
Root point of the line.
Point2D Line2D::getIntersectionPoint ( Line2D  line) const

Returns the intersection point of this line with a second line. The intersection point is element of this line.

Parameters:
lineThe line with which the intersection is calculated.
Returns:
Intersection point.

Returns the parameter t which identifies the intersection point of this line with a second line. The intersection point is element of this line.

Parameters:
lineThe line with which the intersection is calculated.
Returns:
Parameter t which identifies the intersection point on the line.
CVec2 Line2D::getNormal ( ) const [inline]

Returns the normal of the line.

Returns:
Normal of the line.

Definition at line 169 of file Line2D.h.

Point2D Line2D::getRootPoint ( Point2D  point) const [inline]

Returns the point of the line with the minimal distance to a given point. This algorithm may return a point which lies on the extension of the line and not on itself. See also: getClosestPoint.

Parameters:
pointPoint to which the distance is calculated.
Returns:
Root point of the line.

Definition at line 157 of file Line2D.h.

float Line2D::gradient ( ) const

Returns the gradient of the line.

Returns:
Gradient of the line.
float Line2D::length ( ) const [inline]

Returns the length of the line.

Returns:
Length of the line.

Definition at line 124 of file Line2D.h.

bool Line2D::operator== ( const Line2D line) const [inline]

Definition at line 109 of file Line2D.h.

void Line2D::rotate ( float  angle) [inline]

Rotates the line round the origin.

Parameters:
angleThe angle of rotation in radiants.

Definition at line 143 of file Line2D.h.

void Line2D::setEnd ( const Point2D  end) [inline]

Sets the end point of the line to a new value.

Parameters:
endEnd point of the line.

Definition at line 77 of file Line2D.h.

void Line2D::setStart ( const Point2D  start) [inline]

Sets the start point of the line to a new value.

Parameters:
startStart point of the line.

Definition at line 65 of file Line2D.h.

Point2D Line2D::start ( ) const [inline]

Returns the start point of the line.

Returns:
Start point of the line.

Definition at line 86 of file Line2D.h.

std::string Line2D::toString ( ) const
CVec2 Line2D::vec ( ) const [inline]

Returns a vector from the start to the end of the line.

Returns:
Vector to the end point of the line.

Definition at line 104 of file Line2D.h.

std::vector< Point2D > Line2D::vertices ( unsigned  substeps = 0)
Returns:
Vertices, e.g. for use in a VectorObject
Parameters:
substepsnumber of linear interpolation steps between start and end

Member Data Documentation

Point2D Line2D::m_Start [private]

Start point of the line.

Definition at line 215 of file Line2D.h.

CVec2 Line2D::m_Vec [private]

Vector from the start to the end of the line.

Definition at line 220 of file Line2D.h.


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


robbie_architecture
Author(s): Viktor Seib
autogenerated on Mon Oct 6 2014 02:53:09