I assume the transformation is of the form $\rm f:(x,y)\mapsto (ax,by)$, where we identify the lower left-hand corner with the origin. Given only the length $\ell$ of a line $\rm L$ contained inside the first triangle, it is impossible to determine the length \ell\,' of its image on the other triangle, $\rm f(L)$. If $\rm a\ne b$, changing the slope of $\rm L$ but without altering its length will still alter the value of \ell\,'.
As a concrete example, say $\rm a=1,b=2$ so that a $1\times 1$ square becomes a $1\times 2$ rectangle. In the process, $\rm x$-coordinates remain unaffected while $\rm y$-coordinates double. Thus, the length of any given horizontal line will remain unchanged, while the length of a vertical line will double. Clearly the length prior to transforming is insufficient information to determine the length after transforming.
Say you also know $\rm m$ the slope of the line. (The case of a vertical line reduces to a one-dimensional problem, so we will ignore it.) If we move the line to the origin and write its coordinate components as $\rm (x,m\,x)$, then we have $\rm \sqrt{x^2+(m\,x)^2}=\ell$, which we can use to solve for $\rm x$ as
$\rm x=\frac{\ell}{\sqrt{1+m^2}}.$
Now $\rm f(x,m\,x)=(ax,bmx)$ has length \ell\,'=\rm \sqrt{(ax)^2+(bmx)^2}=\sqrt{a^2+(b\,m)^2}x, whence we have
\rm \ell\,'=\sqrt{\frac{a^2+(bm)^2}{1+m^2}} \,\ell.
With the coordinates of the lines segment's endpoints $\rm (x_1,y_1)$ and $\rm (x_2,y_2)$, we have
$\rm m=\frac{\Delta y}{\Delta x}=\frac{y_2-y_1}{x_2-x_1}$
whence we have
\rm \ell\,' = \sqrt{(a \Delta x)^2+(b\Delta y)^2}.