OpenVDB 13.1.0
Loading...
Searching...
No Matches
Vec2< T > Class Template Reference

A simple vector class with three components, similar to openvdb::math::Vec3. More...

#include <nanovdb/math/Math.h>

Public Types

using ValueType = T

Public Member Functions

 Vec2 ()=default
__hostdev__ Vec2 (T x)
__hostdev__ Vec2 (T x, T y)
template<template< class > class Vec2T, class T2>
__hostdev__ Vec2 (const Vec2T< T2 > &v)
template<typename T2>
__hostdev__ Vec2 (const Vec2< T2 > &v)
__hostdev__ Vec2 (const Coord2 &ijk)
__hostdev__ bool operator== (const Vec2 &rhs) const
__hostdev__ bool operator!= (const Vec2 &rhs) const
template<template< class > class Vec2T, class T2>
__hostdev__ Vec2operator= (const Vec2T< T2 > &rhs)
__hostdev__ const T & operator[] (int i) const
__hostdev__ T & operator[] (int i)
template<typename Vec2T>
__hostdev__dot (const Vec2T &v) const
__hostdev__lengthSqr () const
__hostdev__length () const
__hostdev__ Vec2 operator- () const
__hostdev__ Vec2 operator* (const Vec2 &v) const
__hostdev__ Vec2 operator/ (const Vec2 &v) const
__hostdev__ Vec2 operator+ (const Vec2 &v) const
__hostdev__ Vec2 operator- (const Vec2 &v) const
__hostdev__ Vec2 operator+ (const Coord &ijk) const
__hostdev__ Vec2 operator- (const Coord &ijk) const
__hostdev__ Vec2 operator* (const T &s) const
__hostdev__ Vec2 operator/ (const T &s) const
__hostdev__ Vec2operator+= (const Vec2 &v)
__hostdev__ Vec2operator+= (const Coord &ijk)
__hostdev__ Vec2operator-= (const Vec2 &v)
__hostdev__ Vec2operator-= (const Coord &ijk)
__hostdev__ Vec2operator*= (const T &s)
__hostdev__ Vec2operator/= (const T &s)
__hostdev__ Vec2normalize ()
__hostdev__ Vec2minComponent (const Vec2 &other)
 Perform a component-wise minimum with the other Coord.
__hostdev__ Vec2maxComponent (const Vec2 &other)
 Perform a component-wise maximum with the other Coord.
__hostdev__ ValueType min () const
 Return the smallest vector component.
__hostdev__ ValueType max () const
 Return the largest vector component.
__hostdev__ Coord2 floor () const
 Round each component if this Vec<T> up to its integer value.
__hostdev__ Coord2 ceil () const
 Round each component if this Vec<T> down to its integer value.
__hostdev__ Coord2 round () const
 Round each component if this Vec<T> to its closest integer value.
__hostdev__ T * asPointer ()
 return a non-const raw constant pointer to array of three vector components
__hostdev__ const T * asPointer () const
 return a const raw constant pointer to array of three vector components

Static Public Attributes

static const int SIZE = 2
static const int size = 2

Detailed Description

template<typename T>
class nanovdb::math::Vec2< T >

A simple vector class with three components, similar to openvdb::math::Vec3.

Member Typedef Documentation

◆ ValueType

template<typename T>
using ValueType = T

Constructor & Destructor Documentation

◆ Vec2() [1/6]

template<typename T>
Vec2 ( )
default

◆ Vec2() [2/6]

template<typename T>
__hostdev__ Vec2 ( T x)
inlineexplicit

◆ Vec2() [3/6]

template<typename T>
__hostdev__ Vec2 ( T x,
T y )
inline

◆ Vec2() [4/6]

template<typename T>
template<template< class > class Vec2T, class T2>
__hostdev__ Vec2 ( const Vec2T< T2 > & v)
inline

◆ Vec2() [5/6]

template<typename T>
template<typename T2>
__hostdev__ Vec2 ( const Vec2< T2 > & v)
inlineexplicit

◆ Vec2() [6/6]

template<typename T>
__hostdev__ Vec2 ( const Coord2 & ijk)
inlineexplicit

Member Function Documentation

◆ asPointer() [1/2]

template<typename T>
__hostdev__ T * asPointer ( )
inline

return a non-const raw constant pointer to array of three vector components

◆ asPointer() [2/2]

template<typename T>
__hostdev__ const T * asPointer ( ) const
inline

return a const raw constant pointer to array of three vector components

◆ ceil()

template<typename T>
__hostdev__ Coord2 ceil ( ) const
inline

Round each component if this Vec<T> down to its integer value.

Returns
Return an integer Coord

◆ dot()

template<typename T>
template<typename Vec2T>
__hostdev__ T dot ( const Vec2T & v) const
inline

◆ floor()

template<typename T>
__hostdev__ Coord2 floor ( ) const
inline

Round each component if this Vec<T> up to its integer value.

Returns
Return an integer Coord

◆ length()

template<typename T>
__hostdev__ T length ( ) const
inline

◆ lengthSqr()

template<typename T>
__hostdev__ T lengthSqr ( ) const
inline

◆ max()

template<typename T>
__hostdev__ ValueType max ( ) const
inline

Return the largest vector component.

◆ maxComponent()

template<typename T>
__hostdev__ Vec2 & maxComponent ( const Vec2< T > & other)
inline

Perform a component-wise maximum with the other Coord.

◆ min()

template<typename T>
__hostdev__ ValueType min ( ) const
inline

Return the smallest vector component.

◆ minComponent()

template<typename T>
__hostdev__ Vec2 & minComponent ( const Vec2< T > & other)
inline

Perform a component-wise minimum with the other Coord.

◆ normalize()

template<typename T>
__hostdev__ Vec2 & normalize ( )
inline

◆ operator!=()

template<typename T>
__hostdev__ bool operator!= ( const Vec2< T > & rhs) const
inline

◆ operator*() [1/2]

template<typename T>
__hostdev__ Vec2 operator* ( const T & s) const
inline

◆ operator*() [2/2]

template<typename T>
__hostdev__ Vec2 operator* ( const Vec2< T > & v) const
inline

◆ operator*=()

template<typename T>
__hostdev__ Vec2 & operator*= ( const T & s)
inline

◆ operator+() [1/2]

template<typename T>
__hostdev__ Vec2 operator+ ( const Coord & ijk) const
inline

◆ operator+() [2/2]

template<typename T>
__hostdev__ Vec2 operator+ ( const Vec2< T > & v) const
inline

◆ operator+=() [1/2]

template<typename T>
__hostdev__ Vec2 & operator+= ( const Coord & ijk)
inline

◆ operator+=() [2/2]

template<typename T>
__hostdev__ Vec2 & operator+= ( const Vec2< T > & v)
inline

◆ operator-() [1/3]

template<typename T>
__hostdev__ Vec2 operator- ( ) const
inline

◆ operator-() [2/3]

template<typename T>
__hostdev__ Vec2 operator- ( const Coord & ijk) const
inline

◆ operator-() [3/3]

template<typename T>
__hostdev__ Vec2 operator- ( const Vec2< T > & v) const
inline

◆ operator-=() [1/2]

template<typename T>
__hostdev__ Vec2 & operator-= ( const Coord & ijk)
inline

◆ operator-=() [2/2]

template<typename T>
__hostdev__ Vec2 & operator-= ( const Vec2< T > & v)
inline

◆ operator/() [1/2]

template<typename T>
__hostdev__ Vec2 operator/ ( const T & s) const
inline

◆ operator/() [2/2]

template<typename T>
__hostdev__ Vec2 operator/ ( const Vec2< T > & v) const
inline

◆ operator/=()

template<typename T>
__hostdev__ Vec2 & operator/= ( const T & s)
inline

◆ operator=()

template<typename T>
template<template< class > class Vec2T, class T2>
__hostdev__ Vec2 & operator= ( const Vec2T< T2 > & rhs)
inline

◆ operator==()

template<typename T>
__hostdev__ bool operator== ( const Vec2< T > & rhs) const
inline

◆ operator[]() [1/2]

template<typename T>
__hostdev__ T & operator[] ( int i)
inline

◆ operator[]() [2/2]

template<typename T>
__hostdev__ const T & operator[] ( int i) const
inline

◆ round()

template<typename T>
__hostdev__ Coord2 round ( ) const
inline

Round each component if this Vec<T> to its closest integer value.

Returns
Return an integer Coord

Member Data Documentation

◆ SIZE

template<typename T>
const int SIZE = 2
static

◆ size

template<typename T>
const int size = 2
static