GraphiteEditor / GraphiteEditor/Graphite
Rendering the fills of vector meshes and intersecting paths
- 主要言語
- Rust
- スター
- 27.3k
- フォーク
- 1.3k
- 平均マージ
- 20時間 5分
- マージ済み PR(30日)
- 57
説明
*Potential feature name — **Reticulate** (defined as "resembling a net or network" or "to divide, mark, or construct so as to form a network") or **Reticulation** (defined as "A network of criss-crossing lines, strands, cables or pipes").*
High-level goal:
Topological styling: we need to apply fill and stroke styles to the *topology* of the geometry in the scene (composed of subpaths), even when the geometry can move around *spatially* from frame to frame. On any frame, when rendering, we need to apply the topological styling to the current spatial arrangement of the geometry in a stable manner. We need to uniquely, stably address the **sub-segments** and **sub-regions** based on where intersections occur given the current spatial arrangement, to apply a stroke and fill style to each as given by the artist's intent.
---
Vector meshes generalize paths to support arbitrary topology. Loops of segments need a way of being rendered with a fill. This needs to support certain requirements, such as reasonable robustness during editing and animation.
The plan according to the current design is to define a filled region as the area bounded within a list of segments, taking into account each segment's winding order (flow direction or half-edge of a segment) to bound the curved area, akin to CSG. If a flow direction is backwards, it represents a back-face which isn't considered filled.
For example, the dots in the inside of this edge flow would indicate that the left lobe of the infinity shape should be filled as the front-face, while the right lobe's outer-facing dots would be considered a back-face and not filled.

Uniquely identifying cubic Beziers isn't possible because there can be up to 9 intersections with 8 enclosed regions between a pair of them, compared to quadratic Beziers with 4 intersections and 3 enclosed regions. To address the boundaries of quadratics, cubics need to be considered as quadratics. This can likely be done (without actually subdividing the geometry) by addressing the starting or ending halves of a half-edge, splitting a segment up into four pieces. The midpoint of a half-edge is where the number of intersections is equal to half the total. The starting half reaches from the start to that middle intersection and the ending reaches from the end to the middle intersection, overlapping by a shared segment in cases with even numbers of intersections. A full explainer is at https://discord.com/channels/731730685944922173/731738914812854303/1341703079770193951 (and for @Keavon and @otdavies, [this private Discord chat](https://discord.com/channels/@me/98632974106378240/1341623418055036949)).
This drawing shows some unique addressing cases of each individual region. Red circles indicate midpoint intersections (from one or both of either curve).

CSG boundary edges don't have to address just one region; they can also address a larger region while ignoring any intersections that aren't listed as boundaries. If, for example, the self-intersecting 4-region shape at the center right in the drawing above just had its full list of path segments used as its boundary, it might work similar to a regular SVG path (including a choice of fill rule)? (Or would that only count as enclosing the dark blue center region since only points in there would be enclosed by all segments? Hopefully not, so it can act like regular SVG complete with a choice of fill rule.)
Other approaches:
- [https://alexharri.com/blog/vector-networks](https://web.archive.org/web/20250604063209/https://alexharri.com/blog/vector-networks) (contains some useful ideas, but this works based on assigning a filled-not-not-filled flag to specific areas which must be statically chosen and can't support dynamic filling when the topology changes)
- https://web.archive.org/web/20061115004311/http://blogs.msdn.com/mswanson/archive/2006/02/27/539749.aspx
- https://web.archive.org/web/20061116051921/http://www.the-labs.com/MacromediaFlash/SWF-Spec/SWFfilereference.html#h3ShapeArchitecture (similarly, requires destructive changes to the topology to represent its vector mesh structure as connected paths, but it uses an interesting idea of left/right fill styles belonging to each segment)
- https://www.borisdalstein.com/research/phd/ (hat tip: @4adex; focuses more on the topology representation, which we might borrow from, but doesn't solve dynamic fills for intersection regions)
- https://www.borisdalstein.com/research/vgc/ (summarized in https://www.borisdalstein.com/research/vgc/vgc-poster.pdf )
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
調査の方向性
実装ファイル、テスト、エントリポイントは特定されていません。まずトポロジースタイリングの要件と、リンクされたベクターネットワークおよびCSGのリファレンスを読み、そのうえで、ベクターメッシュ、winding order、交差、動的トポロジーが既存のレンダラーにどう適合するかを判断します。完了条件は、空間移動、編集、アニメーション中に、領域ごとの塗りとストロークを安定してアドレス指定できることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- rust
- 領域
- computer-graphics
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 20/100