def test_arc_segment_count(): radius = 100 max_sagitta = 2 assert arc_segment_count(radius, math.tau, max_sagitta) == 16 alpha = math.tau / 16 l2 = math.sin(alpha / 2) * radius sagitta = radius - math.sqrt(radius**2 - l2**2) assert max_sagitta / 2 < sagitta < max_sagitta
def flattening(self, sagitta: float) -> Iterable[Vec3]: """Approximate the circle by vertices in WCS, argument `sagitta` is the max. distance from the center of an arc segment to the center of its chord. Returns a closed polygon: start vertex == end vertex! Yields always :class:`~ezdxf.math.Vec3` objects. .. versionadded:: 0.15 """ radius = abs(self.dxf.radius) if radius > 0.0: count = arc_segment_count(radius, math.tau, sagitta) yield from self.vertices(linspace(0.0, 360.0, count + 1))