template<typename Real>
class Utils::Point2D< Real >
A class representing a 2D point in space.
The Point2D
class extends the Eigen::Matrix
class to provide a convenient representation of a point in a two-dimensional space. It encapsulates operations related to 2D points, allowing easy access to the x and y coordinates. This class leverages the Eigen library for efficient matrix and vector computations.
- Template Parameters
-
Real | The data type used for the point coordinates, typically a floating-point type (e.g., float, double). |
Features
- Coordinate Access: Provides methods to access the x and y coordinates of the point easily.
- Eigen Compatibility: Supports seamless conversion to and from Eigen's matrix representation, allowing users to leverage Eigen's functionalities directly with the
Point2D
class.
Methods
- Default Constructor:
- Initializes a
Point2D
object with default values.
- Real x() const:
- Returns the x-coordinate of the point.
- Real y() const:
- Returns the y-coordinate of the point.
- P2D const & to_eigen() const:
- Returns a constant reference to the underlying Eigen matrix representation of the point.
- P2D & to_eigen():
- Returns a reference to the underlying Eigen matrix representation of the point, allowing for modifications.
Usage
#include <Eigen/Dense>
Eigen::Matrix<double, 2, 1> eigen_point = point.
to_eigen();
Real x() const
Definition Utils_GG2D.hh:103
P2D const & to_eigen() const
Definition Utils_GG2D.hh:106
Real y() const
Definition Utils_GG2D.hh:104