59 std::vector<Neighbors>& neighbors) {
60 typedef std::vector<Vec6s> VectorVec6s;
63 for (std::size_t i = 0; i < boxes.size(); ++i) {
73 assert(s == fixedSize);
75 for (VectorVec6s::const_iterator it = boxes.begin(); it != boxes.end();
77 const Vec6s& otherBox = *it;
84 if ((fabs(
x - xo - s) < e) && (fabs(
y - yo) < e) && (fabs(z - zo) < e)) {
86 }
else if ((fabs(
x - xo + s) < e) && (fabs(
y - yo) < e) &&
89 }
else if ((fabs(
x - xo) < e) && (fabs(
y - yo - s) < e) &&
92 }
else if ((fabs(
x - xo) < e) && (fabs(
y - yo + s) < e) &&
95 }
else if ((fabs(
x - xo) < e) && (fabs(
y - yo) < e) &&
96 (fabs(z - zo - s) < e)) {
98 }
else if ((fabs(
x - xo) < e) && (fabs(
y - yo) < e) &&
99 (fabs(z - zo + s) < e)) {
109 std::vector<Vec6s> boxes(this->
toBoxes());
110 std::vector<internal::Neighbors> neighbors(boxes.size());
114 typedef std::vector<Vec3s> VectorVec3s;
115 std::vector<Vec3s> vertices;
117 typedef std::array<std::size_t, 4> Array4;
118 typedef std::vector<Array4> VectorArray4;
119 std::vector<Array4> faces;
121 for (std::size_t i = 0; i < boxes.size(); ++i) {
141 Array4
a = {{8 * i + 1, 8 * i + 5, 8 * i + 7, 8 * i + 3}};
145 Array4
a = {{8 * i + 2, 8 * i + 4, 8 * i + 8, 8 * i + 6}};
149 Array4
a = {{8 * i + 1, 8 * i + 2, 8 * i + 6, 8 * i + 5}};
153 Array4
a = {{8 * i + 4, 8 * i + 3, 8 * i + 7, 8 * i + 8}};
157 Array4
a = {{8 * i + 1, 8 * i + 2, 8 * i + 4, 8 * i + 3}};
161 Array4
a = {{8 * i + 5, 8 * i + 6, 8 * i + 8, 8 * i + 7}};
170 (std::string(
"failed to open file \"") +
filename + std::string(
"\""))
174 os <<
"# list of vertices\n";
175 for (VectorVec3s::const_iterator it = vertices.begin(); it != vertices.end();
178 os <<
"v " <<
v[0] <<
" " <<
v[1] <<
" " <<
v[2] <<
'\n';
180 os <<
"\n# list of faces\n";
181 for (VectorArray4::const_iterator it = faces.begin(); it != faces.end();
183 const Array4& f = *it;
184 os <<
"f " << f[0] <<
" " << f[1] <<
" " << f[2] <<
" " << f[3] <<
'\n';
189 const Eigen::Matrix<CoalScalar, Eigen::Dynamic, 3>& point_cloud,
191 typedef Eigen::Matrix<CoalScalar, Eigen::Dynamic, 3> InputType;
192 typedef InputType::ConstRowXpr RowType;
194 shared_ptr<octomap::OcTree>
octree(
new octomap::OcTree(resolution));
195 for (Eigen::DenseIndex row_id = 0; row_id < point_cloud.rows(); ++row_id) {
196 RowType row = point_cloud.row(row_id);
197 octree->updateNode(row[0], row[1], row[2],
true,
true);
199 octree->updateInnerOccupancy();