microsoft / microsoft/maker.js
Support for elliptical arcs
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 302
- Avg merge
- 21h 28m
- Merged PRs (30d)
- 5
Description
Hi there! Thanks for making a useful library!
I've been working on parsing SVG files (not just path data, but the whole file -- warts and all), and I noticed maker.js does not have "true" support for elliptical arcs.
The models.EllipticArc constructor is definitely handy and works in a pinch, but the internal representation looks to be many circular arcs approximating a set of bézier curves which approximate the arc. I can't help but imagine we're losing some precision along the way!
I've had a lot of coffee today, so I have a couple questions while I'm at it:
Is there a historical reason why this choice to use circular arcs was made? Elliptical arcs can accurately represent circular arcs, so I'd imagine it would be more useful to use elliptical arcs internally and not the other way around.
I'm also curious about the choice to approximate béziers using arcs in the data model. I recognize that that has performance implications for tasks like measuring path length and extents, so I imagine a reason would be to optimize for that use case. Do mutating operations like scale or rotate operate on the original curve on or on the approximation? If the latter, it seems we'd lose some precision along the way?
Perhaps I'm fretting about precision when in reality the differences wouldn't matter for practical purposes. I'm totally open to that rationale if that's the case. I'm still learning what's normal in CAD.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the models.EllipticArc constructor and the library's SVG path handling, especially how elliptical arcs are represented internally. Compare the current circular-arc and Bézier approximations with the requested true elliptical-arc support. Done should include an agreed representation and documented behavior for parsing and transforming elliptical arcs without the reported precision loss.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100