How to shorten a line but maintain its angle? [closed]












-1












$begingroup$


I have a line that looks like this:



enter image description here



to draw this line i have the following:



point A: (x,y)
point B: (x,y)



so for example, i will be given this path:



(90,20),(400,300)



and then i can draw a line because i know point A and B clearly.



Now my issue is the following:



i would like to shorten both ends of the line but maintain its angle.



I tried just subtracting manually a value from y position but its not always accurate. see the thing is the points i will be given ALWAYS make the line point to the center of the markers on the map. See how in the photo the line points directly to the center of the "B" marker. so i just need to maintain its angle and i'll be fine. So how can i shorten the line on both ends but still maintain the correct angle ?



the coordinate system i am using looks like this:



enter image description here










share|cite|improve this question











$endgroup$



closed as unclear what you're asking by Eevee Trainer, Lord Shark the Unknown, José Carlos Santos, mrtaurho, metamorphy Jan 1 at 14:24


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.











  • 1




    $begingroup$
    Hi & welcome to MSE. Here is a hint. Equation of a Line from 2 Points shows how to create a simple equation describing the line. You can then adjust the value of $x$ or $y$ to determine the other value, i.e., $y$ or $x$.
    $endgroup$
    – John Omielan
    Jan 1 at 4:03










  • $begingroup$
    Do you want to shorten both ends equally, or one more than the other? How are you given the amount to shorten?
    $endgroup$
    – Ross Millikan
    Jan 1 at 4:19












  • $begingroup$
    yes. i just want to shorten it slightly. i dont have an exact number . i'll play with it. can you help ?
    $endgroup$
    – j2emanue
    Jan 1 at 4:27
















-1












$begingroup$


I have a line that looks like this:



enter image description here



to draw this line i have the following:



point A: (x,y)
point B: (x,y)



so for example, i will be given this path:



(90,20),(400,300)



and then i can draw a line because i know point A and B clearly.



Now my issue is the following:



i would like to shorten both ends of the line but maintain its angle.



I tried just subtracting manually a value from y position but its not always accurate. see the thing is the points i will be given ALWAYS make the line point to the center of the markers on the map. See how in the photo the line points directly to the center of the "B" marker. so i just need to maintain its angle and i'll be fine. So how can i shorten the line on both ends but still maintain the correct angle ?



the coordinate system i am using looks like this:



enter image description here










share|cite|improve this question











$endgroup$



closed as unclear what you're asking by Eevee Trainer, Lord Shark the Unknown, José Carlos Santos, mrtaurho, metamorphy Jan 1 at 14:24


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.











  • 1




    $begingroup$
    Hi & welcome to MSE. Here is a hint. Equation of a Line from 2 Points shows how to create a simple equation describing the line. You can then adjust the value of $x$ or $y$ to determine the other value, i.e., $y$ or $x$.
    $endgroup$
    – John Omielan
    Jan 1 at 4:03










  • $begingroup$
    Do you want to shorten both ends equally, or one more than the other? How are you given the amount to shorten?
    $endgroup$
    – Ross Millikan
    Jan 1 at 4:19












  • $begingroup$
    yes. i just want to shorten it slightly. i dont have an exact number . i'll play with it. can you help ?
    $endgroup$
    – j2emanue
    Jan 1 at 4:27














-1












-1








-1





$begingroup$


I have a line that looks like this:



enter image description here



to draw this line i have the following:



point A: (x,y)
point B: (x,y)



so for example, i will be given this path:



(90,20),(400,300)



and then i can draw a line because i know point A and B clearly.



Now my issue is the following:



i would like to shorten both ends of the line but maintain its angle.



I tried just subtracting manually a value from y position but its not always accurate. see the thing is the points i will be given ALWAYS make the line point to the center of the markers on the map. See how in the photo the line points directly to the center of the "B" marker. so i just need to maintain its angle and i'll be fine. So how can i shorten the line on both ends but still maintain the correct angle ?



the coordinate system i am using looks like this:



enter image description here










share|cite|improve this question











$endgroup$




I have a line that looks like this:



enter image description here



to draw this line i have the following:



point A: (x,y)
point B: (x,y)



so for example, i will be given this path:



(90,20),(400,300)



and then i can draw a line because i know point A and B clearly.



Now my issue is the following:



i would like to shorten both ends of the line but maintain its angle.



I tried just subtracting manually a value from y position but its not always accurate. see the thing is the points i will be given ALWAYS make the line point to the center of the markers on the map. See how in the photo the line points directly to the center of the "B" marker. so i just need to maintain its angle and i'll be fine. So how can i shorten the line on both ends but still maintain the correct angle ?



the coordinate system i am using looks like this:



enter image description here







arithmetic graphing-functions slope






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Jan 1 at 4:02









Gerry Myerson

146k8147298




146k8147298










asked Jan 1 at 3:59









j2emanuej2emanue

1064




1064




closed as unclear what you're asking by Eevee Trainer, Lord Shark the Unknown, José Carlos Santos, mrtaurho, metamorphy Jan 1 at 14:24


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






closed as unclear what you're asking by Eevee Trainer, Lord Shark the Unknown, José Carlos Santos, mrtaurho, metamorphy Jan 1 at 14:24


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 1




    $begingroup$
    Hi & welcome to MSE. Here is a hint. Equation of a Line from 2 Points shows how to create a simple equation describing the line. You can then adjust the value of $x$ or $y$ to determine the other value, i.e., $y$ or $x$.
    $endgroup$
    – John Omielan
    Jan 1 at 4:03










  • $begingroup$
    Do you want to shorten both ends equally, or one more than the other? How are you given the amount to shorten?
    $endgroup$
    – Ross Millikan
    Jan 1 at 4:19












  • $begingroup$
    yes. i just want to shorten it slightly. i dont have an exact number . i'll play with it. can you help ?
    $endgroup$
    – j2emanue
    Jan 1 at 4:27














  • 1




    $begingroup$
    Hi & welcome to MSE. Here is a hint. Equation of a Line from 2 Points shows how to create a simple equation describing the line. You can then adjust the value of $x$ or $y$ to determine the other value, i.e., $y$ or $x$.
    $endgroup$
    – John Omielan
    Jan 1 at 4:03










  • $begingroup$
    Do you want to shorten both ends equally, or one more than the other? How are you given the amount to shorten?
    $endgroup$
    – Ross Millikan
    Jan 1 at 4:19












  • $begingroup$
    yes. i just want to shorten it slightly. i dont have an exact number . i'll play with it. can you help ?
    $endgroup$
    – j2emanue
    Jan 1 at 4:27








1




1




$begingroup$
Hi & welcome to MSE. Here is a hint. Equation of a Line from 2 Points shows how to create a simple equation describing the line. You can then adjust the value of $x$ or $y$ to determine the other value, i.e., $y$ or $x$.
$endgroup$
– John Omielan
Jan 1 at 4:03




$begingroup$
Hi & welcome to MSE. Here is a hint. Equation of a Line from 2 Points shows how to create a simple equation describing the line. You can then adjust the value of $x$ or $y$ to determine the other value, i.e., $y$ or $x$.
$endgroup$
– John Omielan
Jan 1 at 4:03












$begingroup$
Do you want to shorten both ends equally, or one more than the other? How are you given the amount to shorten?
$endgroup$
– Ross Millikan
Jan 1 at 4:19






$begingroup$
Do you want to shorten both ends equally, or one more than the other? How are you given the amount to shorten?
$endgroup$
– Ross Millikan
Jan 1 at 4:19














$begingroup$
yes. i just want to shorten it slightly. i dont have an exact number . i'll play with it. can you help ?
$endgroup$
– j2emanue
Jan 1 at 4:27




$begingroup$
yes. i just want to shorten it slightly. i dont have an exact number . i'll play with it. can you help ?
$endgroup$
– j2emanue
Jan 1 at 4:27










1 Answer
1






active

oldest

votes


















3












$begingroup$

If the coordinates of $A$ are $(Ax,Ay)$ and of $B$ are $(Bx,By)$ the current length of the line is $$L=sqrt{(Ax-Bx)^2+(Ay-By)^2}$$
You can parameterize the line as
$$(Ax+t(Bx-Ax),Ay+t(By-Ay))$$
When $t=0$ you are at $A$ and when $t=1$ you are at $B$. If you want to shorten the line, just go from, say, $t=0.1$ to $t=0.8$. That will shorten the line by $10%$ at the $A$ end and $20%$ at the $B$ end.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    i need the new coordinates to plot. this will give me the length. i cannot use that.
    $endgroup$
    – j2emanue
    Jan 1 at 4:38










  • $begingroup$
    You can compute them from whatever $t$ values you pick for the ends of the line. Just plug those $t$s into the second expression.
    $endgroup$
    – Ross Millikan
    Jan 1 at 4:48




















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3












$begingroup$

If the coordinates of $A$ are $(Ax,Ay)$ and of $B$ are $(Bx,By)$ the current length of the line is $$L=sqrt{(Ax-Bx)^2+(Ay-By)^2}$$
You can parameterize the line as
$$(Ax+t(Bx-Ax),Ay+t(By-Ay))$$
When $t=0$ you are at $A$ and when $t=1$ you are at $B$. If you want to shorten the line, just go from, say, $t=0.1$ to $t=0.8$. That will shorten the line by $10%$ at the $A$ end and $20%$ at the $B$ end.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    i need the new coordinates to plot. this will give me the length. i cannot use that.
    $endgroup$
    – j2emanue
    Jan 1 at 4:38










  • $begingroup$
    You can compute them from whatever $t$ values you pick for the ends of the line. Just plug those $t$s into the second expression.
    $endgroup$
    – Ross Millikan
    Jan 1 at 4:48


















3












$begingroup$

If the coordinates of $A$ are $(Ax,Ay)$ and of $B$ are $(Bx,By)$ the current length of the line is $$L=sqrt{(Ax-Bx)^2+(Ay-By)^2}$$
You can parameterize the line as
$$(Ax+t(Bx-Ax),Ay+t(By-Ay))$$
When $t=0$ you are at $A$ and when $t=1$ you are at $B$. If you want to shorten the line, just go from, say, $t=0.1$ to $t=0.8$. That will shorten the line by $10%$ at the $A$ end and $20%$ at the $B$ end.






share|cite|improve this answer









$endgroup$













  • $begingroup$
    i need the new coordinates to plot. this will give me the length. i cannot use that.
    $endgroup$
    – j2emanue
    Jan 1 at 4:38










  • $begingroup$
    You can compute them from whatever $t$ values you pick for the ends of the line. Just plug those $t$s into the second expression.
    $endgroup$
    – Ross Millikan
    Jan 1 at 4:48
















3












3








3





$begingroup$

If the coordinates of $A$ are $(Ax,Ay)$ and of $B$ are $(Bx,By)$ the current length of the line is $$L=sqrt{(Ax-Bx)^2+(Ay-By)^2}$$
You can parameterize the line as
$$(Ax+t(Bx-Ax),Ay+t(By-Ay))$$
When $t=0$ you are at $A$ and when $t=1$ you are at $B$. If you want to shorten the line, just go from, say, $t=0.1$ to $t=0.8$. That will shorten the line by $10%$ at the $A$ end and $20%$ at the $B$ end.






share|cite|improve this answer









$endgroup$



If the coordinates of $A$ are $(Ax,Ay)$ and of $B$ are $(Bx,By)$ the current length of the line is $$L=sqrt{(Ax-Bx)^2+(Ay-By)^2}$$
You can parameterize the line as
$$(Ax+t(Bx-Ax),Ay+t(By-Ay))$$
When $t=0$ you are at $A$ and when $t=1$ you are at $B$. If you want to shorten the line, just go from, say, $t=0.1$ to $t=0.8$. That will shorten the line by $10%$ at the $A$ end and $20%$ at the $B$ end.







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered Jan 1 at 4:35









Ross MillikanRoss Millikan

293k23197371




293k23197371












  • $begingroup$
    i need the new coordinates to plot. this will give me the length. i cannot use that.
    $endgroup$
    – j2emanue
    Jan 1 at 4:38










  • $begingroup$
    You can compute them from whatever $t$ values you pick for the ends of the line. Just plug those $t$s into the second expression.
    $endgroup$
    – Ross Millikan
    Jan 1 at 4:48




















  • $begingroup$
    i need the new coordinates to plot. this will give me the length. i cannot use that.
    $endgroup$
    – j2emanue
    Jan 1 at 4:38










  • $begingroup$
    You can compute them from whatever $t$ values you pick for the ends of the line. Just plug those $t$s into the second expression.
    $endgroup$
    – Ross Millikan
    Jan 1 at 4:48


















$begingroup$
i need the new coordinates to plot. this will give me the length. i cannot use that.
$endgroup$
– j2emanue
Jan 1 at 4:38




$begingroup$
i need the new coordinates to plot. this will give me the length. i cannot use that.
$endgroup$
– j2emanue
Jan 1 at 4:38












$begingroup$
You can compute them from whatever $t$ values you pick for the ends of the line. Just plug those $t$s into the second expression.
$endgroup$
– Ross Millikan
Jan 1 at 4:48






$begingroup$
You can compute them from whatever $t$ values you pick for the ends of the line. Just plug those $t$s into the second expression.
$endgroup$
– Ross Millikan
Jan 1 at 4:48





Popular posts from this blog

Human spaceflight

Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

File:DeusFollowingSea.jpg