MRSL DecompUtil Library  0.1
An implementaion of convex decomposition over point cloud
seed_decomp.h
Go to the documentation of this file.
1 
5 #ifndef SEED_DECOMP_H
6 #define SEED_DECOMP_H
7 
9 
15 template <int Dim>
16 class SeedDecomp : public DecompBase<Dim> {
17  public:
19  SeedDecomp() {};
25  SeedDecomp(const Vecf<Dim> &p) : p_(p) {}
30  void dilate(decimal_t radius) {
32  this->find_polyhedron();
34  }
35 
37  Vecf<Dim> get_seed() const {
38  return p_;
39  }
40 
41  protected:
44  if(this->local_bbox_.norm() == 0)
45  return;
46 
47  //**** virtual walls x-y-z
49  Vecf<Dim> dir_h = Vecf<Dim>::UnitY();
50 
51  Vecf<Dim> pp1 = p_ + dir_h * this->local_bbox_(1);
52  Vecf<Dim> pp2 = p_ - dir_h * this->local_bbox_(1);
53  Vs.add(Hyperplane<Dim>(pp1, dir_h));
54  Vs.add(Hyperplane<Dim>(pp2, -dir_h));
55 
56  // along y
57  Vecf<Dim> pp3 = p_ + dir * this->local_bbox_(0);
58  Vecf<Dim> pp4 = p_ - dir * this->local_bbox_(0);
59  Vs.add(Hyperplane<Dim>(pp3, dir));
60  Vs.add(Hyperplane<Dim>(pp4, -dir));
61 
62  // along z
63  if(Dim > 2) {
64  Vecf<Dim> dir_v = Vecf<Dim>::UnitZ();
65  Vecf<Dim> pp5 = p_ + dir_v * this->local_bbox_(2);
66  Vecf<Dim> pp6 = p_ - dir_v * this->local_bbox_(2);
67  Vs.add(Hyperplane<Dim>(pp5, dir_v));
68  Vs.add(Hyperplane<Dim>(pp6, -dir_v));
69  }
70  }
71 
74 };
75 
77 
79 
80 #endif
Line Segment Class.
Definition: decomp_base.h:18
Vecf< Dim > local_bbox_
Local bounding box along the line segment.
Definition: decomp_base.h:94
void dilate(decimal_t radius)
Inflate the seed with a sphere.
Definition: seed_decomp.h:30
Polyhedron< Dim > polyhedron_
Output polyhedron.
Definition: decomp_base.h:91
Polyhedron class.
Definition: polyhedron.h:41
Definition: ellipsoid.h:14
SeedDecomp(const Vecf< Dim > &p)
Basic constructor.
Definition: seed_decomp.h:25
void add(const Hyperplane< Dim > &v)
Append Hyperplane.
Definition: polyhedron.h:49
void add_local_bbox(Polyhedron< Dim > &Vs)
Add the bounding box.
Definition: seed_decomp.h:43
SeedDecomp()
Simple constructor.
Definition: seed_decomp.h:19
Eigen::Matrix< decimal_t, M, N > Matf
MxN Eigen matrix.
Definition: data_type.h:63
Decomp Base Class.
double decimal_t
Rename the float type used in lib.
Definition: data_type.h:50
Vecf< Dim > p_
Seed location.
Definition: seed_decomp.h:73
Eigen::Matrix< decimal_t, N, 1 > Vecf
Eigen 1D float vector.
Definition: data_type.h:57
Hyperplane class.
Definition: polyhedron.h:13
Ellipsoid< Dim > ellipsoid_
Output ellipsoid.
Definition: decomp_base.h:89
Seed Decomp Class.
Definition: seed_decomp.h:16
Vecf< Dim > get_seed() const
Get the center.
Definition: seed_decomp.h:37