public void T03_EvaluatingRuleForACSGIntersectOperation() { List <bool> lHit = new List <bool>(); List <bool> inl = new List <bool>(); List <bool> inr = new List <bool>(); List <bool> result = new List <bool>(); lHit.Add(true); lHit.Add(true); lHit.Add(true); lHit.Add(true); lHit.Add(false); lHit.Add(false); lHit.Add(false); lHit.Add(false); inl.Add(true); inl.Add(true); inl.Add(false); inl.Add(false); inl.Add(true); inl.Add(true); inl.Add(false); inl.Add(false); inr.Add(true); inr.Add(false); inr.Add(true); inr.Add(false); inr.Add(true); inr.Add(false); inr.Add(true); inr.Add(false); result.Add(true); result.Add(false); result.Add(true); result.Add(false); result.Add(true); result.Add(true); result.Add(false); result.Add(false); Assert.AreEqual(result[0], CSG.IntersectionAllowed(CSG.Operation.Intersection, lHit[0], inl[0], inr[0])); Assert.AreEqual(result[1], CSG.IntersectionAllowed(CSG.Operation.Intersection, lHit[1], inl[1], inr[1])); Assert.AreEqual(result[2], CSG.IntersectionAllowed(CSG.Operation.Intersection, lHit[2], inl[2], inr[2])); Assert.AreEqual(result[3], CSG.IntersectionAllowed(CSG.Operation.Intersection, lHit[3], inl[3], inr[3])); Assert.AreEqual(result[4], CSG.IntersectionAllowed(CSG.Operation.Intersection, lHit[4], inl[4], inr[4])); Assert.AreEqual(result[5], CSG.IntersectionAllowed(CSG.Operation.Intersection, lHit[5], inl[5], inr[5])); Assert.AreEqual(result[6], CSG.IntersectionAllowed(CSG.Operation.Intersection, lHit[6], inl[6], inr[6])); Assert.AreEqual(result[7], CSG.IntersectionAllowed(CSG.Operation.Intersection, lHit[7], inl[7], inr[7])); }
public void DifferenceOperation() { bool[,] bools = new bool[8, 4] { //lhit inl inr result { true, true, true, false }, { true, true, false, true }, { true, false, true, false }, { true, false, false, true }, { false, true, true, true }, { false, true, false, true }, { false, false, true, false }, { false, false, false, false } }; for (int i = 0; i < 8; i++) { bool result = CSG.IntersectionAllowed("difference", bools[i, 0], bools[i, 1], bools[i, 2]); Assert.AreEqual(result, bools[i, 3]); } }
public void TestCsgRules() { var op = new CsgOperation[] { CsgOperation.Union, CsgOperation.Union, CsgOperation.Union, CsgOperation.Union, CsgOperation.Union, CsgOperation.Union, CsgOperation.Union, CsgOperation.Union, CsgOperation.Intersection, CsgOperation.Intersection, CsgOperation.Intersection, CsgOperation.Intersection, CsgOperation.Intersection, CsgOperation.Intersection, CsgOperation.Intersection, CsgOperation.Intersection, CsgOperation.Difference, CsgOperation.Difference, CsgOperation.Difference, CsgOperation.Difference, CsgOperation.Difference, CsgOperation.Difference, CsgOperation.Difference, CsgOperation.Difference }; var lhit = new bool[] { true, true, true, true, false, false, false, false, true, true, true, true, false, false, false, false, true, true, true, true, false, false, false, false }; var inl = new bool[] { true, true, false, false, true, true, false, false, true, true, false, false, true, true, false, false, true, true, false, false, true, true, false, false }; var inr = new bool[] { true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false, true, false }; var result = new bool[] { false, true, false, true, false, false, true, true, true, false, true, false, true, true, false, false, false, true, false, true, true, true, false, false }; for (int i = 0; i < op.Length; i++) { Assert.AreEqual(result[i], CSG.IntersectionAllowed(op[i], lhit[i], inl[i], inr[i])); } }