VCV Rack API v2
Loading...
Searching...
No Matches
rack::math::Vec Struct Reference

2-dimensional vector of floats, representing a point on the plane for graphics. More...

#include <math.hpp>

Public Member Functions

 Vec ()
 Vec (float xy)
 Vec (float x, float y)
float & operator[] (int i)
const float & operator[] (int i) const
Vec neg () const
 Negates the vector.
Vec plus (Vec b) const
Vec minus (Vec b) const
Vec mult (float s) const
Vec mult (Vec b) const
Vec div (float s) const
Vec div (Vec b) const
float dot (Vec b) const
float arg () const
float norm () const
Vec normalize () const
float square () const
float area () const
Vec rotate (float angle)
 Rotates counterclockwise in radians.
Vec flip () const
 Swaps the coordinates.
Vec min (Vec b) const
Vec max (Vec b) const
Vec abs () const
Vec round () const
Vec floor () const
Vec ceil () const
bool equals (Vec b) const
bool isZero () const
bool isFinite () const
Vec clamp (Rect bound) const
Vec clampSafe (Rect bound) const
Vec crossfade (Vec b, float p)
bool isEqual (Vec b) const

Public Attributes

float x = 0.f
float y = 0.f

Detailed Description

2-dimensional vector of floats, representing a point on the plane for graphics.

Constructor & Destructor Documentation

◆ Vec() [1/3]

rack::math::Vec::Vec ( )
inline

◆ Vec() [2/3]

rack::math::Vec::Vec ( float xy)
inline

◆ Vec() [3/3]

rack::math::Vec::Vec ( float x,
float y )
inline

Member Function Documentation

◆ operator[]() [1/2]

float & rack::math::Vec::operator[] ( int i)
inline

◆ operator[]() [2/2]

const float & rack::math::Vec::operator[] ( int i) const
inline

◆ neg()

Vec rack::math::Vec::neg ( ) const
inline

Negates the vector.

Equivalent to a reflection across the y = -x line.

◆ plus()

Vec rack::math::Vec::plus ( Vec b) const
inline

◆ minus()

Vec rack::math::Vec::minus ( Vec b) const
inline

◆ mult() [1/2]

Vec rack::math::Vec::mult ( float s) const
inline

◆ mult() [2/2]

Vec rack::math::Vec::mult ( Vec b) const
inline

◆ div() [1/2]

Vec rack::math::Vec::div ( float s) const
inline

◆ div() [2/2]

Vec rack::math::Vec::div ( Vec b) const
inline

◆ dot()

float rack::math::Vec::dot ( Vec b) const
inline

◆ arg()

float rack::math::Vec::arg ( ) const
inline

◆ norm()

float rack::math::Vec::norm ( ) const
inline

◆ normalize()

Vec rack::math::Vec::normalize ( ) const
inline

◆ square()

float rack::math::Vec::square ( ) const
inline

◆ area()

float rack::math::Vec::area ( ) const
inline

◆ rotate()

Vec rack::math::Vec::rotate ( float angle)
inline

Rotates counterclockwise in radians.

◆ flip()

Vec rack::math::Vec::flip ( ) const
inline

Swaps the coordinates.

Equivalent to a reflection across the y = x line.

◆ min()

Vec rack::math::Vec::min ( Vec b) const
inline

◆ max()

Vec rack::math::Vec::max ( Vec b) const
inline

◆ abs()

Vec rack::math::Vec::abs ( ) const
inline

◆ round()

Vec rack::math::Vec::round ( ) const
inline

◆ floor()

Vec rack::math::Vec::floor ( ) const
inline

◆ ceil()

Vec rack::math::Vec::ceil ( ) const
inline

◆ equals()

bool rack::math::Vec::equals ( Vec b) const
inline

◆ isZero()

bool rack::math::Vec::isZero ( ) const
inline

◆ isFinite()

bool rack::math::Vec::isFinite ( ) const
inline

◆ clamp()

Vec rack::math::Vec::clamp ( Rect bound) const
inline

◆ clampSafe()

Vec rack::math::Vec::clampSafe ( Rect bound) const
inline

◆ crossfade()

Vec rack::math::Vec::crossfade ( Vec b,
float p )
inline

◆ isEqual()

bool rack::math::Vec::isEqual ( Vec b) const
inline

Member Data Documentation

◆ x

float rack::math::Vec::x = 0.f

◆ y

float rack::math::Vec::y = 0.f

The documentation for this struct was generated from the following file:
  • /home/vortico/src/vcv/Rack2/include/math.hpp