We are about to switch to a new forum software. Until then we have removed the registration on this forum.
hi guys, first of all i wnat to appologize for mi orthography (my mother idiom is spanish, not english).
well i'm new in processing (and programing) and i working on a proyect that involves the mouseClicked() event. i am working with 4 separate images, and if you clicked in the area of one of them, it will changed into anoter image. the thing is that my images aren't perfet squares nor ellipces. so creating the comant
mouseClicked(){
if (moseX >= min X coordinate && mouseX <= max X coordinate && mouseY >= min Y coordinate && mouseY <= max Ycoordinate)
}
or using dist() can resolve my problem.
I want to know if i can create that "sensitive zone using a image, or a shape, or a vector, like transforming the position of the vertex or nodes in an area that the click responds to. Thansk for the time
Answers
"if (mouseX>=min(0,img.width) &&....) "
apply value of mouseX,mouseY...
@Sinchai, the issue is that the images aren't rectangles so simple methods like that won't work.
As for a possible solution, maybe you can implement the ray tracing algorithm described here? https://en.wikipedia.org/wiki/Point_in_polygon That is, if you manage to get a PShape of the contours of the image...
Here's a skeleton for a possible implementation of the algorithm:
thanks @colouredmirrirball for your answer, but, i have a doubt, i am trying to match the mouseY and the count, but i really dont know how to do it. Anyways, if i have a progress i will let know :)