Buggy code:
public class PolyhedronsSet extends AbstractRegion < Euclidean3D , Euclidean2D > { public PolyhedronsSet ( ) { } public PolyhedronsSet ( final BSPTree < Euclidean3D > tree ) { } public PolyhedronsSet ( final Collection < SubHyperplane < Euclidean3D > > boundary ) { } @ SuppressWarnings ( "unchecked" ) public PolyhedronsSet ( final double xMin , final double xMax , final double yMin , final double yMax , final double zMin , final double zMax ) { } public PolyhedronsSet buildNew ( final BSPTree < Euclidean3D > tree ) { } protected void computeGeometricalProperties ( ) { } private class FacetsContributionVisitor implements BSPTreeVisitor < Euclidean3D > { public FacetsContributionVisitor ( ) { } public Order visitOrder ( final BSPTree < Euclidean3D > node ) { } public void visitInternalNode ( final BSPTree < Euclidean3D > node ) { } public void visitLeafNode ( final BSPTree < Euclidean3D > node ) { } private void addContribution ( final SubHyperplane < Euclidean3D > facet , final boolean reversed ) { final Region < Euclidean2D > polygon = ( ( SubPlane ) ( facet ) ) . getRemainingRegion ( ) ; final double area = polygon . getSize ( ) ; if ( Double . isInfinite ( area ) ) { setSize ( Double . POSITIVE_INFINITY ) ; setBarycenter ( NaN ) ; } else { final Plane plane = ( ( Plane ) ( facet . getHyperplane ( ) ) ) ; final Vector3D facetB = plane . toSpace ( polygon . getBarycenter ( ) ) ; <START_BUG> double scaled = area * ( Vector3D . dotProduct ( facetB , plane . getNormal ( ) ) ) ; <END_BUG> if ( reversed ) { scaled = - scaled ; } setSize ( ( ( getSize ( ) ) + scaled ) ) ; setBarycenter ( new Vector3D ( 1.0 , ( ( Vector3D ) ( getBarycenter ( ) ) ) , scaled , facetB ) ) ; } } } public SubHyperplane < Euclidean3D > firstIntersection ( final Vector3D point , final Line line ) { } private SubHyperplane < Euclidean3D > recurseFirstIntersection ( final BSPTree < Euclidean3D > node , final Vector3D point , final Line line ) { } private SubHyperplane < Euclidean3D > boundaryFacet ( final Vector3D point , final BSPTree < Euclidean3D > node ) { } public PolyhedronsSet rotate ( final Vector3D center , final Rotation rotation ) { } private static class RotationTransform implements Transform < Euclidean3D , Euclidean2D > { private Vector3D center ; private Rotation rotation ; private Plane cachedOriginal ; private Transform < Euclidean2D , Euclidean1D > cachedTransform ; public RotationTransform ( final Vector3D center , final Rotation rotation ) { } public Vector3D apply ( final Vector < Euclidean3D > point ) { } public Plane apply ( final Hyperplane < Euclidean3D > hyperplane ) { } public SubHyperplane < Euclidean2D > apply ( final SubHyperplane < Euclidean2D > sub , final Hyperplane < Euclidean3D > original , final Hyperplane < Euclidean3D > transformed ) { } } public PolyhedronsSet translate ( final Vector3D translation ) { } private static class TranslationTransform implements Transform < Euclidean3D , Euclidean2D > { private Vector3D translation ; private Plane cachedOriginal ; private Transform < Euclidean2D , Euclidean1D > cachedTransform ; public TranslationTransform ( final Vector3D translation ) { } public Vector3D apply ( final Vector < Euclidean3D > point ) { } public Plane apply ( final Hyperplane < Euclidean3D > hyperplane ) { } public SubHyperplane < Euclidean2D > apply ( final SubHyperplane < Euclidean2D > sub , final Hyperplane < Euclidean3D > original , final Hyperplane < Euclidean3D > transformed ) { } } }

Fix:
double scaled = area * ( facetB . dotProduct ( plane . getNormal ( ) ) ) ;