Elements icon indicating copy to clipboard operation
Elements copied to clipboard

Intersect a model with a plane.

Open ikeough opened this issue 3 years ago • 0 comments

BACKGROUND: For the purpose of creating 2D sections through a model, we need a method that allows the caller to provide a Plane and a Model and creates the 2D section through the model at that plane.

DESCRIPTION:

  • Adds the Model.Intersect(...) method which returns a collection of polygons representing the section through the model.
  • Add the BBox3.Intersects(...) method which returns whether a bounding box is above, below, or intersecting a plane.
  • Adds the Elements.Serialization.SVG project with wrapper methods to generate plan sections.

TESTING:

  • See the SolidTests.ModelIntersects method and the BBox3Tests for new tests. Two additional tests are added as part of #822

NOTE This makes a big change to the way that CSGs are calculated. Previously we calculated them during export of the glTF. But, with this PR, we update and cache the CSG whenever UpdateRepresentation is called. This guarantees that the CSG geometry of the object is available for things like section-cutting, with the minor downside that calls to UpdateRepresentation get a little slower.

FUTURE WORK:

  • This is based on CSGs. I'd prefer to have it based on solid booleans, but solid booleans aren't ready to handle this problem (I tried). When solid booleans are ready we will update UpdateBoundsAndComputeSolid to create a cached solid instead of a CSG.

REQUIRED:

  • [x] All changes are up to date in CHANGELOG.md.

image


This change is Reviewable

ikeough avatar Jun 21 '22 23:06 ikeough