Public Member Functions | Public Attributes | Related Functions | List of all members
AVO::Vector2 Class Reference

A vector in two dimensions. More...

#include <Vector2.h>

Collaboration diagram for AVO::Vector2:
[legend]

Public Member Functions

 Vector2 ()
 Constructor.
 
 Vector2 (float x, float y)
 Constructor. More...
 
float getX () const
 Returns the x-coordinate of this vector. More...
 
float getY () const
 Returns the y-coordinate of this vector. More...
 
void setX (float x)
 Sets the x-coordinate of this vector. More...
 
void setY (float y)
 Sets the y-coordinate of this vector. More...
 
Vector2 operator- () const
 Computes the negation of this vector. More...
 
float operator* (const Vector2 &other) const
 Computes the dot product of this vector with the specified vector. More...
 
Vector2 operator* (float scalar) const
 Computes the scalar multiplication of this vector with the specified scalar value. More...
 
Vector2 operator/ (float scalar) const
 Computes the scalar division of this vector with the specified scalar value. More...
 
Vector2 operator+ (const Vector2 &other) const
 Computes the vector sum of this vector with the specified vector. More...
 
Vector2 operator- (const Vector2 &other) const
 Computes the vector difference of this vector with the specified vector. More...
 
bool operator== (const Vector2 &other) const
 Tests this vector for equality with the specified vector. More...
 
bool operator!= (const Vector2 &other) const
 Tests this vector for inequality with the specified vector. More...
 
Vector2operator*= (float scalar)
 Sets the value of this vector to the scalar multiplication of itself with the specified scalar value. More...
 
Vector2operator/= (float scalar)
 Sets the value of this vector to the scalar division of itself with the specified scalar value. More...
 
Vector2operator+= (const Vector2 &other)
 Sets the value of this vector to the vector sum of itself with the specified vector. More...
 
Vector2operator-= (const Vector2 &other)
 Sets the value of this vector to the vector difference of itself with the specified vector. More...
 

Public Attributes

float x_
 
float y_
 

Related Functions

(Note that these are not member functions.)

AVO_EXPORT float abs (const Vector2 &vector)
 Computes the length of a specified vector. More...
 
AVO_EXPORT float absSq (const Vector2 &vector)
 Computes the squared length of a specified vector. More...
 
AVO_EXPORT float det (const Vector2 &vector1, const Vector2 &vector2)
 Computes the determinant of a square matrix with rows consisting of the specified vectors. More...
 
AVO_EXPORT Vector2 normalize (const Vector2 &vector)
 Computes the normalization of a specified vector. More...
 
AVO_EXPORT Vector2 operator* (float scalar, const Vector2 &vector)
 Computes the scalar multiplication of the specified vector with the specified scalar value. More...
 
AVO_EXPORT std::ostream & operator<< (std::ostream &stream, const Vector2 &vector)
 Inserts the specified two-dimensional vector into the specified output stream. More...
 

Detailed Description

A vector in two dimensions.

Constructor & Destructor Documentation

◆ Vector2()

AVO::Vector2::Vector2 ( float  x,
float  y 
)
inline

Constructor.

Parameters
[in]xThe x-coordinate of the vector.
[in]yThe y-coordinate of the vector.

Member Function Documentation

◆ getX()

float AVO::Vector2::getX ( ) const
inline

Returns the x-coordinate of this vector.

Returns
The x-coordinate of the vector.

◆ getY()

float AVO::Vector2::getY ( ) const
inline

Returns the y-coordinate of this vector.

Returns
The y-coordinate of the vector.

◆ operator!=()

bool AVO::Vector2::operator!= ( const Vector2 other) const
inline

Tests this vector for inequality with the specified vector.

Parameters
[in]otherThe vector with which to test for inequality
Returns
True if the vectors are not equal.

◆ operator*() [1/2]

float AVO::Vector2::operator* ( const Vector2 other) const
inline

Computes the dot product of this vector with the specified vector.

Parameters
[in]otherThe vector with which the dot product should be computed.
Returns
The dot product of this vector with a specified vector.

◆ operator*() [2/2]

Vector2 AVO::Vector2::operator* ( float  scalar) const
inline

Computes the scalar multiplication of this vector with the specified scalar value.

Parameters
[in]scalarThe scalar value with which the scalar multiplication should be computed.
Returns
The scalar multiplication of this vector with a specified scalar value.

◆ operator*=()

Vector2& AVO::Vector2::operator*= ( float  scalar)
inline

Sets the value of this vector to the scalar multiplication of itself with the specified scalar value.

Parameters
[in]scalarThe scalar value with which the scalar multiplication should be computed.
Returns
A reference to this vector.

◆ operator+()

Vector2 AVO::Vector2::operator+ ( const Vector2 other) const
inline

Computes the vector sum of this vector with the specified vector.

Parameters
[in]otherThe vector with which the vector sum should be computed.
Returns
The vector sum of this vector with a specified vector.

◆ operator+=()

Vector2& AVO::Vector2::operator+= ( const Vector2 other)
inline

Sets the value of this vector to the vector sum of itself with the specified vector.

Parameters
[in]otherThe vector with which the vector sum should be computed.
Returns
A reference to this vector.

◆ operator-() [1/2]

Vector2 AVO::Vector2::operator- ( ) const
inline

Computes the negation of this vector.

Returns
The negation of this vector.

◆ operator-() [2/2]

Vector2 AVO::Vector2::operator- ( const Vector2 other) const
inline

Computes the vector difference of this vector with the specified vector.

Parameters
[in]otherThe vector with which the vector difference should be computed.
Returns
The vector difference of this vector with a specified vector.

◆ operator-=()

Vector2& AVO::Vector2::operator-= ( const Vector2 other)
inline

Sets the value of this vector to the vector difference of itself with the specified vector.

Parameters
[in]otherThe vector with which the vector difference should be computed.
Returns
A reference to this vector.

◆ operator/()

Vector2 AVO::Vector2::operator/ ( float  scalar) const
inline

Computes the scalar division of this vector with the specified scalar value.

Parameters
[in]scalarThe scalar value with which the scalar division should be computed.
Returns
The scalar division of this vector with a specified scalar value.

◆ operator/=()

Vector2& AVO::Vector2::operator/= ( float  scalar)
inline

Sets the value of this vector to the scalar division of itself with the specified scalar value.

Parameters
[in]scalarThe scalar value with which the scalar division should be computed.
Returns
A reference to this vector.

◆ operator==()

bool AVO::Vector2::operator== ( const Vector2 other) const
inline

Tests this vector for equality with the specified vector.

Parameters
[in]otherThe vector with which to test for equality.
Returns
True if the vectors are equal.

◆ setX()

void AVO::Vector2::setX ( float  x)
inline

Sets the x-coordinate of this vector.

Parameters
[in]xThe replacement x-coordinate.

◆ setY()

void AVO::Vector2::setY ( float  y)
inline

Sets the y-coordinate of this vector.

Parameters
[in]yThe replacement y-coordinate.

Friends And Related Function Documentation

◆ abs()

AVO_EXPORT float abs ( const Vector2 vector)
related

Computes the length of a specified vector.

Parameters
[in]vectorThe vector whose length is to be computed.
Returns
The length of the vector.

◆ absSq()

AVO_EXPORT float absSq ( const Vector2 vector)
related

Computes the squared length of a specified vector.

Parameters
[in]vectorThe vector whose squared length is to be calculated.
Returns
The squared length of the vector.

◆ det()

AVO_EXPORT float det ( const Vector2 vector1,
const Vector2 vector2 
)
related

Computes the determinant of a square matrix with rows consisting of the specified vectors.

Parameters
[in]vector1The top row of the square matrix.
[in]vector2The bottom row of the square matrix.
Returns
The determinant of the square matrix.

◆ normalize()

AVO_EXPORT Vector2 normalize ( const Vector2 vector)
related

Computes the normalization of a specified vector.

Parameters
[in]vectorThe vector whose normalization is to be calculated.
Returns
The normalization of the vector.

◆ operator*()

AVO_EXPORT Vector2 operator* ( float  scalar,
const Vector2 vector 
)
related

Computes the scalar multiplication of the specified vector with the specified scalar value.

Parameters
[in]scalarThe scalar value with which the scalar multiplication should be computed.
[in]vectorThe vector with which the scalar multiplication should be computed.
Returns
The scalar multiplication of the vector with the scalar value.

◆ operator<<()

AVO_EXPORT std::ostream & operator<< ( std::ostream &  stream,
const Vector2 vector 
)
related

Inserts the specified two-dimensional vector into the specified output stream.

Parameters
[in,out]streamThe output stream into which the two-dimensional vector should be inserted.
[in]vectorThe two-dimensional vector which to insert into the output stream.
Returns
A reference to the output stream.

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