Loading...
Searching...
No Matches
cuproj::vec_2d< T > Class Template Reference

A generic 2D vector type. More...

#include <vec_2d.hpp>

Public Types

using value_type = T
 

Public Attributes

value_type x
 
value_type y
 

Friends

std::ostream & operator<< (std::ostream &os, vec_2d< T > const &vec)
 Output stream operator for vec_2d<T> for human-readable formatting.
 
bool CUPROJ_HOST_DEVICE operator== (vec_2d< T > const &lhs, vec_2d< T > const &rhs)
 Compare two 2D vectors for equality.
 
vec_2d< T > CUPROJ_HOST_DEVICE operator+ (vec_2d< T > const &a, vec_2d< T > const &b)
 Element-wise addition of two 2D vectors.
 
vec_2d< T > CUPROJ_HOST_DEVICE operator- (vec_2d< T > const &a, vec_2d< T > const &b)
 Element-wise subtraction of two 2D vectors.
 
vec_2d< T > CUPROJ_HOST_DEVICE operator- (vec_2d< T > const &a)
 Invert a 2D vector.
 
vec_2d< T > CUPROJ_HOST_DEVICE operator* (vec_2d< T > vec, T const &r)
 Scale a 2D vector by a factor r.
 
vec_2d< T > CUPROJ_HOST_DEVICE operator* (T const &r, vec_2d< T > vec)
 Scale a 2d vector by ratio r.
 
vec_2d< T > &CUPROJ_HOST_DEVICE operator+= (vec_2d< T > &a, vec_2d< T > const &b)
 Translate a 2D point.
 
vec_2d< T > &CUPROJ_HOST_DEVICE operator-= (vec_2d< T > &a, vec_2d< T > const &b)
 Translate a 2D point.
 
bool CUPROJ_HOST_DEVICE operator< (vec_2d< T > const &lhs, vec_2d< T > const &rhs)
 Less than operator for two 2D points.
 
bool CUPROJ_HOST_DEVICE operator> (vec_2d< T > const &lhs, vec_2d< T > const &rhs)
 Greater than operator for two 2D points.
 
bool CUPROJ_HOST_DEVICE operator<= (vec_2d< T > const &lhs, vec_2d< T > const &rhs)
 Less than or equal to operator for two 2D points.
 
bool CUPROJ_HOST_DEVICE operator>= (vec_2d< T > const &lhs, vec_2d< T > const &rhs)
 Greater than or equal to operator for two 2D points.
 

Detailed Description

template<typename T>
class cuproj::vec_2d< T >

A generic 2D vector type.

This is the base type used in cuspatial for both Longitude/Latitude (LonLat) coordinate pairs and Cartesian (X/Y) coordinate pairs. For LonLat pairs, the x member represents Longitude, and y represents Latitude.

Template Parameters
Tthe base type for the coordinates

Definition at line 42 of file vec_2d.hpp.

Member Typedef Documentation

◆ value_type

template<typename T >
using cuproj::vec_2d< T >::value_type = T

Definition at line 44 of file vec_2d.hpp.

Friends And Related Symbol Documentation

◆ operator* [1/2]

template<typename T >
vec_2d< T > CUPROJ_HOST_DEVICE operator* ( T const & r,
vec_2d< T > vec )
friend

Scale a 2d vector by ratio r.

Definition at line 100 of file vec_2d.hpp.

◆ operator* [2/2]

template<typename T >
vec_2d< T > CUPROJ_HOST_DEVICE operator* ( vec_2d< T > vec,
T const & r )
friend

Scale a 2D vector by a factor r.

Definition at line 92 of file vec_2d.hpp.

◆ operator+

template<typename T >
vec_2d< T > CUPROJ_HOST_DEVICE operator+ ( vec_2d< T > const & a,
vec_2d< T > const & b )
friend

Element-wise addition of two 2D vectors.

Definition at line 68 of file vec_2d.hpp.

◆ operator+=

template<typename T >
vec_2d< T > &CUPROJ_HOST_DEVICE operator+= ( vec_2d< T > & a,
vec_2d< T > const & b )
friend

Translate a 2D point.

Definition at line 105 of file vec_2d.hpp.

◆ operator- [1/2]

template<typename T >
vec_2d< T > CUPROJ_HOST_DEVICE operator- ( vec_2d< T > const & a)
friend

Invert a 2D vector.

Definition at line 84 of file vec_2d.hpp.

◆ operator- [2/2]

template<typename T >
vec_2d< T > CUPROJ_HOST_DEVICE operator- ( vec_2d< T > const & a,
vec_2d< T > const & b )
friend

Element-wise subtraction of two 2D vectors.

Definition at line 76 of file vec_2d.hpp.

◆ operator-=

template<typename T >
vec_2d< T > &CUPROJ_HOST_DEVICE operator-= ( vec_2d< T > & a,
vec_2d< T > const & b )
friend

Translate a 2D point.

Definition at line 115 of file vec_2d.hpp.

◆ operator<

template<typename T >
bool CUPROJ_HOST_DEVICE operator< ( vec_2d< T > const & lhs,
vec_2d< T > const & rhs )
friend

Less than operator for two 2D points.

Orders two points first by x, then by y.

Definition at line 125 of file vec_2d.hpp.

◆ operator<<

template<typename T >
std::ostream & operator<< ( std::ostream & os,
vec_2d< T > const & vec )
friend

Output stream operator for vec_2d<T> for human-readable formatting.

Definition at line 52 of file vec_2d.hpp.

◆ operator<=

template<typename T >
bool CUPROJ_HOST_DEVICE operator<= ( vec_2d< T > const & lhs,
vec_2d< T > const & rhs )
friend

Less than or equal to operator for two 2D points.

Definition at line 145 of file vec_2d.hpp.

◆ operator==

template<typename T >
bool CUPROJ_HOST_DEVICE operator== ( vec_2d< T > const & lhs,
vec_2d< T > const & rhs )
friend

Compare two 2D vectors for equality.

Definition at line 60 of file vec_2d.hpp.

◆ operator>

template<typename T >
bool CUPROJ_HOST_DEVICE operator> ( vec_2d< T > const & lhs,
vec_2d< T > const & rhs )
friend

Greater than operator for two 2D points.

Definition at line 137 of file vec_2d.hpp.

◆ operator>=

template<typename T >
bool CUPROJ_HOST_DEVICE operator>= ( vec_2d< T > const & lhs,
vec_2d< T > const & rhs )
friend

Greater than or equal to operator for two 2D points.

Definition at line 153 of file vec_2d.hpp.

Member Data Documentation

◆ x

template<typename T >
value_type cuproj::vec_2d< T >::x

Definition at line 45 of file vec_2d.hpp.

◆ y

template<typename T >
value_type cuproj::vec_2d< T >::y

Definition at line 46 of file vec_2d.hpp.


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