sorry for the confusing title, its really hard for me to explain what i want. So i created this image 🙂
Ok so the two RED dots are points on an image. The distance between them isnt important.
What I want to do is, Using the coordinates for the two dots, work out the angle of the space between them (as shown by the black line between the red dots)
Then once the angle is found, on the last red dot, create two points which cross the angle of the first line. Then from that, scan a Half semicircle and get the coordinates of every pixel of the image that the orange line passes.
I dnot know if this makes any sense to you lot so i drew another picture:
As you can see in the second picture, my idea is applied to a line drawn on a black canavs. The two red dots are the starting coordinates then at the end of the two dots, a less then half semicircle is created. The part that is orange shows the pixels of the image that should be recorded.
I have no clue how to start this, so if anyone has any ideas on how i can or on what i need to do, any help is much appreciated 🙂
EDIT.
I have created this image in the hopes that it will make what i am trying to do clearer 🙂
Again sorry if this is confusing anyone as I really dont know how to explain it.
Just to clarify:
Let’s define the coordinates of point A as (Ax, Ay).
Let’s define the distance between A & B as r (the radius of our circle/arc)
So using basic formula for a circle, a point (x, y) will be on the circle when
Now you just need to limit this set to those points that are within your required quarter circle. I would suggest the easiest way to do this is to include points within a certain distance of the midpoint of the arc.
To do this, first work out the midpoint of the arc. Let point B be defined by (Bx, By), and then define point C as the midpoint of the arc (Cx, Cy)
Now, for any point on the arc, draw a chord (a line between two points on a circle) from that point (x, y) to the midpoint of the arc.
The length of this line can be calculated by the radius of the circle and the angle between the two radii. The formula for length of a chord is 2r.sin(a/2), where r is the radius and a is the angle between the radii. We want 45 degrees either side of the midpoint, so the maximum chord length is
So points within 2r.sin(45/2) of our point (Cx, Cy) will be close enough to draw a quarter circle. Your result is
Good fun!