Program Listing for File Plane.hpp

Return to documentation for file (include/lvr2/geometry/Plane.hpp)

/*
 * Plane.hpp
 *
 *  @date 14.07.2017
 *  @author Johan M. von Behren <johan@vonbehren.eu>
 */

#ifndef LVR2_GEOMETRY_PLANE_H_
#define LVR2_GEOMETRY_PLANE_H_

#include "Normal.hpp"
#include "Line.hpp"

namespace lvr2
{

template <typename BaseVecT>
struct Plane
{
    Plane() : normal(0, 0, 1) {}

    Normal<typename BaseVecT::CoordType> normal;
    BaseVecT pos;

    BaseVecT project(const BaseVecT& other) const;

    float distance(const BaseVecT& other) const;

    Line<BaseVecT> intersect(const Plane<BaseVecT>& other) const;
};

template<typename BaseVecT>
inline std::ostream& operator<<(std::ostream& os, const Plane<BaseVecT>& p)
{
    os << "Plane[" << p.normal << ", " << p.pos << "]";
    return os;
}

} // namespace lvr2

#include "lvr2/geometry/Plane.tcc"

#endif /* LVR2_GEOMETRY_PLANE_H_ */