0
$\begingroup$

Let say I have the following image,

enter image description here

How to calculate the new length of line?

Update: It seems there is confusion on question. See this image,

enter image description here

I just need to map the 100 * 100 Rectangle with 250 * 150 Rectangle. Everything inside 100 * 100 Rectangle must be shown to 250 * 150 Rectangle.

Finally, I got the correct answer. Thanks to anon and user27978. This will work even if the slope of new line changed.

ℓ′=√(aΔx)2+(bΔy)2

  • 0
    @AndréNicolas, You are correct. Sorry for that. I was just visualizing that time.2012-04-03

2 Answers 2

1

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}.

  • 0
    OK. Thanks. Sorry for that.2012-04-02
1

The answer depends on the slope of the line. The horizontal scaling is $\frac{600}{300} = 2$, the vertical scaling is $\frac{450}{250} = \frac{9}{5}$. If $x, y \in \unicode{x211D}^2$ are the end points of the original line, then the length of the new line is $\sqrt{2^2(x_1 - y_1)^2 + (\frac{9}{5})^2(x_2 - y_2)^2} $. Since all we know is that $\sqrt{(x_1 - y_1)^2 + (x_2 - y_2)^2} = 150 m$, the most we can say is that the length of the new line lies between $\frac{9}{5} \times 150 m$ and $2 \times 150m$.

In the following, I drop the meter dimension as it is easy to confuse with the symbol I use to represent the slope, m.

If you know the slope of the line, say $m = \frac{y_2 - x_2}{y_1-x_1}$, then the length formula for the original line gives $\sqrt{(1+m^2)(x_1 - y_1)^2} = 150$, or $|x_1-y_1| = \frac{150}{\sqrt{1+m^2}}$, from which we get $|x_2-y_2| = |m|\frac{150}{\sqrt{1+m^2}}$. Then the length of the new line is given by plugging these numbers in: $\sqrt{2^2 \frac{150^2}{1+m^2} + (\frac{9}{5})^2 \frac{m^2 150^2}{1+m^2} } = \frac{150}{\sqrt{1+m^2}}\sqrt{2^2 + (\frac{9}{5})^2 m^2 } $. A quick sanity check with $m=0$ and $m = \infty$ returns the expected numbers.

  • 0
    This is same as anon giving above. Thanks.2012-04-02