user1924312
user1924312

Reputation:

Algorithm for calculate intersection point of two horizontal and vertical line

i wrote algorithm for calculate intersection point of two line

but it works only for slope lines

i want algorithm to calculate intersection point for horizontal and vertical Lines

https://i.sstatic.net/n9Vgv.jpg

Upvotes: 2

Views: 1801

Answers (1)

d-stroyer
d-stroyer

Reputation: 2706

the intersection between a horizontal and a vertical line is trivial. Assume the horizontal line is defined by

y = c1

and the vertical line by

x = c2

(where c1 and c2 are your constants)

then the intersection is (c2;c1).

In the example you gave : c2 = 1 ; c1 = 6 and the intersectoin is (1;6)

Upvotes: 6

Related Questions