Placing roof tiles using mathematics

161 Views Asked by At

I'm no mathematician, but I have this very specific problem with regards to placing objects in a 3D programme. You can imagine this object as an L-shape in 2D space, let's call it $L$, where the horizontal side $a$ is length $0.25$ and the vertical side $b$ is length $1.5$. The angle between $a$ and $b$ is $90°$. The vertex at the top of $b$ is $P$, and the right vertex of $a$ is $Q$. $b$ must intersect $(0,0)$, and $Q$ is locked to the Y axis. As $Q$ moves along the Y axis $P$ draws a curve, let's call that $N$. There is a straight line $M$, which could be anywhere and at any angle. I need a way to determine at which coordinates $N$ intersects $M$, if any, where the coordinates of $N$ are both greater than $0$. Apologies for any poor choices of the notation.

Crude diagram

Edit 1:

So I think I know how to calculate the coordinates of $P$ given a certain value for $Q$, just a bit of trigonometry. The problem is that I don't know how to intersect $N$ and $M$, because the input to the function that creates $N$ is $Q$, and $N$ outputs both $x$ and $y$ coordinates, whereas the function to create $M$ has the $x$ coordinate known to begin with and only the $y$ as the output, so it doesn't seem like quadratics applies here?

Here is how I calculated $P$:

Crude diagram

  • Take an L-shape $L$, where the horizontal line $b = \overleftrightarrow{RQ} = 0.25$, and the vertical line $a = \overleftrightarrow{PR} = 1.5$. Same as above but I changed the notation to make it easier to understand.
  • $\angle PRQ = 90°$.
  • $\overleftrightarrow{PR}$ must intersect $(0,0)$.
  • $S$ is at the origin.
  • $Q$ must be locked to the y-axis. The distance $Q$ is along the Y-axis is $SQ$, and is the input to the function that creates the curve $N$.
  • $T$ is directly below $P$ and on the X-axis.

$$\angle RSQ = \angle SPT = \arcsin(\overleftrightarrow{SQ} / \sin(90°) \cdot 0.25)$$ $$\angle SQR = \angle PST = 180 - 90° - \angle RSQ$$ $$\overleftrightarrow{RS} = \overleftrightarrow{SQ} / \sin(90°) \cdot \sin(\angle SQR)$$ $$\overleftrightarrow{SP} = 1.5 - \overleftrightarrow{RS}$$ $$xP = \overleftrightarrow{SP} / \sin(90°) \cdot \sin(\angle RSQ)$$ $$yP = \overleftrightarrow{SP} / \sin(90°) \cdot \sin(\angle SQR)$$

1

There are 1 best solutions below

2
On BEST ANSWER

enter image description here

Let $|PC|=b=1.5$, $|QC|=a=0.25$, and a general equation for the line

\begin{align} M:&\quad ux+vy+w=0 \tag{1}\label{1} . \end{align}

The curve $N$ (the locus of points $P$) can be parameterized with parameter $t\in[0,b]$: $t=|OP|$.

The coordinates of the point $P$ in terms of $t$ are: \begin{align} P_x&=t\cos\phi ,\quad P_y=t\sin\phi ,\quad \phi=\angle CQO . \end{align}

Excluding $\phi$ with \begin{align} \tan\phi&=\frac{b-t}a ,\\ \cos\phi&= \sqrt{\frac{1}{1+\tan^2\phi}} =\frac{a}{\sqrt{a^2+b^2+t^2-2tb}} ,\\ \sin\phi&=\tan\phi\cos\phi =\frac{b-t}{\sqrt{a^2+b^2+t^2-2tb}} , \end{align}

we get $N=N(t).\ t\in[0.b]$ as

\begin{align} N(t)&=\left( \frac{at}{\sqrt{a^2+b^2+t^2-2tb}} , \frac{(b-t)t}{\sqrt{a^2+b^2+t^2-2tb}} \right) \tag{2}\label{2} . \end{align}

substitution of \eqref{2} into \eqref{1} gives the equation in terms of $t$:

\begin{align} u\cdot \frac{at}{\sqrt{a^2+b^2+t^2-2tb}} + v\cdot \frac{(b-t)t}{\sqrt{a^2+b^2+t^2-2tb}} +w&=0 \\ \text{or }\quad v^2 t^4-2 (a u+b v)v t^3 +((a u+b v)^2-w^2) t^2+2b w^2 t -w^2\,(a^2+b^2) &=0 \tag{3}\label{3} . \end{align}

If there is some $t$ as a solution of \eqref{3} which fits in the interval $[0,b]$, there is a corresponding intersection $M\cap N=P=N(t)=M(t)$.

For example, let \begin{align} u&=5,\quad v=7,\quad w=-8 ,\\ M:&\quad 5x+7y-8=0 . \end{align} \eqref{3} becomes \begin{align} 49t^4-\tfrac{329}2\,t^3 +\tfrac{1185}{16}\,t^2 +192t-148 &= 0 \end{align}

with four real roots, \begin{align} t_1&\approx -1.073737808 ,\\ t_2&\approx 0.9479508787 ,\\ t_3&\approx 1.485999356 ,\\ t_4&\approx 1.996930431 . \end{align}

The two solutions, $t_2$ and $t_3$ are in the range $[0,1.5]$, and corresponding points of intersections are $N(t_2)\approx (0.391057,0.86353)$ and $N(t_3)\approx (1.48367,0.083)$.

enter image description here