Program Listing for File plane3d.hpp

Return to documentation for file (include/tuw_geometry/plane3d.hpp)

#ifndef TUW_GEOMETRY__PLANE3D_HPP
#define TUW_GEOMETRY__PLANE3D_HPP

#include <memory>
#include <opencv2/core/core.hpp>
#include <tuw_geometry/utils.hpp>

namespace tuw
{
class Plane3D;
using Plane3DPtr = std::shared_ptr<Plane3D>;
using Plane3DConstPtr = std::shared_ptr<Plane3D const>;

class Plane3D : public cv::Vec4d
{
public:
  friend std::ostream & operator<<(std::ostream & os, const Plane3D & o)
  {
    os << "[" << o.val[0] << ", " << o.val[1] << ", " << o.val[2] << ", " << o.val[3] << "]";
    return os;
  }
  Plane3D();
  Plane3D(const Plane3D & plane);

  const cv::Vec3d & normal() const;

  void create(const cv::Vec3d & p1, const cv::Vec3d & p2, const cv::Vec3d & p3);

  void create(const cv::Vec3d & p, const cv::Vec3d & n);

  bool intersectionLine(
    const cv::Vec3d & p1, const cv::Vec3d & p2, cv::Vec3d & intersection,
    float epsilon = 0.00001) const;

private:
  double mult();
};
}  // namespace tuw
#endif  // TUW_GEOMETRY__PLANE3D_HPP