6 #ifndef DECOMP_POLYGON_H 7 #define DECOMP_POLYGON_H 19 return n_.dot(pt -
p_);
55 for (
const auto& v : vs_) {
67 for (
const auto &it : O) {
77 for (
size_t i = 0; i < vs_.size(); i++)
78 ns[i] = std::make_pair(vs_[i].
p_, vs_[i].
n_);
110 const unsigned int size = vs.size();
114 for (
unsigned int i = 0; i < size; i++) {
115 const auto n = vs[i].n_;
117 if (n.dot(p0) - c > 0) {
131 VecDf d = A_ * pt - b_;
132 for (
unsigned int i = 0; i < d.rows(); i++) {
vec_E< Vecf< N >> vec_Vecf
Vector of Eigen 1D float vector.
Definition: data_type.h:69
bool inside(const Vecf< Dim > &pt)
Check if the point is inside polyhedron using linear constraint.
Definition: polyhedron.h:130
bool inside(const Vecf< Dim > &pt) const
Check if the point is inside polyhedron, non-exclusive.
Definition: polyhedron.h:54
decimal_t signed_dist(const Vecf< Dim > &pt) const
Calculate the signed distance from point.
Definition: polyhedron.h:18
LinearConstraint(const Vecf< Dim > p0, const vec_E< Hyperplane< Dim >> &vs)
Construct from a inside point and hyperplane array.
Definition: polyhedron.h:109
[A, b] for
Definition: polyhedron.h:99
Vecf< Dim > p_
Point on the plane.
Definition: polyhedron.h:28
Polyhedron class.
Definition: polyhedron.h:41
constexpr decimal_t epsilon_
Compensate for numerical error.
Definition: data_type.h:126
void add(const Hyperplane< Dim > &v)
Append Hyperplane.
Definition: polyhedron.h:49
Vecf< Eigen::Dynamic > VecDf
Dynamic Nx1 Eigen float vector.
Definition: data_type.h:106
vec_Vecf< Dim > points_inside(const vec_Vecf< Dim > &O) const
Calculate points inside polyhedron, non-exclusive.
Definition: polyhedron.h:65
vec_E< Hyperplane< Dim > > hyperplanes() const
Get the hyperplane array.
Definition: polyhedron.h:83
vec_E< Hyperplane< Dim > > vs_
Hyperplane array.
Definition: polyhedron.h:88
Eigen::Matrix< decimal_t, Eigen::Dynamic, N > MatDNf
MxN Eigen matrix with M unknown.
Definition: data_type.h:66
decimal_t dist(const Vecf< Dim > &pt) const
Calculate the distance from point.
Definition: polyhedron.h:23
Polyhedron()
Null constructor.
Definition: polyhedron.h:43
double decimal_t
Rename the float type used in lib.
Definition: data_type.h:50
std::vector< T, Eigen::aligned_allocator< T >> vec_E
Pre-allocated std::vector for Eigen using vec_E.
Definition: data_type.h:54
Vecf< Dim > n_
Normal of the plane, directional.
Definition: polyhedron.h:30
Defines all data types used in this lib.
Eigen::Matrix< decimal_t, N, 1 > Vecf
Eigen 1D float vector.
Definition: data_type.h:57
Hyperplane class.
Definition: polyhedron.h:13
Polyhedron(const vec_E< Hyperplane< Dim >> &vs)
Construct from Hyperplane array.
Definition: polyhedron.h:45
vec_E< std::pair< Vecf< Dim >, Vecf< Dim > > > cal_normals() const
Calculate normals, used for visualization.
Definition: polyhedron.h:75
LinearConstraint(const MatDNf< Dim > &A, const VecDf &b)
Construct from directly, s.t .
Definition: polyhedron.h:103
LinearConstraint()
Null constructor.
Definition: polyhedron.h:101