GraphiteEditor / GraphiteEditor/Graphite

Stroke alignment on «Solidify Stroke»

Abierto
#4,494 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Rust
Estrellas
27.2k
Forks
1.3k
Merge medio
20 h 5 min
PR fusionados (30 d)
57

Descripción

The «Solidify Stroke» assumes that all strokes are `StrokeAlign::Center` [sic] causing it to give the incorrect results for `StrokeAlign::Inside` and `StrokeAlign::Outside`.

The alignment can be set in the properties of the stroke node:
the properties panel showing the inside stroke alignment option

A proper implementation of the algorithm must deal with intersecting bézier paths in the same way as the SVG and vello renderer. An interesting case can be seen here where we have a closed path made of just two intersecting cubic béziers:
A figure of 8 path made by crossing two cubic bézier

If the path is not fully closed, then the centre alignment must be used to match the renderer. Also note that a path can contain multiple contours. These can likely be dealt with individually?

To deal with intersections of paths in an efficient the [`linesweeper` crate](https://docs.rs/linesweeper) can be used since it is already included as a dependency.

The `kurbo::stroke` function only supports centre alignment. I'm not sure if it is within scope to add other alignments to it.

As reported by [@Menxs on discord](https://discord.com/channels/731730685944922173/1134981447539761273/1544038003955990538).

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Comienza localizando la implementación de Solidify Stroke y su gestión de StrokeAlign. Compara su comportamiento para rutas abiertas, cerradas, que se intersectan y con múltiples contornos con el renderizador SVG y vello, y revisa la dependencia disponible linesweeper junto con kurbo::stroke. Se considera terminado cuando las alineaciones Inside, Outside y Center producen resultados coincidentes y las rutas abiertas conservan la alineación Center.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
rust
Área
computer-graphics
Tipo de issue
Error
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Activo
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.