mirror of https://github.com/vitalif/openscad
cleanup
parent
66b9efb35e
commit
66b6433ffe
|
@ -94,7 +94,7 @@ public:
|
|||
contour.push_back( point2d );
|
||||
}
|
||||
|
||||
assert(contour.size()>1);
|
||||
if (contour.size()==0) continue;
|
||||
|
||||
log << " <!-- is_simple_2:" << CGAL::is_simple_2( contour.begin(), contour.end() ) << " --> \n";
|
||||
|
||||
|
@ -108,10 +108,10 @@ public:
|
|||
*(output_nefpoly2d) *= *(tmpnef2d);
|
||||
}
|
||||
|
||||
log << "\n<!-- ======== output tmp nef: ==== -->\n";
|
||||
log << OpenSCAD::dump_svg( *tmpnef2d ) << "\n";
|
||||
log << "\n<!-- ======== output accumulator: ==== -->\n";
|
||||
log << OpenSCAD::dump_svg( *output_nefpoly2d ) << "\n";
|
||||
log << "\n<!-- ======== output tmp nef: ==== -->\n"
|
||||
<< OpenSCAD::dump_svg( *tmpnef2d ) << "\n"
|
||||
<< "\n<!-- ======== output accumulator: ==== -->\n"
|
||||
<< OpenSCAD::dump_svg( *output_nefpoly2d ) << "\n";
|
||||
|
||||
contour_counter++;
|
||||
} else {
|
||||
|
|
|
@ -59,8 +59,9 @@ typedef CGAL::Polyhedron_incremental_builder_3<CGAL_HDS> CGAL_Polybuilder;
|
|||
typedef CGAL::Point_3<CGAL_Kernel3> CGAL_Point_3;
|
||||
typedef CGAL::Iso_cuboid_3<CGAL_Kernel3> CGAL_Iso_cuboid_3;
|
||||
|
||||
// The type given to Iso_rectangle_2 needs to match CGAL_Nef2::Explorer::Point
|
||||
// which is different than a CGAL_Kernel2::Point. Hence the suffix 'e'
|
||||
// CGAL_Nef_polyhedron2 uses CGAL_Kernel2, but Iso_rectangle_2 needs to match
|
||||
// CGAL_Nef_polyhedron2::Explorer::Point which is different than
|
||||
// CGAL_Kernel2::Point. Hence the suffix 'e'
|
||||
typedef CGAL_Nef_polyhedron2::Explorer::Point CGAL_Point_2e;
|
||||
typedef CGAL::Iso_rectangle_2< CGAL::Simple_cartesian<NT> > CGAL_Iso_rectangle_2e;
|
||||
|
||||
|
|
|
@ -3,8 +3,11 @@
|
|||
#include "cgalutils.h"
|
||||
#include "polyset.h"
|
||||
#include "printutils.h"
|
||||
|
||||
#include "cgal.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
PolySet *createPolySetFromPolyhedron(const CGAL_Polyhedron &p)
|
||||
{
|
||||
PolySet *ps = new PolySet();
|
||||
|
@ -142,7 +145,6 @@ CGAL_Polyhedron *createPolyhedronFromPolySet(const PolySet &ps)
|
|||
return P;
|
||||
}
|
||||
|
||||
|
||||
CGAL_Iso_cuboid_3 bounding_box( const CGAL_Nef_polyhedron3 &N )
|
||||
{
|
||||
CGAL_Iso_cuboid_3 result(-1,-1,-1,1,1,1);
|
||||
|
@ -171,8 +173,5 @@ CGAL_Iso_rectangle_2e bounding_box( const CGAL_Nef_polyhedron2 &N )
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* ENABLE_CGAL */
|
||||
|
||||
|
|
|
@ -530,4 +530,3 @@ void register_builtin_functions()
|
|||
Builtins::init("version", new BuiltinFunction(&builtin_version));
|
||||
Builtins::init("version_num", new BuiltinFunction(&builtin_version_num));
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,3 @@ void PRINT_NOCACHE(const std::string &msg)
|
|||
outputhandler(msg, outputhandler_data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <boost/format.hpp>
|
||||
|
||||
typedef void (OutputHandlerFunc)(const std::string &msg, void *userdata);
|
||||
|
|
26
src/svg.cc
26
src/svg.cc
|
@ -5,14 +5,13 @@
|
|||
|
||||
namespace OpenSCAD {
|
||||
|
||||
|
||||
// SVG code
|
||||
// currently for debugging, not necessarily pretty or useful for users.
|
||||
// currently for debugging, not necessarily pretty or useful for users. (yet)
|
||||
|
||||
std::string svg_header( int pixw, int pixh )
|
||||
std::string svg_header()
|
||||
{
|
||||
std::stringstream out;
|
||||
out << "<svg width='" << pixw << "px' height='" << pixh << "px'"
|
||||
out << "<svg width='" << svg_px_width << "px' height='" << svg_px_height << "px'"
|
||||
<< " xmlns='http://www.w3.org/2000/svg' version='1.1'>";
|
||||
return out.str();
|
||||
}
|
||||
|
@ -28,7 +27,10 @@ std::string svg_border()
|
|||
{
|
||||
std::stringstream out;
|
||||
out << " <!-- border -->\n";
|
||||
out << " <polyline points='0,0 480,0 480,480 0,480'"
|
||||
out << " <polyline points='0,0 "
|
||||
<< svg_px_width << ",0 "
|
||||
<< svg_px_width << "," << svg_px_height
|
||||
<< " 0," << svg_px_height << "'"
|
||||
<< " style='fill:none;stroke:black' />\n";
|
||||
out << " <!-- /border -->";
|
||||
return out.str();
|
||||
|
@ -46,8 +48,8 @@ std::string svg_axes()
|
|||
|
||||
CGAL_Point_2e project_svg_3to2( CGAL_Point_3 p, CGAL_Iso_cuboid_3 bbox )
|
||||
{
|
||||
NT screenw(480);
|
||||
NT screenh(480);
|
||||
NT screenw(svg_px_width);
|
||||
NT screenh(svg_px_height);
|
||||
NT screenxc = screenw / 2;
|
||||
NT screenyc = screenh / 2;
|
||||
NT bboxx = ( bbox.xmax() - bbox.xmin() );
|
||||
|
@ -70,8 +72,8 @@ CGAL_Point_2e project_svg_2to2( CGAL_Point_2e p, CGAL_Iso_rectangle_2e bbox )
|
|||
{
|
||||
double x = CGAL::to_double( p.x() );
|
||||
double y = CGAL::to_double( p.y() );
|
||||
double screenw = 480;
|
||||
double screenh = 480;
|
||||
double screenw = svg_px_width;
|
||||
double screenh = svg_px_height;
|
||||
double borderw = screenw * 0.1618;
|
||||
double borderh = screenh * 0.1618;
|
||||
double vizw = screenw - borderw*2;
|
||||
|
@ -132,9 +134,11 @@ std::string dump_svg( const CGAL_Nef_polyhedron2 &N )
|
|||
CGAL_Iso_rectangle_2e bbox = bounding_box( N );
|
||||
|
||||
CGAL_Nef_polyhedron2::Explorer::Face_const_iterator i;
|
||||
out << " <svg y='" << svg_cursor << "' width='480px' height='480px' xmlns='http://www.w3.org/2000/svg' version='1.1'>\n";
|
||||
out << " <svg y='" << svg_cursor_py << "' width='" << svg_px_width
|
||||
<< "' height='" << svg_px_height
|
||||
<< "' xmlns='http://www.w3.org/2000/svg' version='1.1'>\n";
|
||||
out << svg_border() << "\n" << svg_axes() << "\n";
|
||||
svg_cursor+=480;
|
||||
svg_cursor_py += svg_px_height;
|
||||
|
||||
for ( i = explorer.faces_begin(); i!= explorer.faces_end(); ++i ) {
|
||||
out << " <!-- face begin. mark: " << i->mark() << " -->\n";
|
||||
|
|
22
src/svg.h
22
src/svg.h
|
@ -7,27 +7,19 @@
|
|||
|
||||
namespace OpenSCAD {
|
||||
|
||||
static int svg_cursor = 0;
|
||||
// currently for debugging, not necessarily pretty or useful for users. (yet)
|
||||
|
||||
std::string svg_header( int pixwidth = 480, int pixheight = 480 );
|
||||
std::string svg_label(std::string s);
|
||||
static int svg_cursor_py = 0;
|
||||
static int svg_px_width = 480;
|
||||
static int svg_px_height = 480;
|
||||
|
||||
std::string svg_header();
|
||||
std::string svg_label( std::string s );
|
||||
std::string svg_border();
|
||||
std::string svg_axes();
|
||||
CGAL_Point_2e project_svg_3to2( CGAL_Point_3 p, CGAL_Iso_cuboid_3 bbox );
|
||||
CGAL_Point_2e project_svg_2to2( CGAL_Point_2e p, CGAL_Iso_rectangle_2e bbox );
|
||||
|
||||
std::string dump_cgal_nef_polyhedron2_face_svg(
|
||||
CGAL_Nef_polyhedron2::Explorer::Halfedge_around_face_const_circulator c1,
|
||||
CGAL_Nef_polyhedron2::Explorer::Halfedge_around_face_const_circulator c2,
|
||||
CGAL_Nef_polyhedron2::Explorer explorer,
|
||||
std::string color,
|
||||
bool mark,
|
||||
CGAL_Iso_rectangle_2e bbox );
|
||||
std::string dump_svg( const CGAL_Nef_polyhedron2 &N );
|
||||
class NefPoly3_dumper_svg;
|
||||
std::string dump_svg( const CGAL_Nef_polyhedron3 &N );
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue