public InverseDefaultVoronoiFacet(IVoronoiFacet constraint) { if (constraint == null || !(constraint is DefaultVoronoiFacet)) { throw new ArgumentException("invalid constraint."); } decorated = constraint as DefaultVoronoiFacet; }
public void ConstraintAndSinglePoints() { IVoronoiFacet c = new DefaultVoronoiFacet(new stubNuclei(0, 0, -1), new stubNuclei(0, 0, 1)); //plane z=0 Assert.IsFalse(c.semiHyperSpaceMatch(new double[] { 0.4, 0.4, 0.4 })); Assert.IsTrue(c.semiHyperSpaceMatch(new double[] { -0.5, -0.5, -0.5 })); Assert.IsFalse(c.semiHyperSpaceMatch(new double[] { 1, 1, 2 })); c = new InverseDefaultVoronoiFacet(c); Assert.IsTrue(c.semiHyperSpaceMatch(new double[] { 0.4, 0.4, 0.4 })); Assert.IsFalse(c.semiHyperSpaceMatch(new double[] { -0.5, -0.5, -0.5 })); Assert.IsTrue(c.semiHyperSpaceMatch(new double[] { 1, 1, 2 })); c = new DefaultVoronoiFacet(new stubNuclei(10, 0, 10), new stubNuclei(20, 0, 15)); Assert.IsTrue(c.semiHyperSpaceMatch(new double[] { 1, 1, 1 })); Assert.IsFalse(c.semiHyperSpaceMatch(new double[] { 50, 40, 20 })); }
public InverseDefaultVoronoiFacet(IVoronoiFacet constraint) { if (constraint == null || !(constraint is DefaultVoronoiFacet)) throw new ArgumentException ("invalid constraint."); decorated = constraint as DefaultVoronoiFacet; }