public void Evaluating_the_rule_for_a_CSG_operation(
            CsgOperation op, CsgOperand hitShape, bool insideLeft, bool insideRight, bool expectedResult)
        {
            var result = Csg.IntersectionAllowed(op, hitShape, insideLeft, insideRight);

            result.Should().Be(expectedResult);
        }
Beispiel #2
0
 internal static bool IntersectionAllowed(CsgOperation op, CsgOperand hitShape, bool insideLeft, bool insideRight)
 {
     return(op switch
     {
         CsgOperation.Union =>
         (hitShape == CsgOperand.Left && !insideRight) ||
         (hitShape == CsgOperand.Right && !insideLeft),
         CsgOperation.Intersection =>
         (hitShape == CsgOperand.Left && insideRight) ||
         (hitShape == CsgOperand.Right && insideLeft),
         CsgOperation.Difference =>
         (hitShape == CsgOperand.Left && !insideRight) ||
         (hitShape == CsgOperand.Right && insideLeft),
         _ => false
     });