Staying inside a rectangle

How can simulate sensor input to change the behavior of our robot ? Use the position of the ground sensors and check if it falls within the boundaries of a rectangular area. For this we define two boolean values [math](out_0, out_1)[/math]to see if the sensor position [math](C_0, C_1)[/math] is inside the rectangle defined by the points [math](F_0, F_1)[/math] [math]out_0=(x(C_0) < x(F_0)) ∨ (x(C_0) > x(F_1)) ∨ (y(C_0) < y(F_0)) ∨ (y(C_0) > y(F_1))[/math] [math]out_1=(x(C_1) < x(F_0)) ∨ (x(C_1) > x(F_1)) ∨ (y(C_1) < y(F_0)) ∨ (y(C_1) > y(F_1))[/math] We use this information inside the animation script of the slider time [b]t[/b] to determine if the robot needs to turn. A=A+v*v_f*dt If[out_0, SetValue[θ, θ-dθ],If[out_1, SetValue[θ, θ+dθ]]] To give a visual feedback when the sensor is outside the rectangle, we momentarily increase the size from 3 to 15. SetPointSize[C_0, If[out_0, 15, 3]] SetPointSize[C_1, If[out_1, 15, 3]]