Find end point of an arc, given initial point of the arc, the angle to draw the sector, and radius of circle is known. Also find centre of circle

321 Views Asked by At

Hello Maths wizs, I am trying to implement a geometry problem in Octave/Matlab for a project but I am unable to figure out what mistake I am doing. I have an arc of a circle(whose centre (A) is unknown) with a given radius 'R'. I know the starting point of the arc is point B(x1,y1), in rectangular form. I want to find the end point of the arc (point C) given the angle of the sector subtended at origin(theta) is provided as well.

enter image description here

I tried it using the following steps:

Step 1: Convert the points from rectangular form into polar form to get the radius and the angle of rotation.

Step 2: Add the radius obtained(as this conversion is done keeping 0,0 as origin) with the radius 'R' of the circle provided as input

Step 3: Use theta to find the next point on the Arc using the following formula:

x1 = (x * cos(sector_angle)) + (y *(sin(sector_angle)));

y1 = (-x * sin(sector_angle)) + (y * cos(sector_angle));

Step 4: Repeat step 3 to find the third point

Step 5: With 3 points on the circumference of the circle the centre can be calculated by solving three simultaneous equations of circle: (x-h)^2 + (y-h)^2 = R^2

Now, after this I keep finding the centre at 0,0. I realized that adding the radius linearly did not solve any problem. I am trying to figure out a way to solve this issue, it will be a great help.

Additionally I also tried the school geometry way of using radius as two sides of isosceles triangles, finding the remaining angles and sides, using equation of straight lines to get the slope. I can't describe it fully here because it was more graphics method approach. But to summarize I got 2 equation with 4 variables hence unsolvable.

I read something about affine transforms to solve polar geometry problems but I couldn't figure that out.

If anyone can help me with my first algorithm, it will be highly appreciated.

Below is the code I wrote in Matlab:

A =[7 , 8];

%plot(A(1),A(2),'d')

axis([-20 20 -20 20])

hold on

Radius = 2;

alpha = atan(A(2)/A(1)); % angle betwen two points

sector_angle = pi/4;

radius = sqrt(A(1)^2 + A(2)^2)

common_radius = radius + Radius

x= common_radius * cos(alpha); % convert to polar form

y= common_radius * sin(alpha); % convert to polar form

A1 = [x,y]

plot(A1(1),A1(2),'d')

hold on

%2nd point clockwise movement x1 = (x * cos(sector_angle)) + (y *(sin(sector_angle))); y1 = (-x * sin(sector_angle)) + (y * cos(sector_angle));

B=[x1 y1]

plot(B(1),B(2),'d')

hold on

% 3rd point clock wise movement

x2 = (x1 * cos(sector_angle)) + (y1 *(sin(sector_angle)));

y2 = (-x1 * sin(sector_angle)) + (y1 * cos(sector_angle));

C=[x2 y2]

plot(C(1),C(2),'d')

hold on

% 4th point clock wise movement

x3 = (x2 * cos(sector_angle)) + (y2 *(sin(sector_angle)));

y3 = (-x2 * sin(sector_angle)) + (y2 * cos(sector_angle));

D=[x3 y3]

plot(D(1),D(2),'d')

hold on

% 5th point clock wise movement

x4 = (x3 * cos(sector_angle)) + (y3 *(sin(sector_angle)));

y4 = (-x3 * sin(sector_angle)) + (y3 * cos(sector_angle));

E=[x4 y4]

plot(E(1),E(2),'d')

hold on

% 6th point clock wise movement

x5 = (x4 * cos(sector_angle)) + (y4 *(sin(sector_angle)));

y5 = (-x4 * sin(sector_angle)) + (y4 * cos(sector_angle));

F=[x5 y5]

plot(F(1),F(2),'d')

hold on

% 7th point clock wise movement

x6 = (x5 * cos(sector_angle)) + (y5 *(sin(sector_angle)));

y6 = (-x5 * sin(sector_angle)) + (y5 * cos(sector_angle));

G=[x6 y6]

plot(G(1),G(2),'d')

hold on

% 8th point clock wise movement

x7 = (x6 * cos(sector_angle)) + (y6 *(sin(sector_angle)));

y7 = (-x6 * sin(sector_angle)) + (y6 * cos(sector_angle));

H=[x7 y7]

plot(H(1),H(2),'d')

hold on

% 9th point clock wise movement

x8 = (x7 * cos(sector_angle)) + (y7 *(sin(sector_angle)));

y8 = (-x7 * sin(sector_angle)) + (y7 * cos(sector_angle));

I=[x8 y8]

plot(I(1),I(2),'d')

hold on

%{ % Find centre of the circle Matrix_1 = [A(1)-B(1),A(2)- B(2);B(1)-C(1),B(2) - C(2)]

Matrix_1_inv = inv(Matrix_1)

Matrix_3 = [((A(1)^2)- (B(1)^2) + (A(2)^2)- (B(2)^2));((B(1)^2)-(C(1)^2) + (B(2)^2) - (C(2)^2))]

Matrix_4 = 0.5 * (Matrix_3) .* Matrix_1_inv %}

The plot of this is given below: enter image description here