UFO 1.0.0
An Efficient Probabilistic 3D Mapping Framework That Embraces the Unknown
Loading...
Searching...
No Matches
ufo::Normal< Dim, T > Struct Template Reference

Represents an N-dimensional unit surface normal vector as a fixed-size array. More...

#include <lib/core/include/ufo/core/normal.hpp>

Inheritance diagram for ufo::Normal< Dim, T >:
ufo::Vec< Dim, T >

Public Member Functions

constexpr Normal () noexcept=default
 Default-constructs with indeterminate component values.
 
template<std::convertible_to< T >... Args>
requires (sizeof...(Args) == Dim)
constexpr Normal (Args... args) noexcept
 Constructs from exactly Dim scalar components.
 
constexpr Normal (Vec< Dim, T > const &normal) noexcept
 Constructs from a Vec<Dim, T>.
 
- Public Member Functions inherited from ufo::Vec< Dim, T >
constexpr Vec () noexcept=default
 Default constructor; initializes all elements to zero.
 
constexpr auto begin (this auto &self) noexcept
 Returns an iterator to the first element.
 
constexpr auto data (this auto &self) noexcept
 Returns a pointer to the underlying element array.
 
constexpr auto end (this auto &self) noexcept
 Returns a past-the-end iterator.
 
template<class U >
constexpr explicit (!std::is_same_v< T, U >) Vec(Vec< Dim
 Converting constructor from a vector with a different element type.
 
template<std::convertible_to< T >... Args>
requires (sizeof...(Args) <= Dim)
 explicit (sizeof...(Args)==1) const expr Vec(Args... args) noexcept
 Constructs a vector from up to Dim individual element values.
 
constexpr Vecoperator%= (T rhs) noexcept
 Computes the remainder of every component divided by scalar rhs (integral types only).
 
constexpr Vecoperator%= (Vec const &rhs) noexcept
 Computes the remainder of each component divided by the corresponding component of rhs (integral types only).
 
constexpr Vecoperator&= (T rhs) noexcept
 Bitwise ANDs every component with scalar rhs (integral types only).
 
constexpr Vecoperator&= (Vec const &rhs) noexcept
 Bitwise ANDs each component with the corresponding component of rhs (integral types only).
 
constexpr Vecoperator*= (T rhs) noexcept
 Multiplies every component by scalar rhs.
 
constexpr Vecoperator*= (Vec const &rhs) noexcept
 Multiplies each component by the corresponding component of rhs.
 
constexpr Vec operator+ () const noexcept
 Unary identity operator.
 
constexpr Vecoperator+= (T rhs) noexcept
 Adds scalar rhs to every component.
 
constexpr Vecoperator+= (Vec const &rhs) noexcept
 Adds each component of rhs to the corresponding component.
 
constexpr Vec operator- () const noexcept
 Unary negation operator.
 
constexpr Vecoperator-= (T rhs) noexcept
 Subtracts scalar rhs from every component.
 
constexpr Vecoperator-= (Vec const &rhs) noexcept
 Subtracts each component of rhs from the corresponding component.
 
constexpr Vecoperator/= (T rhs) noexcept
 Divides every component by scalar rhs.
 
constexpr Vecoperator/= (Vec const &rhs) noexcept
 Divides each component by the corresponding component of rhs.
 
constexpr Vecoperator<<= (T rhs) noexcept
 Left-shifts every component by scalar rhs (integral types only).
 
constexpr Vecoperator<<= (Vec const &rhs) noexcept
 Left-shifts each component by the corresponding component of rhs (integral types only).
 
constexpr bool operator== (Vec const &) const =default
 Compares two vectors for equality (component-wise).
 
constexpr Vecoperator>>= (T rhs) noexcept
 Right-shifts every component by scalar rhs (integral types only).
 
constexpr Vecoperator>>= (Vec const &rhs) noexcept
 Right-shifts each component by the corresponding component of rhs (integral types only).
 
constexpr auto & operator[] (this auto &self, size_type i) noexcept
 Accesses the element at index i.
 
constexpr Vecoperator^= (T rhs) noexcept
 Bitwise XORs every component with scalar rhs (integral types only).
 
constexpr Vecoperator^= (Vec const &rhs) noexcept
 Bitwise XORs each component with the corresponding component of rhs (integral types only).
 
constexpr Vecoperator|= (T rhs) noexcept
 Bitwise ORs every component with scalar rhs (integral types only).
 
constexpr Vecoperator|= (Vec const &rhs) noexcept
 Bitwise ORs each component with the corresponding component of rhs (integral types only).
 
constexpr Vec operator~ () const noexcept
 Bitwise NOT operator (integral types only).
 
constexpr auto & w (this auto &self) noexcept
 Accesses the fourth component (w).
 
constexpr auto & x (this auto &self) noexcept
 Accesses the first component (x).
 
constexpr auto & y (this auto &self) noexcept
 Accesses the second component (y).
 
constexpr auto & z (this auto &self) noexcept
 Accesses the third component (z).
 

Additional Inherited Members

- Public Types inherited from ufo::Vec< Dim, T >
using size_type = std::size_t
 
using value_type = T
 
- Static Public Member Functions inherited from ufo::Vec< Dim, T >
static constexpr std::size_t size () noexcept
 Returns the number of dimensions.
 
- Public Attributes inherited from ufo::Vec< Dim, T >
std::array< T, Dim > fields {}
 
constexpr U const &other noexcept
 

Detailed Description

template<std::size_t Dim = 3, std::floating_point T = float>
struct ufo::Normal< Dim, T >

Represents an N-dimensional unit surface normal vector as a fixed-size array.

Normal<N, T> is a trivially-copyable aggregate that holds a surface normal direction. The normal is not automatically normalized on construction — callers are responsible for ensuring unit length when semantics require it.

Intended for use as a per-point attribute in a Cloud / PointCloud SoA channel, alongside position data and other attributes.

Template Parameters
DimDimensionality of the normal vector (typically 2 or 3).
TScalar type for each component (defaults to float).

Convenience aliases:

  • Normal2f / Normal3f / Normal4f — single-precision
  • Normal2d / Normal3d / Normal4d — double-precision

Definition at line 79 of file normal.hpp.

Constructor & Destructor Documentation

◆ Normal() [1/2]

template<std::size_t Dim = 3, std::floating_point T = float>
constexpr ufo::Normal< Dim, T >::Normal ( Vec< Dim, T > const &  normal)
inlineconstexprnoexcept

Constructs from a Vec<Dim, T>.

Parameters
[in]normalThe vector to initialize the normal from.

Definition at line 90 of file normal.hpp.

◆ Normal() [2/2]

template<std::size_t Dim = 3, std::floating_point T = float>
template<std::convertible_to< T >... Args>
requires (sizeof...(Args) == Dim)
constexpr ufo::Normal< Dim, T >::Normal ( Args...  args)
inlineconstexprnoexcept

Constructs from exactly Dim scalar components.

Parameters
[in]argsComponent values in order (x, y, [z, ...]).

Definition at line 99 of file normal.hpp.


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