KiCad PCB EDA Suite
Loading...
Searching...
No Matches
vector2d.h File Reference
#include <algorithm>
#include <limits>
#include <iostream>
#include <sstream>
#include <type_traits>
#include <math/util.h>

Go to the source code of this file.

Classes

struct  VECTOR2_TRAITS< T >
 Traits class for VECTOR2. More...
 
struct  VECTOR2_TRAITS< int >
 
class  VECTOR2< T >
 Define a general 2D-vector/point. More...
 
struct  std::hash< VECTOR2I >
 
struct  std::less< VECTOR2I >
 

Namespaces

namespace  std
 STL namespace.
 

Typedefs

typedef VECTOR2< double > VECTOR2D
 
typedef VECTOR2< int32_t > VECTOR2I
 
typedef VECTOR2< int64_t > VECTOR2L
 

Functions

template<class T >
std::ostream & operator<< (std::ostream &aStream, const VECTOR2< T > &aVector)
 
template<class T , class U >
VECTOR2< std::common_type_t< T, U > > operator+ (const VECTOR2< T > &aLHS, const VECTOR2< U > &aRHS)
 
template<FloatingPoint T, class U >
VECTOR2< T > operator+ (const VECTOR2< T > &aLHS, const U &aScalar)
 
template<class T , class U >
VECTOR2< std::common_type_t< T, U > > operator- (const VECTOR2< T > &aLHS, const VECTOR2< U > &aRHS)
 
template<FloatingPoint T, class U >
VECTOR2< T > operator- (const VECTOR2< T > &aLHS, U aScalar)
 
template<Integral T, FloatingPoint U>
VECTOR2< T > operator- (const VECTOR2< T > &aLHS, const U &aScalar)
 
template<class T , class U >
auto operator* (const VECTOR2< T > &aLHS, const VECTOR2< U > &aRHS)
 
template<class T , class U >
VECTOR2< std::common_type_t< T, U > > operator* (const VECTOR2< T > &aLHS, const U &aScalar)
 
template<class T , class U >
VECTOR2< std::common_type_t< T, U > > operator* (const T &aScalar, const VECTOR2< U > &aVector)
 
template<class T >
const VECTOR2< T > LexicographicalMax (const VECTOR2< T > &aA, const VECTOR2< T > &aB)
 
template<class T >
const VECTOR2< T > LexicographicalMin (const VECTOR2< T > &aA, const VECTOR2< T > &aB)
 
template<class T >
int LexicographicalCompare (const VECTOR2< T > &aA, const VECTOR2< T > &aB)
 
template<class T >
std::enable_if<!std::numeric_limits< T >::is_integer, bool >::type equals (VECTOR2< T > const &aFirst, VECTOR2< T > const &aSecond, T aEpsilon=std::numeric_limits< T >::epsilon())
 Template to compare two VECTOR2<T> values for equality within a required epsilon.
 
VECTOR2I KiROUND (const VECTOR2D &vec)
 

Typedef Documentation

◆ VECTOR2D

typedef VECTOR2<double> VECTOR2D

Definition at line 675 of file vector2d.h.

◆ VECTOR2I

typedef VECTOR2<int32_t> VECTOR2I

Definition at line 676 of file vector2d.h.

◆ VECTOR2L

typedef VECTOR2<int64_t> VECTOR2L

Definition at line 677 of file vector2d.h.

Function Documentation

◆ equals()

template<class T >
std::enable_if<!std::numeric_limits< T >::is_integer, bool >::type equals ( VECTOR2< T > const &  aFirst,
VECTOR2< T > const &  aSecond,
aEpsilon = std::numeric_limits<T>::epsilon() 
)

Template to compare two VECTOR2<T> values for equality within a required epsilon.

Parameters
aFirstvalue to compare.
aSecondvalue to compare.
aEpsilonallowed error.
Returns
true if the values considered equal within the specified epsilon, otherwise false.

Definition at line 655 of file vector2d.h.

References equals(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by equals().

◆ KiROUND()

VECTOR2I KiROUND ( const VECTOR2D vec)
inline

◆ LexicographicalCompare()

template<class T >
int LexicographicalCompare ( const VECTOR2< T > &  aA,
const VECTOR2< T > &  aB 
)

Definition at line 627 of file vector2d.h.

References VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by CADSTAR_SCH_ARCHIVE_LOADER::fixUpLibraryPins().

◆ LexicographicalMax()

template<class T >
const VECTOR2< T > LexicographicalMax ( const VECTOR2< T > &  aA,
const VECTOR2< T > &  aB 
)

Definition at line 603 of file vector2d.h.

References VECTOR2< T >::x, and VECTOR2< T >::y.

◆ LexicographicalMin()

template<class T >
const VECTOR2< T > LexicographicalMin ( const VECTOR2< T > &  aA,
const VECTOR2< T > &  aB 
)

Definition at line 615 of file vector2d.h.

References VECTOR2< T >::x, and VECTOR2< T >::y.

◆ operator*() [1/3]

template<class T , class U >
VECTOR2< std::common_type_t< T, U > > operator* ( const T &  aScalar,
const VECTOR2< U > &  aVector 
)

Definition at line 521 of file vector2d.h.

References VECTOR2< T >::x, and VECTOR2< T >::y.

◆ operator*() [2/3]

template<class T , class U >
VECTOR2< std::common_type_t< T, U > > operator* ( const VECTOR2< T > &  aLHS,
const U &  aScalar 
)

Definition at line 514 of file vector2d.h.

References VECTOR2< T >::x, and VECTOR2< T >::y.

◆ operator*() [3/3]

template<class T , class U >
auto operator* ( const VECTOR2< T > &  aLHS,
const VECTOR2< U > &  aRHS 
)

Definition at line 505 of file vector2d.h.

References VECTOR2< T >::x, and VECTOR2< T >::y.

◆ operator+() [1/2]

template<FloatingPoint T, class U >
VECTOR2< T > operator+ ( const VECTOR2< T > &  aLHS,
const U &  aScalar 
)

Definition at line 446 of file vector2d.h.

References VECTOR2< T >::x, and VECTOR2< T >::y.

◆ operator+() [2/2]

template<class T , class U >
VECTOR2< std::common_type_t< T, U > > operator+ ( const VECTOR2< T > &  aLHS,
const VECTOR2< U > &  aRHS 
)

Definition at line 439 of file vector2d.h.

References VECTOR2< T >::x, and VECTOR2< T >::y.

◆ operator-() [1/3]

template<Integral T, FloatingPoint U>
VECTOR2< T > operator- ( const VECTOR2< T > &  aLHS,
const U &  aScalar 
)

Definition at line 488 of file vector2d.h.

References KiROUND(), VECTOR2< T >::x, and VECTOR2< T >::y.

◆ operator-() [2/3]

template<class T , class U >
VECTOR2< std::common_type_t< T, U > > operator- ( const VECTOR2< T > &  aLHS,
const VECTOR2< U > &  aRHS 
)

Definition at line 467 of file vector2d.h.

References VECTOR2< T >::x, and VECTOR2< T >::y.

◆ operator-() [3/3]

template<FloatingPoint T, class U >
VECTOR2< T > operator- ( const VECTOR2< T > &  aLHS,
aScalar 
)

Definition at line 474 of file vector2d.h.

References VECTOR2< T >::x, and VECTOR2< T >::y.

◆ operator<<()

template<class T >
std::ostream & operator<< ( std::ostream &  aStream,
const VECTOR2< T > &  aVector 
)

Definition at line 668 of file vector2d.h.

References operator<<(), VECTOR2< T >::x, and VECTOR2< T >::y.