Saturday 15 March 2014

android - Extend the line to the end of the screen -



android - Extend the line to the end of the screen -

i making android app have 2 circles, there line attach between 2 circles. have managed draw line between circles regardless angle between them. question extend line end of screen. can know how it? thanks.

let co-ordinates of 2 circle centres (a,b) , (c,d).

the line segment want draw goes (p,?) (q,?) p , q x-co-ordinates of left , right of screen. can use:

y = ((d - b)/(c - a))*(p - a) + b y = ((d - b)/(c - a))*(q - a) + b

to find 2 y-values of points. encounter problem if 2 points vertical (c = a) cause partition zero.

android math geometry formula

No comments:

Post a Comment