Fixed Save bezier feature. Saved samples added

This commit is contained in:
Fernando Cacciola 2009-12-01 14:15:06 +00:00
parent 833284ec62
commit c2912fc076
5 changed files with 118 additions and 5 deletions

2
.gitattributes vendored
View File

@ -910,6 +910,8 @@ Boolean_set_operations_2/examples/Boolean_set_operations_2/amer_k.bps -text
Boolean_set_operations_2/examples/Boolean_set_operations_2/bezier_traits_adapter2.cpp -text
Boolean_set_operations_2/examples/Boolean_set_operations_2/char_g.dat -text
Boolean_set_operations_2/examples/Boolean_set_operations_2/char_m.dat -text
Boolean_set_operations_2/examples/Boolean_set_operations_2/input_0.bps -text
Boolean_set_operations_2/examples/Boolean_set_operations_2/input_1.bps -text
Boolean_set_operations_2/examples/Boolean_set_operations_2/pgn_holes.dat -text
Boolean_set_operations_2/examples/Boolean_set_operations_2/test.dxf -text svneol=unset#application/octet-stream
Boolean_set_operations_2/include/CGAL/Boolean_set_operations_2/Gps_on_surface_base_2.h -text

View File

@ -889,7 +889,7 @@ bool save_circular ( QString aFileName, Circular_polygon_set& rSet )
return rOK ;
}
void save_bezier_polygon( std::ostream& out_file, Bezier_polygon const& aBP )
void save_bezier_polygon( std::ostream& out_file, Bezier_polygon const& aBP, boost::optional<Linear_point>& rLastP )
{
out_file << aBP.size() << std::endl ;
@ -905,7 +905,11 @@ void save_bezier_polygon( std::ostream& out_file, Bezier_polygon const& aBP )
for ( Linear_point_vector::const_iterator pit = lQ.begin() ; pit != lQ.end() ; ++ pit )
{
out_file << pit->x() << " " << pit->y() << std::endl ;
Linear_point lP = pit == lQ.begin() && !!rLastP ? *rLastP : *pit ;
out_file << lP.x() << " " << lP.y() << std::endl ;
rLastP = lP ;
}
}
}
@ -930,10 +934,12 @@ bool save_bezier ( QString aFileName, Bezier_polygon_set const& aSet )
out_file << ( 1 + bpwh.number_of_holes() ) << std::endl ;
save_bezier_polygon( out_file, bpwh.outer_boundary() ) ;
boost::optional<Linear_point> lLastP ;
save_bezier_polygon( out_file, bpwh.outer_boundary() , lLastP ) ;
for ( Bezier_polygon_with_holes::Hole_const_iterator hit = bpwh.holes_begin() ; hit != bpwh.holes_end() ; ++ hit )
save_bezier_polygon(out_file, *hit);
save_bezier_polygon(out_file, *hit, lLastP );
rOK = true ;
}

View File

@ -108,7 +108,7 @@ struct Bezier_helper
}
template<class Bezier_X_monotone_curve, class Output_iterator>
static void approximated_clip ( Bezier_X_monotone_curve const& aXMCurve, Output_iterator aOut, double aApproxError = 1e-3 )
static void approximated_clip ( Bezier_X_monotone_curve const& aXMCurve, Output_iterator aOut, double aApproxError = 1e-10 )
{
typedef typename value_type_traits<Output_iterator>::type Output_point ;

View File

@ -0,0 +1,48 @@
DOUBLE
1
1
9
4
-6.18819 -63.2992
-22.6303 -16.5027
-32.5842 0.783979
-34 3
4
-34 3
-103 111
-158 192
-241 143
4
-241 143
-324 94
-307 46
-361 118
4
-361 118
-410.351 183.802
-492.277 156.057
-492.277 114.916
4
-492.277 114.916
-490.318 104.011
-490.011 103.03
-490 103
4
-490 103
-472 56
-474 52
-468 21
3
-468 21
-462 -10
-446 -18
4
-446 -18
-384 -206
-321 -360
-175 -224
4
-175 -224
-68.9702 -125.233
-6.18819 -107.159
-6.18819 -63.2992

View File

@ -0,0 +1,57 @@
DOUBLE
1
1
11
4
-278.944 -19.9798
-278.957 -34.4347
-279.241 -47.4194
-279.228 -58.984
4
-279.228 -58.984
-274.669 -116.195
-246.089 -136.579
-203 -139
4
-203 -139
-114 -144
-114 -158
-47 -108
4
-47 -108
1.25439 -71.9893
33.4288 -79.5501
33.4592 -56.3397
4
33.4592 -56.3397
24.4709 -25.7293
18.8323 -12.774
18 -11
4
18 -11
-20 70
21 108
-52 110
4
-52 110
-125 112
-50 37
-139 68
4
-139 68
-228 99
-188 140
-238 105
3
-238 105
-280.373 75.339
-280.373 13.3597
3
-280.373 13.3597
-279.209 -8.13847
-279 -10
4
-279 -10
-278.96 -13.4014
-278.944 -16.7276
-278.944 -19.9798