Promote Polygon out of experimental and use it for the polygons of paths
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 25/100
Direzione di ricerca
Start with the Polygon class in src/experimental/geometry/shapes/polygon.dart, especially its constructor and _initializeEdges(), and read how Path.toPolygons(), PathComponent.polygons and convexPieces() use vertex lists today. Done means edges are computed lazily or on demand, the caller's list is never mutated, Polygon is exported from package:flame/geometry.dart, and the polygon-returning APIs return Polygon before 2.0. Because this changes public API, agree the design with maintainers before writing code.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
There are two ways of representing a polygon in Flame today:
- The
Polygonshape insrc/experimental/geometry/shapes/polygon.dart, which is only exported frompackage:flame/experimental.dart. - Plain vertex lists (
List<Vector2>), which most of the stable API uses:PolygonComponent,PathComponent.polygons,Path.toPolygons()andconvexPieces()(the last two are added in #4097).
Since Polygon is experimental and has some performance issues, the stable APIs can't return it. That's why Path.toPolygons() returns List<List<Vector2>>, which is confusing given its name (see the discussion in #4097).
Issues with the current Polygon
- The constructor eagerly creates an edge vector for every vertex in
_initializeEdges(). In #4097, returningPolygonfromtoPolygons()cost about 2% more time but roughly twice the memory. - When
convexisn't given, the constructor may reverse the vertex list that is passed in, in place, which is surprising for the caller. - It lives in
experimental, so the core extensions and components can't depend on it.
Proposal
- Make
Polygoncheap to construct: computeedgeslazily (or drop the cached list and compute edges on demand), and avoid mutating the caller's list. - Promote
Polygonout ofexperimentalintopackage:flame/geometry.dart. - Before 2.0 stable, change the APIs that return polygons as vertex lists to return
Polygoninstead, while they're still only in dev releases:Path.toPolygons()PathComponent.polygons(released inflame-v2.0.0-dev.0)convexPieces(), which could returnList<Polygon>(withconvex: true)
Consumers that need plain lists, like the forge2d Polygon shape, would read .vertices.
- Lingua principale
- Dart
- Stelle
- 10.8k
- Fork
- 1.1k
- Merge medio
- 1g 17h
- PR unite (30g)
- 51
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di flame-engine/flame
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
flame-engine/flame#4063 ·
I maintainer di solito rispondono entro 1 giorno
-
TextComponent shadows are not affected by OpacityEffectForse già presa @spydon l’ha presa 38 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 72/100
flame-engine/flame#4013 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
flame-engine/flame#4012 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
flame-engine/flame#3974 · 6 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Add a RenderLayer system for global render orderingForse di nuovo libera @spydon l’ha presa 86 giorni fa e non c’è nessuna pull request aperta. Apertaenhancement
flame-engine/flame#3967 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di flame-engine/flame
Issue simili
-
c: proposal p: go_router package team-ecosystem
Difficoltà 2/5 1-3 ore Idoneità per principianti 60/100
flutter/flutter#194542 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
famedly/matrix-dart-sdk#2524 ·
I maintainer di solito rispondono entro 1 giorno
-
Document supported hardwareApertaDocumentation
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Kazakh (kk_KZ) and Georgian (ka_GE) system locales get English instead of the shipped translationsApertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
area: docs eco: dart good first issue help wanted lane: free-agent roadmap size: XS type: docs
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
arminazimi/evergreen#430 ·
I maintainer di solito rispondono entro 1 giorno