Candle v1.0
2D lighting for SFML
Vector2.hpp File Reference

This file contains utility functions for 2D vectors. More...

#include <cmath>
#include <SFML/System/Vector2.hpp>
#include "Candle/Constants.hpp"

Functions

template<typename T >
float sfu::magnitude (const sf::Vector2< T > &v)
 
template<typename T >
float sfu::magnitude2 (const sf::Vector2< T > &v)
 
template<typename T >
sf::Vector2< T > sfu::normalize (const sf::Vector2< T > &v)
 
template<typename T , typename Q >
sfu::dot (const sf::Vector2< T > &v1, const sf::Vector2< Q > &v2)
 
template<typename T , typename Q >
float sfu::angle (const sf::Vector2< T > &v1, const sf::Vector2< Q > &v2)
 
template<typename T >
float sfu::angle (const sf::Vector2< T > &v)
 

Detailed Description

This file contains utility functions for 2D vectors.

Author
Miguel Mejía Jiménez

Function Documentation

◆ magnitude()

template<typename T >
float sfu::magnitude ( const sf::Vector2< T > &  v)

Get the magnitude of a 2D vector.

◆ magnitude2()

template<typename T >
float sfu::magnitude2 ( const sf::Vector2< T > &  v)

Get the squared magnitude of a 2D vector.

◆ normalize()

template<typename T >
sf::Vector2< T > sfu::normalize ( const sf::Vector2< T > &  v)

Get the normalized version of a 2D vector.

◆ dot()

template<typename T , typename Q >
T sfu::dot ( const sf::Vector2< T > &  v1,
const sf::Vector2< Q > &  v2 
)

Get the dot product of two 2D vectors.

◆ angle() [1/2]

template<typename T , typename Q >
float sfu::angle ( const sf::Vector2< T > &  v1,
const sf::Vector2< Q > &  v2 
)

Get the angle between two 2D vectors.

◆ angle() [2/2]

template<typename T >
float sfu::angle ( const sf::Vector2< T > &  v)

Get the angle of a 2D vector with the X axis.