<commit_before>#ifndef __MAPS_LINESEGMENT_HPP__
#define __MAPS_LINESEGMENT_HPP__

/** Base types **/
#include <base/Float.hpp>

/** Eigen **/
#include <Eigen/Core>
#include <Eigen/Geometry>

#include <math.h>
#include <utility>

namespace maps
{
    /**@brief LineSegment class IEEE 1873 standard
     * adapted to lines in D-space.
     * T type (e.g. float or double)
     * D int specification for the dimensional space
     * **/
    template <typename T, int D>
    class LineSegment: public Eigen::ParametrizedLine<T, D>
    {
    public:
        typedef typename Eigen::Matrix<T, D, 1> VectorType;

    private:
        /**  Origin (psi_a) and End (psi_b) point of the line 
         * m_origin form the parent class is the psi_a **/
        VectorType _psi_b;

    public:
        LineSegment(const VectorType &psi_a, const VectorType &psi_b)
            : Eigen::ParametrizedLine<T, D>(psi_a, (psi_b-psi_a).normalized()),
            _psi_b(psi_b)
        {
        }

        inline const VectorType& psi_a() const
        {
            return const_cast<LineSegment<T, D>& >(*this).origin();
        }

        inline VectorType& psi_a()
        {
            return Eigen::ParametrizedLine<T, D>::origin();
        }


        inline const VectorType& psi_b() const
        {
            return const_cast<VectorType& >(_psi_b);
        }

        void psi_b(const VectorType &other_psi_b)
        {
            this->_psi_b = other_psi_b;
            this->direction() =  (this->_psi_b - this->_psi_a).normalized();
            return;
        }

        inline const VectorType& direction() const
        {
            return const_cast<LineSegment<T, D>& >(*this).direction();
        }

        inline VectorType& direction()
        {
            return Eigen::ParametrizedLine<T, D>::direction();
        }


        /** Perpendicular distance from the origin of the local coordinate
         * system of the map to the line segment. Unit is meter. **/
        inline T rho() const
        {
            /** The distance of zero to its projection onto the line **/
            T dist = this->distance(VectorType::Zero());

            /** In case the projected distance is zero the line is passing by
             * the origin of the local coordinate system**/
            if (dist == 0.00)
            {
                dist += this->origin().norm();
            }

            return dist;<commit_msg>src: fixed bug in method psi_b(&psi_b) of the class LineSegment<commit_after>#ifndef __MAPS_LINESEGMENT_HPP__
#define __MAPS_LINESEGMENT_HPP__

/** Base types **/
#include <base/Float.hpp>

/** Eigen **/
#include <Eigen/Core>
#include <Eigen/Geometry>

#include <math.h>
#include <utility>

namespace maps
{
    /**@brief LineSegment class IEEE 1873 standard
     * adapted to lines in D-space.
     * T type (e.g. float or double)
     * D int specification for the dimensional space
     * **/
    template <typename T, int D>
    class LineSegment: public Eigen::ParametrizedLine<T, D>
    {
    public:
        typedef typename Eigen::Matrix<T, D, 1> VectorType;

    private:
        /**  Origin (psi_a) and End (psi_b) point of the line 
         * m_origin form the parent class is the psi_a **/
        VectorType _psi_b;

    public:
        LineSegment(const VectorType &psi_a, const VectorType &psi_b)
            : Eigen::ParametrizedLine<T, D>(psi_a, (psi_b-psi_a).normalized()),
            _psi_b(psi_b)
        {
        }

        inline const VectorType& psi_a() const
        {
            return const_cast<LineSegment<T, D>& >(*this).origin();
        }

        inline VectorType& psi_a()
        {
            return static_cast<VectorType&>(Eigen::ParametrizedLine<T, D>::origin());
        }


        inline const VectorType& psi_b() const
        {
            return const_cast<VectorType& >(_psi_b);
        }

        void psi_b(const VectorType &other_psi_b)
        {
            this->_psi_b = other_psi_b;
            this->direction() =  (this->_psi_b - this->origin()).normalized();
            return;
        }

        inline const VectorType& direction() const
        {
            return const_cast<LineSegment<T, D>& >(*this).direction();
        }

        inline VectorType& direction()
        {
            return static_cast<VectorType&>(Eigen::ParametrizedLine<T, D>::direction());
        }


        /** Perpendicular distance from the origin of the local coordinate
         * system of the map to the line segment. Unit is meter. **/
        inline T rho() const
        {
            /** The distance of zero to its projection onto the line **/
            T dist = this->distance(VectorType::Zero());

            /** In case the projected distance is zero the line is passing by
             * the origin of the local coordinate system**/
            if (dist == 0.00)
            {
                dist += this->origin().norm();
            }

            return dist;
{'fraction_non_alphanumeric': 0.11160533764658309, 'fraction_numerical': 0.003234937323089365, 'mean_word_length': 1.9981818181818183, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 49, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4486581', 'n_tokens_mistral': 1494, 'n_tokens_neox': 1422, 'n_words': 412}