List of all members | Public Types | Static Public Member Functions | Public Member Functions
thor::Arrow Class Reference

Drawable arrow class. More...

Inherits Drawable, and Transformable.

Public Types

enum  Style { Line, Forward }
 Determines whether the arrow has a triangle on his endpoint. More...
 

Static Public Member Functions

static void setZeroVectorTolerance (float tolerance)
 Specifies the zero length tolerance. More...
 
static float getZeroVectorTolerance ()
 Returns the zero length tolerance. More...
 

Public Member Functions

 Arrow (sf::Vector2f position=sf::Vector2f(), sf::Vector2f direction=sf::Vector2f(), const sf::Color &color=sf::Color::White, float thickness=3.f)
 (Default) constructor More...
 
void setDirection (sf::Vector2f direction)
 Aligns the arrow so that it points to the given direction.
 
void setDirection (float dirX, float dirY)
 Aligns the arrow so that it points to the given direction.
 
sf::Vector2f getDirection () const
 Returns the arrow's direction.
 
void setThickness (float thickness)
 sets the arrow's thickness (3.f by default).
 
float getThickness () const
 Returns the arrow's thickness.
 
void setColor (const sf::Color &color)
 Sets the arrow color.
 
sf::Color getColor () const
 Returns the arrow color.
 
void setStyle (Style style)
 sets the arrow's visual style (Arrow::Forward by default).
 
Style getStyle () const
 Returns the arrow's visual style.
 

Detailed Description

Drawable arrow class.

Arrows behave very similar to lines. They can be used to visualize vectors. This class inherits sf::Drawable and sf::Transformable.

Member Enumeration Documentation

Determines whether the arrow has a triangle on his endpoint.

Enumerator
Line 

Straight line without any triangles.

Forward 

Normal unidirectional arrow.

Constructor & Destructor Documentation

thor::Arrow::Arrow ( sf::Vector2f  position = sf::Vector2f(),
sf::Vector2f  direction = sf::Vector2f(),
const sf::Color &  color = sf::Color::White,
float  thickness = 3.f 
)
explicit

(Default) constructor

Parameters
positionStarting point of the arrow.
directionDirection of the arrow (the vector you want to represent).
colorThe line and triangle color.
thicknessThe line thickness.

Member Function Documentation

static float thor::Arrow::getZeroVectorTolerance ( )
static

Returns the zero length tolerance.

The tolerance is the bound, below which a vector is considered a zero vector.

static void thor::Arrow::setZeroVectorTolerance ( float  tolerance)
static

Specifies the zero length tolerance.

All arrows shorter than tolerance are represented as zero vectors (i.e. by circles).


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