I want to calculate the intersection points of the following image:
Assume that the three points of the triangle could be located anywhere.
How would I do this?
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It only takes a minute to sign up.
Sign up to join this communityI want to calculate the intersection points of the following image:
Assume that the three points of the triangle could be located anywhere.
How would I do this?
Let's first solve the problem where the figures right-corner is at the origin, and its legs (of unit length) align with the axes.
The intercept-intercept form of the line equation gives this parameterization of the various lines: $$\frac{x}{t} + \frac{y}{1-t} = 1 \quad \text{or, in fraction-free form,} \quad x(1-t) + y t = t (1-t)$$ for $t$ a parameter between $0$ and $1$ (the extreme values being valid only in the fraction-free version).
Now, if we divide each leg into $n$ pieces (with $n+1$ equally-spaced points), then the intersection of the lines corresponding to $t=\frac{i}{n}$ and $t=\frac{j}{n}$, with $i, j \in \{0, 1, \dots, n\}$, is the point $$P_{ij} := \frac{1}{n^2}\large(\;ij\;,\;(n-i)(n-j)\;\large)$$
When the figure is located "anywhere", we need to apply a simple transformation. Note that, because the intersection points are defined via ratios of lengths of parallel segments, an affine transformation (that is, a linear transformation followed by a translation) will preserve the pattern.
Let's say that the resulting figure should have its (not-necessarily-right) corner at $C$ and its (not-necessarily-unit-length) legs ending at points $A$ and $B$.
We can write our original intersection points $P_{ij}$ as $$P_{ij} = \frac{ij}{n^2} u + \frac{(n-i)(n-j)}{n^2} v$$ where $u$ and $v$ are the unit vectors in the positive $x$ and $y$ directions.
Replacing $u$ with $A-C$ and $v$ with $B-C$ transforms the figure into the correct shape, though its corner remains at the origin; adding $C$ translates the figure into place. So, our transformed intersection points are given by
$$\begin{align} P^\prime_{ij} &= \frac{ij}{n^2} (A-C) + \frac{(n-i)(n-j)}{n^2} (B-C) + C \\[6pt] &= \frac{ij}{n^2} A \;+\; \frac{( n-i )( n - j )}{n^2} B \;+\; \frac{i (n-j) + j(n-i)}{n^2} C \end{align}$$