summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGiles Bathgate <gilesbathgate@gmail.com>2011-04-10 23:18:17 (GMT)
committerGiles Bathgate <gilesbathgate@gmail.com>2011-04-10 23:18:17 (GMT)
commit6cce430eed9910d9cf84e220ed96479dd7167d4f (patch)
treea542019b617a60636b9f0a501d59bb375fb13df7 /src
parentcdc4574a9c1d6be012eab8e49b55e4472a71d563 (diff)
parent0c1b1f4e2243696cbec0427c41182c5529a6c55f (diff)
Merge branch 'master' into convex-hull
Conflicts: src/cgaladv_minkowski2.cc
Diffstat (limited to 'src')
-rw-r--r--src/cgaladv_minkowski2.cc57
-rw-r--r--src/openscad.cc16
2 files changed, 31 insertions, 42 deletions
diff --git a/src/cgaladv_minkowski2.cc b/src/cgaladv_minkowski2.cc
index 116139f..8d0bf62 100644
--- a/src/cgaladv_minkowski2.cc
+++ b/src/cgaladv_minkowski2.cc
@@ -31,7 +31,6 @@
#include "grid.h"
#include "cgal.h"
-#if 1
#include <CGAL/minkowski_sum_2.h>
@@ -58,9 +57,9 @@ void print_polygon (const CGAL::Polygon_2<Kernel, Container>& P)
template<class Kernel, class Container>
void print_polygon_with_holes (const CGAL::Polygon_with_holes_2<Kernel, Container>& pwh) {
if (! pwh.is_unbounded()) {
- std::cout << "{ Outer boundary = ";
- print_polygon (pwh.outer_boundary());
- } else
+ std::cout << "{ Outer boundary = ";
+ print_polygon (pwh.outer_boundary());
+ } else
std::cout << "{ Unbounded polygon." << std::endl;
typename CGAL::Polygon_with_holes_2<Kernel,Container>::Hole_const_iterator hit;
@@ -88,23 +87,20 @@ CGAL_Poly2 nef2p2(CGAL_Nef_polyhedron2 p)
for (fci_t fit = E.faces_begin(), fend = E.faces_end(); fit != fend; ++fit)
{
- std::cout << "face " << ((E.mark(fit))? "is part of polygon" : "is not part of polygon") << std::endl;
- if (!E.mark(fit)) {
- continue;
- }
+ if (!E.mark(fit)) {
+ continue;
+ }
//if (fit != E.faces_begin()) {
if (points.size() != 0) {
PRINT("WARNING: minkowski() is not implemented for 2d objects with holes!");
- break;
+ break;
}
heafcc_t fcirc(E.halfedge(fit)), fend(fcirc);
CGAL_For_all(fcirc, fend) {
- //std::cout << "fcirc,fend " << std::endl;
if (E.is_standard(E.target(fcirc))) {
Explorer::Point ep = E.point(E.target(fcirc));
double x = to_double(ep.x()), y = to_double(ep.y());
- std::cout << "point " << ep << std::endl;
grid.align(x, y);
points.push_back(CGAL_ExactKernel2::Point_2(x, y));
}
@@ -115,7 +111,7 @@ CGAL_Poly2 nef2p2(CGAL_Nef_polyhedron2 p)
}
static CGAL_Nef_polyhedron2 p2nef2(CGAL_Poly2 p2) {
std::list<CGAL_Nef_polyhedron2::Point> points;
- for (int j = 0; j < p2.size(); j++) {
+ for (size_t j = 0; j < p2.size(); j++) {
double x = to_double(p2[j].x());
double y = to_double(p2[j].y());
CGAL_Nef_polyhedron2::Point p = CGAL_Nef_polyhedron2::Point(x, y);
@@ -127,33 +123,20 @@ static CGAL_Nef_polyhedron2 p2nef2(CGAL_Poly2 p2) {
CGAL_Nef_polyhedron2 minkowski2(CGAL_Nef_polyhedron2 a, CGAL_Nef_polyhedron2 b)
{
CGAL_Poly2 ap = nef2p2(a), bp = nef2p2(b);
- std::cout << "ap = "; print_polygon(ap);
- std::cout << "bp = "; print_polygon(bp);
-
- if (ap.size() == 0) {
- PRINT("WARNING: minkowski() could not get any points from object 1!");
- return CGAL_Nef_polyhedron2();
- } else if (bp.size() == 0) {
- PRINT("WARNING: minkowski() could not get any points from object 2!");
- return CGAL_Nef_polyhedron2();
- } else {
- CGAL_Poly2h x = minkowski_sum_2(ap, bp);
- std::cout << "result = "; print_polygon_with_holes(x);
-
- // Make a CGAL_Nef_polyhedron2 out of just the boundary for starters
- return p2nef2(x.outer_boundary());
- }
-}
-
-#else
-CGAL_Nef_polyhedron2 minkowski2(CGAL_Nef_polyhedron2, CGAL_Nef_polyhedron2)
-{
- PRINT("WARNING: minkowski() is not implemented yet for 2d objects!");
- return CGAL_Nef_polyhedron2();
+ if (ap.size() == 0) {
+ PRINT("WARNING: minkowski() could not get any points from object 1!");
+ return CGAL_Nef_polyhedron2();
+ } else if (bp.size() == 0) {
+ PRINT("WARNING: minkowski() could not get any points from object 2!");
+ return CGAL_Nef_polyhedron2();
+ } else {
+ CGAL_Poly2h x = minkowski_sum_2(ap, bp);
+
+ // Make a CGAL_Nef_polyhedron2 out of just the boundary for starters
+ return p2nef2(x.outer_boundary());
+ }
}
#endif
-#endif
-
diff --git a/src/openscad.cc b/src/openscad.cc
index bc1d845..aa0188c 100644
--- a/src/openscad.cc
+++ b/src/openscad.cc
@@ -144,15 +144,21 @@ int main(int argc, char **argv)
("o", po::value<string>(), "off-file")
("x", po::value<string>(), "dxf-file")
("d", po::value<string>(), "deps-file")
- ("m", po::value<string>(), "make file")
- ("D", po::value<vector<string> >(), "var=val")
- ;
+ ("m", po::value<string>(), "makefile")
+ ("D", po::value<vector<string> >(), "var=val");
+
+ po::options_description hidden("Hidden options");
+ hidden.add_options()
+ ("input-file", po::value< vector<string> >(), "input file");
po::positional_options_description p;
p.add("input-file", -1);
+ po::options_description all_options;
+ all_options.add(desc).add(hidden);
+
po::variables_map vm;
- po::store(po::command_line_parser(argc, argv).options(desc).positional(p).run(), vm);
+ po::store(po::command_line_parser(argc, argv).options(all_options).positional(p).run(), vm);
// po::notify(vm);
if (vm.count("help")) help(argv[0]);
@@ -348,7 +354,7 @@ int main(int argc, char **argv)
new MainWindow(qfilename);
vector<string> inputFiles;
if (vm.count("input-file")) {
- inputFiles = vm["input-files"].as<vector<string> >();
+ inputFiles = vm["input-file"].as<vector<string> >();
for (vector<string>::const_iterator i = inputFiles.begin()+1; i != inputFiles.end(); i++) {
new MainWindow(QFileInfo(original_path, i->c_str()).absoluteFilePath());
}
contact: Jan Huwald // Impressum