fornjot icon indicating copy to clipboard operation
fornjot copied to clipboard

Validate sketches

Open hannobraun opened this issue 2 years ago • 2 comments

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.

hannobraun avatar Jan 21 '22 13:01 hannobraun

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.

hannobraun avatar Mar 21 '22 15:03 hannobraun

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.

hannobraun avatar Apr 14 '22 14:04 hannobraun

Closing in favor of #1129.

hannobraun avatar Sep 22 '22 08:09 hannobraun