Skip to content

Near-circular arcs generate empty paths when rounding is used #38

@jasondavies

Description

@jasondavies

I encountered this edge case when using d3-shape:

d3.arc().innerRadius(55).outerRadius(75).startAngle(0).endAngle(6.283179980513967)()
"M0,-75A75,75,0,1,1,0,-75L0,-55A55,55,0,1,0,0,-55Z"

Now, d3.arc uses digits(3) by default, which means it's using d3-path with rounding.

Since there's no ambiguity when using d3-path's arc for a complete or near-circle (unlike arcTo which is undefined for coincident start/end points), and complete circular arcs are supported, I think this is a bug in d3-path, rather than d3-shape.

I traced it back to the rounding used in d3-path: nothing special is done to check for coincident points after rounding when drawing arcs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions