0
$\begingroup$

For example, I have a graph having size of 480 width x 300 height. I am able to calculate the center point ( & that is 240,150 ).

Now my question is as follows.

  • I have a location/vertex on that graph. ( as follows. ) enter image description here

  • I want to calculate the possible max & min co-ordinate detail within graph if I draw a edge using both vertex ( illustrated as follows )
    Edit : This is just a sample vertex. Vertex can be anywhere in the graph. enter image description here

  • I want to determine the max co-ordinate and min co-ordinate. enter image description here

( I am from commerce background & have less knowledge of maths. Requesting you to improve question, if needed )

1 Answers 1

2

Referencing the diagram shown below, where the origin is at the lower left hand corner of the rectangle:

Let's say the coordinates of the top point are $(a,b)$ and that $q=(x_q,y_q)$ is the point of intersection "on the left" of the diagonal and the rectangle.

Draw the right triangle whose hypotenuse is the line segment between the points $(a,b)$ and $(240,150)$, whose vertical side intersects $(a,b)$, and whose horizontal side intersects $(240,150)$. Let's call that triangle $T$.

Draw the right triangle whose hypotenuse is the line segment between the points $(a,b)$ and $q$, whose vertical side intersects $(240,150)$, and whose horizontal side intersects $q$. Let's call that triangle $B$.

For triangle $T$, we know the height of the vertical side is $|b-150|$. We also know the width of the horizontal side $|a-240|$.

For triangle $B$, we know the height of the vertical side is $ |150 -q_y|$. And we know the width of the horizontal side $ |240-q_x|$.

These two triangles are similar, so corresponding ratios of sides are equal: $ \tag{1}{|b-150|\over |a-240|}={ |150-q_y|\over|240-q_x|}. $

Now, depending on whether the diagonal intersects the top/bottom or left/right sides of the rectangle, you will either know the value of $q_x$ or $q_y$. Then you can use equation (1) to find the value of the other coordinate.


Of course, you could just find the equation of the line formed by the diagonal and use that...

In fact, the equation would be $ \tag{2}{y-150\over x-240}={b-150\over a-240}. $

You know either the $x$ or $y$ coordinate of $q$; so, you can use equation (2) to find the unknown coordinate.

(Note, incidentally, the similar triangle argument essentially tells you why the equation of the line is as given in (2).)


Not to scale enter image description here

  • 1
    If the points are where David has drawn them, the max and min $y$-coordinates will be 300 and zero, respectively. So I think the first thing you have to do is decide where that second point is relative to the diagonals of the rectangle, so you know whether your line meets the top and bottom of the rectangle, or the left and right sides.2011-12-06