Question: determining the intersection points for a straight line through a circle. using basic classes without pointers to objects in c++ - cin user input thanks
determining the intersection points for a straight line through a circle. using basic classes without pointers to objects in c++ - cin user input thanks
/A=pow(m,2)+1; // A=m^2 + 1 B=2*(m*c-m*b-a); //B=2(mc-mb-a) C= pow(a,2)+pow(b,2)-pow(r,2)+pow(c,2)-2*b*c;//a^2+b^2-r^2+c^2-2bc d=sqrt(pow(B,2)-4*A*C); //calculate sqrt(B^2-4AC) //first root x=(-B+sqrt(B^2-4AC)) / 2A x1=(-B+d)/(2*A); //second root x=(-B-sqrt(B^2-4AC)) / 2A x2=(-B+d)/(2*A); //using line equation to get y values y1=m*x1+c; y2=m*x2+c;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
