@@ -11,6 +11,8 @@ use serde_json::{json, Value};
1111
1212use super :: DEFAULT_POLAR_SIZE ;
1313
14+ const ANGLE_TOLERANCE : f64 = 1.49011611938476e-08 ; // f64::EPSILON.sqrt()
15+
1416// =============================================================================
1517// ProjectionRenderer trait
1618// =============================================================================
@@ -278,7 +280,7 @@ impl PolarContext {
278280 let radial = AxisInfo :: new ( "pos1" , scales, facet) ;
279281 let angle = AxisInfo :: new ( "pos2" , scales, facet) ;
280282
281- let is_full_circle = ( end - start - 2.0 * std:: f64:: consts:: PI ) . abs ( ) < f64 :: EPSILON ;
283+ let is_full_circle = ( end - start - 2.0 * std:: f64:: consts:: PI ) . abs ( ) < ANGLE_TOLERANCE ;
282284
283285 let angle_breaks_radians = match angle. domain {
284286 Some ( ( d_min, d_max) ) if !angle. breaks . is_empty ( ) => {
@@ -1451,8 +1453,8 @@ fn convert_mark_to_polar(mark: &Value, _spec: &Plot) -> Result<Value> {
14511453/// the optional start/end angle range from the PROJECT clause.
14521454fn apply_polar_angle_range ( encoding : & mut Value , panel : & PolarContext ) -> Result < ( ) > {
14531455 // Skip if default range (0 to 2π)
1454- let is_default = panel. start . abs ( ) <= f64 :: EPSILON
1455- && ( panel. end - 2.0 * std:: f64:: consts:: PI ) . abs ( ) <= f64 :: EPSILON ;
1456+ let is_default = panel. start . abs ( ) <= ANGLE_TOLERANCE
1457+ && ( panel. end - 2.0 * std:: f64:: consts:: PI ) . abs ( ) <= ANGLE_TOLERANCE ;
14561458 if is_default {
14571459 return Ok ( ( ) ) ;
14581460 }
0 commit comments