#ifndef MY_PLANE_SHAPE_H
#define MY_PLANE_SHAPE_H
#include <CGAL/number_utils.h>
template <class Traits>
public:
typedef typename Traits::FT
FT;
typedef typename Traits::Point_3 Point;
typedef typename Traits::Vector_3 Vector;
My_Plane() :
{ }
const FT sd = (this->constr_vec(m_point_on_primitive, p)) * m_normal;
return sd * sd;
}
Vector plane_normal() const {
return m_normal;
}
FT d() const {
return m_d;
}
virtual std::string
info()
const {
std::stringstream sstr;
sstr << "Type: plane (" << this->get_x(m_normal) << ", "
<< this->get_y(m_normal) << ", " << this->get_z(m_normal) << ")x - " <<
m_d << " = 0" << " #Pts: " << this->m_indices.size();
return sstr.str();
}
protected:
virtual void create_shape(
const std::vector<std::size_t>& indices) {
const Point p1 = this->
point(indices[0]);
const Point p2 = this->
point(indices[1]);
const Point p3 = this->
point(indices[2]);
m_normal = this->cross_pdct(p1 - p2, p1 - p3);
m_normal = m_normal * (1.0 /
sqrt(this->sqlen(m_normal)));
m_d = -(p1[0] * m_normal[0] + p1[1] * m_normal[1] + p1[2] * m_normal[2]);
m_point_on_primitive = p1;
this->m_is_valid = true;
}
const std::vector<std::size_t>& indices,
std::vector<FT>& dists) const {
for (std::size_t i = 0; i < indices.size(); ++i) {
const FT sd = (this->
point(indices[i]) - m_point_on_primitive) * m_normal;
dists[i] = sd * sd;
}
}
const std::vector<std::size_t>& indices,
std::vector<FT>& angles) const {
for (std::size_t i = 0; i < indices.size(); ++i)
}
return 3;
}
private:
Point m_point_on_primitive;
Vector m_normal;
FT m_d;
};
#endif
A convenience header that includes all classes related to the efficient RANSAC algorithm.
Base class for shape types that defines an interface to construct a shape from a set of points and to...
Definition: Shape_base.h:49
boost::property_traits< typenameTraits::Point_map >::reference point(std::size_t i) const
Retrieves the point location from its index.
Definition: Shape_base.h:376
virtual void cos_to_normal(const std::vector< std::size_t > &indices, std::vector< FT > &angles) const =0
Computes the deviation of the point normal from the surface normal at the projected point in form of ...
boost::property_traits< typenameTraits::Normal_map >::reference normal(std::size_t i) const
Retrieves the normal vector from its index.
Definition: Shape_base.h:384
virtual void create_shape(const std::vector< std::size_t > &indices)=0
Constructs the shape based on a minimal set of samples from the input data.
Traits::FT FT
Number type.
Definition: Shape_base.h:69
virtual FT squared_distance(const Point_3 &p) const =0
Computes the squared Euclidean distance from the query point p to the shape.
virtual std::string info() const
Returns a string containing the shape type and the numerical parameters.
Definition: Shape_base.h:96
virtual std::size_t minimum_sample_size() const =0
Returns minimal number of sample points required for construction.