public void ReceptorSimpleTest() { Receptor receptor = new Receptor(0.5f, 0.5f, 0.99f, 0.99f); bool state = receptor.GetReceptorState(26,26,50,50); Assert.IsTrue(state, "The receptor doesn't detected the point"); }
/// <summary> /// Creates a <see cref="TristateCheckVector"/> instance for a given /// <c>FloatBitmap</c> object. /// </summary> /// <param name="image"> /// A <see cref="FloatBitmap"/> for which the vector is created. /// </param> /// <returns> /// The <see cref="TristateCheckVector"/> for the image. /// </returns> private TristateCheckVector CreateVector(FloatBitmap image) { // We create the receptors list. if (receptors == null) { receptors = Receptor.GenerateList(40); } TristateCheckVector vector = new TristateCheckVector(); TristateValue checkValue; foreach (Receptor receptor in receptors) { checkValue = receptor.CheckBressard(image)? TristateValue.True:TristateValue.False; vector.Values.Add(checkValue); StepDoneArgs args = new StepDoneArgs(String.Format("Comprobando receptor {0}: {1}", String.Format("({0}, {1}) -> ({2}, {3})", receptor.X0, receptor.Y0, receptor.X1, receptor.Y1), checkValue)); StepDoneInvoker(args); Thread.Sleep(20); } foreach (BinaryCharacteristic characteristic in characteristics) { checkValue = characteristic.Apply(image)? TristateValue.True : TristateValue.False; vector.Values.Add(checkValue); StepDoneArgs args = new StepDoneArgs(String.Format("Comprobando característica {0}: {1}", characteristic.GetType().ToString(), checkValue)); StepDoneInvoker(args); Thread.Sleep(20); } return(vector); }