template class mrpt::poses::CPoint

Overview

A base class for representing a point in 2D or 3D.

For more information refer to the 2D/3D Geometry tutorial online. This class is based on the CRTP design pattern

See also:

CPoseOrPoint, CPose

#include <mrpt/poses/CPoint.h>

template <class DERIVEDCLASS, std::size_t DIM>
class CPoint:
    public mrpt::poses::CPoseOrPoint,
    public mrpt::Stringifyable
{
public:
    // construction

    CPoint();

    // methods

    template <class OTHERCLASS>
    void AddComponents(const OTHERCLASS& b);

    void operator *= (const double s);

    template <class MATRIX44>
    void getHomogeneousMatrix(MATRIX44& out_HM) const;

    virtual std::string asString() const;
    void fromString(const std::string& s);
    double operator [] (unsigned int i) const;
    double& operator [] (unsigned int i);
};

// direct descendants

class CPoint2D;
class CPoint3D;

Inherited Members

public:
    // typedefs

    typedef mrpt::math::CVectorFixedDouble<static_cast<mrpt::math::matrix_dim_t>(DIM)> vector_t;

    // methods

    double x() const;
    double y() const;
    double& x();
    double& y();
    void x(const double v);
    void y(const double v);
    void x_incr(const double v);
    void y_incr(const double v);

    template <class OTHERCLASS, std::size_t DIM2>
    double sqrDistanceTo(const CPoseOrPoint<OTHERCLASS, DIM2>& b) const;

    template <class OTHERCLASS, std::size_t DIM2>
    double distanceTo(const CPoseOrPoint<OTHERCLASS, DIM2>& b) const;

    double distance2DToSquare(double ax, double ay) const;
    double distance3DToSquare(double ax, double ay, double az) const;
    double distance2DTo(double ax, double ay) const;
    double distance3DTo(double ax, double ay, double az) const;
    double distanceTo(const mrpt::math::TPoint3D& b) const;
    double norm() const;
    vector_t asVectorVal() const;

    template <class MATRIX44>
    MATRIX44 getHomogeneousMatrixVal() const;

    template <class MATRIX44>
    void getInverseHomogeneousMatrix(MATRIX44& out_HM) const;

    template <class MATRIX44>
    MATRIX44 getInverseHomogeneousMatrixVal() const;

    static bool is3DPoseOrPoint();
    CPoseOrPoint& operator = (const CPoseOrPoint&);
    CPoseOrPoint& operator = (CPoseOrPoint&&);
    const DERIVEDCLASS& derived() const;
    DERIVEDCLASS& derived();
    virtual std::string asString() const = 0;

Methods

template <class OTHERCLASS>
void AddComponents(const OTHERCLASS& b)

Scalar addition of all coordinates.

This is different from poses/point composition, which is implemented as “+” operators in classes derived from “CPose”

void operator *= (const double s)

Scalar multiplication.

template <class MATRIX44>
void getHomogeneousMatrix(MATRIX44& out_HM) const

Returns the corresponding 4x4 homogeneous transformation matrix for the point(translation) or pose (translation+orientation).

See also:

getInverseHomogeneousMatrix

virtual std::string asString() const

Returns a human-readable textual representation of the object (eg: “[0.02 1.04]” )

See also:

fromString

void fromString(const std::string& s)

Set the current object value from a string generated by ‘asString’ (eg: “[0.02 1.04]” )

Parameters:

std::exception

On invalid format

See also:

asString