Class RegionBSPTree3D.RegionSizePropertiesVisitor

  • All Implemented Interfaces:
    BSPTreeVisitor<Vector3D,​RegionBSPTree3D.RegionNode3D>
    Enclosing class:
    RegionBSPTree3D

    private static final class RegionBSPTree3D.RegionSizePropertiesVisitor
    extends java.lang.Object
    implements BSPTreeVisitor<Vector3D,​RegionBSPTree3D.RegionNode3D>
    Visitor for computing geometric properties for 3D BSP tree instances. The volume of the region is computed using the equation V = (1/3)*ΣF[(CF⋅NF)*area(F)], where F represents each face in the region, CF represents the centroid of the face, and NF represents the normal of the face. (More details can be found in the article here.) This essentially splits up the region into pyramids with a 2D face forming the base of each pyramid. The centroid is computed in a similar way. The centroid of each pyramid is calculated using the fact that it is located 3/4 of the way along the line from the apex to the base. The region centroid then becomes the volume-weighted average of these pyramid centers.
    See Also:
    Polyhedron#Volume
    • Field Detail

      • volumeSum

        private double volumeSum
        Accumulator for boundary volume contributions.
      • sumX

        private double sumX
        Centroid contribution x coordinate accumulator.
      • sumY

        private double sumY
        Centroid contribution y coordinate accumulator.
      • sumZ

        private double sumZ
        Centroid contribution z coordinate accumulator.
    • Constructor Detail

      • RegionSizePropertiesVisitor

        private RegionSizePropertiesVisitor()
    • Method Detail

      • addBoundaryContribution

        private void addBoundaryContribution​(HyperplaneSubset<Vector3D> boundary,
                                             boolean reverse)
        Add the contribution of the given node cut boundary. If reverse is true, the volume of the contribution is reversed before being added to the total.
        Parameters:
        boundary - node cut boundary
        reverse - if true, the boundary contribution is reversed before being added to the total.