Finding the optimal Bézier path to fit some source curve is, surprisingly, not yet a completely solved problem. Previous posts have given good solutions for specific instances: Fitting cubic Bézier curves primarily addressed Euler spirals (which are very smooth), while Parallel curves of cubic Béziers rendered parallel curves. In this post, I describe refinements of the ideas to solve the much more general problem of simplifying arbitrary paths. Along with the theoretical ideas, a reasonably solid implementation is landing in kurbo, a Rust library for 2D shapes.
The techniques in this post, and code in kurbo, come close to producing the globally optimum Bézier path to approximate the source curve, with fairly decent performance (as well as a faster option that’s not always minimal in the number of segments), though as we’ll see, there is considerable subtlety to what “optimum” means. Potential applications are many:
Simplification of Bézier paths for more efficient publishing or editing
继续阅读全文
为了尊重作者,这里只展示开头几段。你可以去原文阅读,或者在 HorizonReader 里读:划线做笔记、让 AI 帮忙。
AI 摘要The article argues that GPUs, despite being 10-100x more powerful than CPUs, are prevented from becoming general-purpose parallel computers by an impoverished execution model and inadequate languages and tools, illustrated by the author's struggles with bounded memory in the Vello 2D renderer. Reviewing historical designs like the Connection Machine, Cell, and Larrabee, the author shows that promising parallel architectures existed but failed to catch on, leaving today's overly complex GPUs and limited AI accelerators. With workloads increasingly shifting toward compute, the author believes a simpler, more powerful parallel computer is possible and points to paths forward such as chips with large grids of CPU cores.
AI 摘要The author critiques Apple's new Metal shader converter, which eases porting DirectX 12 games by translating DXIL/HLSL shaders to Metal, arguing it adds underspecified complexity rather than advancing robust GPU infrastructure. A key complaint is that Metal remains the only major GPU API lacking device-scope atomic barriers (present in HLSL since Direct3D 11 in 2009), which prevents single-pass prefix sum implementations and reliable cross-threadgroup coordination, and in turn holds back WebGPU's performance. The author recommends Apple document which HLSL features are unsupported, and points to WebGPU and Asahi Linux's work as more promising paths toward well-specified, portable GPU compute.
AI 摘要This is a satirical April Fools' post in which the author, a longtime Rust developer, mock-announces that the Linebender GUI projects will migrate from Rust to C++. In a deliberately persuasive style, the piece humorously dismisses memory safety concerns, praises C++'s abundance of build systems and rapid language evolution, and claims the C++ community is friendlier. The post is intended to satirize bad arguments commonly made against Rust, with the author noting afterward that its serious points and tone confused some readers.
AI 摘要The article explains why the Vello 2D GPU renderer (formerly piet-gpu) abandoned piet-gpu-hal, its hand-rolled GPU abstraction layer, in favor of wgpu and the WebGPU/WGSL ecosystem. Although the custom layer achieved goals like precompiled shaders (saving binary size and startup time) and access to advanced GPU features such as subgroups and descriptor indexing, wgpu offers a better developer experience, community tooling, and web deployment. The author reflects on lessons learned, notes WebGPU pain points, and says the roadmap may eventually revisit precompiled shaders and native back-ends to regain those lost capabilities.
AI 摘要The author reflects on 2022 and sets goals for 2023, centered on his ambitious portfolio of Rust UI infrastructure projects. His biggest priority is shipping Vello, a GPU-accelerated 2D renderer (formerly piet-gpu), while Xilem, a reactive UI architecture he believes is the best for Rust, will depend largely on community contributions. He also plans to continue curve and GPU compute research, but explicitly rules out writing a shader language or academic papers, preferring his blog and open source work as his main channels for sharing results.