Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

Why is my arc not in the right place on this image?

1 view (last 30 days)
Hello,
I am writing a program to determine deviations in cervical lordosis by comparing curve of the individual's cervical spine to an "ideal" curve of 42.5 degrees. I created an arc to represent the ideal curve and I wanted to place it so the beginning and ending points of the curve (yellow solid line) match up with the beginning and ending points of the spine (c2 and c7; green dotted line). However, as you can see in the image, the arc does not line up with the spine. The weird thing is that the beginning and ending points in the "x" and "y" arrays are identical to those of the "c2" and "c7", yet the plots to not match up. Any idea why this is happening? Thanks in advance.
I=imread('latcs.jpg');
imshow(I)
[c2,c7]=ginput(2);
c2x=c2(1);
c2y=c2(2);
c7x=c7(1);
c7y=c7(2);
c=norm(c7-c2);%find vector length between anterosuperior c2 and anteroinferior c7
arc_ang=degtorad(42.5); %convert arc angle to radians
arc_ang_corners=degtorad((180-42.5)/2); %angle of triangle corners
sin_arc_ang=sin(arc_ang); %sine of arc angle
radius=(0.5*c)/sin_arc_ang; %find radius of arc
A = c2; % Point A to be on circle circumference
B = c7; % Same with point B
C = (B+A)/2+sqrt(radius^2-c^2/4)/c*[0,-1;1,0]*(B-A); % Center of circle
a = atan2(A(2)-C(2),A(1)-C(1));
b = atan2(B(2)-C(2),B(1)-C(1));
b = mod(b-a,2*pi)+a; % Ensure that arc moves counterclockwise
t = linspace(a,b,1000);
x = C(1)+radius*cos(t);
y = C(2)+radius*sin(t);
plot(x,y,'y-',C(1),C(2),'w*',c2,c7,'g--')

Answers (1)

Nathan Hogaboom
Nathan Hogaboom on 23 Oct 2018
Nevermind I figured it out...

This question is closed.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!