Class point3d_t

Nested Relationships

Nested Types

Class Documentation

class point3d_t

3D point representation for the SLAM framework.

This class stores position and color and exposes conversion and arithmetic helpers used across mapping, tracking, and optimization modules.

Public Types

using shared_ptr = std::shared_ptr<point3d_t>

Typedef for shared pointer to point3d_t.

using weak_ptr = std::weak_ptr<point3d_t>

Typedef for weak pointer to point3d_t.

using unique_ptr = std::unique_ptr<point3d_t>

Typedef for unique pointer to point3d_t.

using vector = vector_t<point3d_t>

Typedef for vector of point3d_t.

using pair = pair_t<point3d_t, point3d_t>

Typedef for pair of point3d_t.

Public Functions

inline point3d_t()

Default constructor initializing all coordinates and color to zero.

inline point3d_t(const double x_, const double y_, const double z_, const double red_ = 0, const double green_ = 0, const double blue_ = 0)

Construct a 3D point with position and color.

Parameters:
  • x_ – Parameter x_.

  • y_ – Parameter y_.

  • z_ – Parameter z_.

  • red_ – Parameter red_.

  • green_ – Parameter green_.

  • blue_ – Parameter blue_.

inline point3d_t(const point3d_t &other_)

Construct a new Point 3d object.

Parameters:

other_ – Parameter other_.

inline point3d_t(point3d_t::shared_ptr other_)

Construct a new Point 3d object.

Parameters:

other_ – Parameter other_.

inline point3d_t(const point3d_t::weak_ptr other_)

Construct a new Point 3d object from a weak pointer.

Parameters:

other_ – Parameter other_.

inline point3d_t(const Eigen::Vector3d &pointEigen_, const Eigen::Vector3d &colorEigen_ = Eigen::Vector3d(0, 0, 0))

Construct a new Point 3d object.

Parameters:
  • pointEigen_ – Parameter pointEigen_.

  • colorEigen_ – Parameter colorEigen_.

inline point3d_t(const array3D_t &pointArray_)

Constructs a 3D point from an array of three doubles.

Parameters:

pointArray_ – Parameter pointArray_.

inline auto operator->()

Pointer-like access to this point.

inline auto operator->() const

Pointer-like access to this point (const).

inline bool is_unset() const

Checks if the point is set (i.e., has valid coordinates and color).

Returns:

true if was defined before

Returns:

false if was not defined before

inline bool operator!() const

Returns true when the point is unset.

inline operator bool() const

Checks if the point is set (i.e., has valid coordinates and color).

Returns:

true if was defined before

Returns:

false if was not defined before

inline void print() const

Prints the 3D point coordinates and color values.

inline bool operator==(const point3d_t &other_) const

Defines the == operator for point3d_t.

Parameters:

other_ – Parameter other_.

inline point3d_t &operator=(const point3d_t &other_)

Assignment operator for point3d_t.

Parameters:

other_ – Parameter other_.

Returns:

Reference to this object

inline point3d_t &operator*=(const double scale_)

Scales the coordinates of the point3d_t by a given factor.

Parameters:

scale_ – Parameter scale_.

Returns:

Reference to the scaled point3d_t.

inline point3d_t operator+(const point3d_t &other_)

Adds the coordinates of another point3d_t to this point3d_t.

Parameters:

other_ – Parameter other_.

Returns:

The result of the coordinate-wise addition.

inline point3d_t operator+(const translation_t &other_)

Adds the coordinates of another point3d_t to this point3d_t.

Parameters:

other_ – Parameter other_.

Returns:

The result of the coordinate-wise addition.

inline point3d_t &operator+=(const point3d_t &other_)

Adds the coordinates of another point3d_t to this point.

Parameters:

other_ – Parameter other_.

Returns:

Reference to this point3d_t object after addition.

inline point3d_t operator-(const point3d_t &other_) const

Subtracts the coordinates of another point3d_t from this point3d_t.

Parameters:

other_ – Parameter other_.

Returns:

The result of the coordinate-wise subtraction.

inline point3d_t operator-(const translation_t &other_) const

Subtracts the coordinates of another point3d_t from this point3d_t.

Parameters:

other_ – Parameter other_.

Returns:

The result of the coordinate-wise subtraction.

inline point3d_t &operator-=(const point3d_t &other_)

Subtracts the coordinates of another point3d_t.

Parameters:

other_ – Parameter other_. from this point and assigns the result to this point.

Returns:

Reference to this point3d_t object after subtraction.

inline point3d_t &operator-=(const point3d_t::shared_ptr other_)

Subtracts the coordinates of another point3d_t from this point.

Parameters:

other_ – Parameter other_. and assigns the result to this point.

Returns:

Reference to this point3d_t object after subtraction.

inline void set_coordinates(const Eigen::Vector3d &coordinates_)

Set the coordinates object.

Parameters:

coordinates_ – New coordinates for the point`.

inline void set_color(const Eigen::Vector3d &color_)

Set the color of the point using an Eigen vector.

Parameters:

color_ – New color for the point.

inline void set_color(const array3Uchar_t &color_)

Set the color of the point using an Eigen vector.

Parameters:

color_ – New color for the point.

inline array3D_t set_coordinates(const array3D_t &coordinates_)

Set the coordinates object.

Parameters:

coordinates_ – New coordinates for the point.

Returns:

The previous coordinates of the point

inline void set_coordinates(const double x_, const double y_, const double z_)

Set the coordinates of the point using individual double values.

Parameters:
  • x_ – New x coordinate for the point.

  • y_ – New y coordinate for the point.

  • z_ – New z coordinate for the point.

inline void set_color(const double red_, const double green_, const double blue_)

Set the color of the point using individual double values.

Parameters:
  • red_ – Parameter red_.

  • green_ – Parameter green_.

  • blue_ – Parameter blue_.

inline double operator[](const int index_) const

Access the coordinates of the point.

Parameters:

index_ – Parameter index_.

inline Eigen::Vector3d to_eigen() const

Get the 3D point coordinates as an Eigen vector.

Returns:

Returned value.

inline array6D_t to_6d_array() const

Spatial and color components to a 6-element array.

Returns:

Returned value.

inline array3D_t to_3d_array() const

Converts the point coordinates to a 3D array.

Returns:

Returned value.

inline operator array3D_t() const

Conversion operators: array3D

Returns:

Returned value.

inline operator array6D_t() const

Conversion operators: array6D

Returns:

Returned value.

inline operator Eigen::Vector3d() const

Conversion operators: Eigen::Vector3d

Returns:

Returned value.

inline operator std::string() const

Conversion operators: std::string

Returns:

Returned value.

inline void apply_scale(const double scale_)

Apply a scale factor to the point coordinates.

Parameters:

scale_ – Scale parameter.

Public Static Functions

static inline point3d_t::shared_ptr make_shared()

Make shared pointer function

Returns:

Returned the new empty object.

static inline bool set_coordinates(point3d_t::weak_ptr pointPtr_, const array3D_t &point_)

Sets the coordinates of a point3d_t object from a weak pointer.

Parameters:
  • pointPtr_ – Parameter pointPtr_.

  • point_ – Parameter point_.

Returns:

Returned the pointer to the new object.

static inline point3d_t::shared_ptr make_shared(const double x_, const double y_, const double z_, const double red_ = 0, const double green_ = 0, const double blue_ = 0)

Make shared pointer function with parameters

Parameters:
  • x_ – Parameter x_.

  • y_ – Parameter y_.

  • z_ – Parameter z_.

  • red_ – Parameter red_.

  • green_ – Parameter green_.

  • blue_ – Parameter blue_.

Returns:

Returned the pointer to the new object.

static inline point3d_t::shared_ptr make_shared(const point3d_t &other_)

Make shared pointer function from another point3d_t

Parameters:

other_ – Parameter other_.

Returns:

Returned the pointer to the new object.

Public Static Attributes

static const point3d_t::shared_ptr BAD_POINTER = nullptr

Bad pointer.

Private Members

double _x
double _y
double _z
double _red
double _green
double _blue
mutable std::shared_mutex _mutex
struct id_pair

Typedef a pair of id and shared pointer to point3d_t.

Subclassed by slam_mer::neighbor_t

Public Types

using vector = std::vector<id_pair>

Public Functions

inline id_pair(point_id_t pointId_, keyframe_id_t keyframeId_, point3d_t::shared_ptr ptr_)

Constructor

Parameters:
  • pointId_ – Parameter pointId_.

  • keyframeId_ – Parameter keyframeId_.

  • ptr_ – Parameter ptr_.

Public Members

point_id_t pointId

Id of the neighbor point.

keyframe_id_t keyframeId

Id of the keyframe.

point3d_t::shared_ptr shared_ptr

Shared pointer to the neighbor point.