currently I am writing a program that will perform an equation for every 4 values that are obtained. I currently have it working when the first 4 values are given, but I am trying to expand it to let you perform the equation as long as you want. However, I am having trouble coming up with a conditional statement to do this.. I remember doing this in the past by checking if the number of values divided by 4 equals a whole number, but I don't remember how.
if (event == EVENT_LBUTTONDOWN && (data->leftMouseClicked < 4)) {
circle(data->img, Point(x, y), 1, Scalar(0, 0, 255), 3); // draw entered point
data->enteredPoints[data->leftMouseClicked][0] = x;
data->enteredPoints[data->leftMouseClicked][1] = y;
++(data->leftMouseClicked);
This is a snippet of some of my code that collects the values by the user clicking a spot on an image. I am planning on using data->leftMouseClicked
as the value to check, similarly to what is used in the current if statement I have, which is below.
if (data->leftMouseClicked == 4) { // draw curve if all 4 points were entered
Any help changing this would be much appreciated.
Aucun commentaire:
Enregistrer un commentaire