Hello.
I can’t understand how i can find arc() edge. Currently i control White line with mouse.
And goal is to change that line to Red, if mouse is outside Yellow zone.
I draw multiple arcs (on top of each) and real size is marked with red stroke.
Code:
arc( xloc, yloc, size - i * steps, size - i * steps, 60, 90 );
Yes, arc is marked with Red and Yellow stroke.
Yellow, is arc fill (And i call this Zone)
Added on the left arc size (because currently it’s static shape and i know coordinates)
Below image shows more arc’s:
Each arc increase size by 200, and final size is: 6400
Thanks Chrisir, but im new to this…
And mathematic not so good…
Used createVector (with p5.js) and its really useful to check positions
So decided to draw on top lines. Maybe i will find the way to calculate first and last Line edge…
Ok paulgoux , i will wait for any information. Thanks
Here you are, look for the this.eyes function. The function essentially creates three variables x_1 x and x1 and same for y which represent the center of the arc then the center minus an angle and the center plus an angle. I use arctan2 to find the angle then map the angle from 0- 360 arctan only calculate angles from -180 to 180 so you need to remap it. Then I calculate the distance from the point to the edge of the arc using the dist function. With that your almost ready to go. Now you calculate the angle of the target you want to interact with and create an if statement that checks thats its both within the distance range and within ± the angle.