Skip to content

Commit 9c2c812

Browse files
committed
option to specify padding
1 parent ee2af98 commit 9c2c812

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

voxec.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -247,3 +247,11 @@ scope_map run(const std::vector<statement_type>& statements, double size, size_t
247247

248248
return context;
249249
}
250+
251+
size_t padding_ = 32;
252+
size_t get_padding() {
253+
return padding_;
254+
}
255+
void set_padding(size_t v) {
256+
padding_ = v;
257+
}

voxec.h

+9-8
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ struct filtered_files_t {};
5656
#define DIRSEP "/"
5757
#endif
5858

59+
size_t get_padding();
60+
void set_padding(size_t);
61+
5962
typedef boost::variant<boost::blank, filtered_files_t, geometry_collection_t*, abstract_voxel_storage*, function_arg_value_type> symbol_value;
6063

6164
class voxel_operation;
@@ -435,19 +438,17 @@ namespace {
435438
BRepBndLib::Add(p.second, global_bounds);
436439
}
437440

438-
const size_t PADDING = 32U;
439-
440441
global_bounds.Get(x1, y1, z1, x2, y2, z2);
441442
nx = (int)ceil((x2 - x1) / vsize);
442443
ny = (int)ceil((y2 - y1) / vsize);
443444
nz = (int)ceil((z2 - z1) / vsize);
444445

445-
x1 -= vsize * PADDING;
446-
y1 -= vsize * PADDING;
447-
z1 -= vsize * PADDING;
448-
nx += PADDING * 2;
449-
ny += PADDING * 2;
450-
nz += PADDING * 2;
446+
x1 -= vsize * get_padding();
447+
y1 -= vsize * get_padding();
448+
z1 -= vsize * get_padding();
449+
nx += get_padding() * 2;
450+
ny += get_padding() * 2;
451+
nz += get_padding() * 2;
451452

452453
std::unique_ptr<fill_volume_t> method;
453454
if (use_volume) {

voxec_main.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ int main(int argc, char** argv) {
1818
("log-file", po::value<std::string>(), "filename to log json message")
1919
("threads,t", po::value<size_t>(), "number of parallel processing threads")
2020
("size,d", po::value<double>(), "voxel size in meters")
21+
("padding,p", po::value<size_t>(), "padding around geometry bounding box (default=32)")
2122
("chunk,c", po::value<size_t>(), "chunk size in number of voxels")
2223
("mmap,m", "use memory-mapped files instead of pure RAM")
2324
("mesh", "emit obj mesh for the last instruction")
@@ -53,6 +54,10 @@ int main(int argc, char** argv) {
5354
d = vmap["size"].as<double>();
5455
}
5556

57+
if (vmap.count("padding")) {
58+
set_padding(vmap["padding"].as<size_t>());
59+
}
60+
5661
boost::optional<size_t> threads, chunk;
5762

5863
if (vmap.count("threads")) {

0 commit comments

Comments
 (0)