fornjot
fornjot copied to clipboard
Validate sketches
Right now, users can just feed any points they want to sketches, valid or not. This might then result in crashes or other weird issues.
Sketches should be validated before use. To keep the fj
library light, this should probably be done in the host application. For now, it's fine if that results in a panic with an informative error message. At a later stage, it would be nice to display that error to the user in a friendlier way.
Specifically, validation should include the following checks:
- [x] ~~Sketches must not have duplicate points.~~
- [ ] Sketches must not be self-overlapping.
- [ ] Sketches must have counter-clockwise winding.
Due to all the validation being done by the Shape
API, it is now no longer possible to create sketches with duplicate vertices. I've updated the issue description to reflect this.
Making sure that sketches are not self-overlapping should also be done as part of the Shape
API, by validating that edges in general don't intersect.
I realized that sketches must have counter-clockwise winding. Otherwise, the surface normals of outer surfaces are not going to be correct after sweeping. Updated the list in the issue description accordingly.
Closing in favor of #1129.