سؤال

I have following equations:

  center_y -y1 = m * ( center_x - x1 );

  start_y - y1 = m * ( start_x - x1 );

where values of center_y,center_x,start_y,start_x and m are known and i want to get values of x1 and y1...

Kindly provide an appropriate solution in java.../

هل كانت مفيدة؟

المحلول

Assuming these are equations (i.e. m is a scalar, not a method), you can first rearrange the equations to get to a usual 2 variables / 2 equations model:

m.x1 - y1 = m.center_x - center_y
m.x1 - y1 = m.start_x - start_y

Then solve the linear system using general techniques. And you will find out that because the 2 equations are colinear, there is either no solution or many solutions to that system...

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top