Updated offset converter to remove large spikes

This commit is contained in:
Blake Thompson 2015-06-09 11:31:50 -05:00
parent 804e523e71
commit dd104b0b1b

View file

@ -47,7 +47,7 @@ struct MAPNIK_DECL offset_converter
offset_converter(Geometry & geom) offset_converter(Geometry & geom)
: geom_(geom) : geom_(geom)
, offset_(0.0) , offset_(0.0)
, threshold_(5.0) , threshold_(8.0)
, half_turn_segments_(16) , half_turn_segments_(16)
, status_(initial) , status_(initial)
, pre_first_(vertex2d::no_init) , pre_first_(vertex2d::no_init)
@ -266,6 +266,14 @@ private:
double sa = offset_ * std::sin(a); double sa = offset_ * std::sin(a);
double ca = offset_ * std::cos(a); double ca = offset_ * std::cos(a);
double h = std::tan(0.5 * (b - a)); double h = std::tan(0.5 * (b - a));
if (h > 3.0)
{
h = 3.0;
}
else if (h < -3.0)
{
h = -3.0;
}
v.x = v.x + sa + h * ca; v.x = v.x + sa + h * ca;
v.y = v.y - ca + h * sa; v.y = v.y - ca + h * sa;
} }