Prepend a vector with 90 degree angle to an existing one
up vote
0
down vote
favorite
First of all: my knowledge in mathematics is a bit rusty, so no matter how simple my question is, I afraid I in every case need a somewhat detailed answer:
I have a line from coordinates (x1,y1) to (x2,y2). Now I want to prepend a second line (x0,y0) to (x1,y1) before this one, but it should have a 90 degree angle to the first one.
Any idea how I can calculate my coordinates (x0,y0) so that the two lines form a right angle?
Finally all should be done in C programming language but I think this does not matter for this specific question.
Thanks for your patience!
geometry vectors angle
New contributor
add a comment |
up vote
0
down vote
favorite
First of all: my knowledge in mathematics is a bit rusty, so no matter how simple my question is, I afraid I in every case need a somewhat detailed answer:
I have a line from coordinates (x1,y1) to (x2,y2). Now I want to prepend a second line (x0,y0) to (x1,y1) before this one, but it should have a 90 degree angle to the first one.
Any idea how I can calculate my coordinates (x0,y0) so that the two lines form a right angle?
Finally all should be done in C programming language but I think this does not matter for this specific question.
Thanks for your patience!
geometry vectors angle
New contributor
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
First of all: my knowledge in mathematics is a bit rusty, so no matter how simple my question is, I afraid I in every case need a somewhat detailed answer:
I have a line from coordinates (x1,y1) to (x2,y2). Now I want to prepend a second line (x0,y0) to (x1,y1) before this one, but it should have a 90 degree angle to the first one.
Any idea how I can calculate my coordinates (x0,y0) so that the two lines form a right angle?
Finally all should be done in C programming language but I think this does not matter for this specific question.
Thanks for your patience!
geometry vectors angle
New contributor
First of all: my knowledge in mathematics is a bit rusty, so no matter how simple my question is, I afraid I in every case need a somewhat detailed answer:
I have a line from coordinates (x1,y1) to (x2,y2). Now I want to prepend a second line (x0,y0) to (x1,y1) before this one, but it should have a 90 degree angle to the first one.
Any idea how I can calculate my coordinates (x0,y0) so that the two lines form a right angle?
Finally all should be done in C programming language but I think this does not matter for this specific question.
Thanks for your patience!
geometry vectors angle
geometry vectors angle
New contributor
New contributor
New contributor
asked Nov 23 at 8:39
Mike Maikaefer
1
1
New contributor
New contributor
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
When two lines are perpendicular, their slopes (denoted by $m$) are negative reciprocals. In general, you can calculate $m$ by using the following formula.
$$m = frac{Delta y}{Delta x} = frac{y_2-y_1}{x_2-x_1}$$
Call the slope of the first line $m_1$ and the slope of the second line $m_2$.
$$m_1 = frac{y_2-y_1}{x_2-x_1}$$
$$m_2 = frac{y_1-y_0}{x_1-x_0}$$
Use
$$m_1 = -frac{1}{m_2}$$
which gives
$$frac{y_2-y_1}{x_2-x_1} = -frac{1}{frac{y_1-y_0}{x_1-x_0}} implies frac{y_2-y_1}{x_2-x_1} = frac{x_1-x_0}{y_1-y_0}$$
and you have $(x_1, y_1)$ and $(x_2, y_2)$, so you can reach an equation for $y_0$ and $x_0$ followed by calculating for $(x_0, y_0)$, for which there are infinite possibilities.
Ah ok...the length for the new line from (x0,y0) to (x1,y1) is predefined, so this would limit the infinite number of possibilites a bit?
– Mike Maikaefer
Nov 23 at 8:58
If that's the case, the yes. If there is a fixed length, there would be only one solution which satisfies both the equation and the length given. (Two if you choose one coordinate on either side.) (If not, any $(x_0, y_0)$ satisfying the equation you get for $y_0$ and $x_0$ will work.)
– KM101
Nov 23 at 9:03
add a comment |
up vote
0
down vote
There's no need to deal with slopes at all. Let $(a, b)$ be a vector, then $J(a, b):=(-b,a)$ is the rotated vector $(a, b)$ by $90^circ$. Now let $p_i=(x_i,y_i)$. Then
$$p_0=p_1+J(p_2-p_1),$$
that is explicitly written
$$begin{pmatrix}x_0\ y_0
end{pmatrix}=begin{pmatrix}x_1\ y_1
end{pmatrix}+Jbegin{pmatrix}x_2-x_1\y_2-y_1
end{pmatrix}=begin{pmatrix}x_1\ y_1
end{pmatrix}+begin{pmatrix}y_1-y_2\x_2-x_1
end{pmatrix}=
begin{pmatrix}x_1+y_1-y_2\ y_1+x_2-x_1
end{pmatrix}.
$$
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
When two lines are perpendicular, their slopes (denoted by $m$) are negative reciprocals. In general, you can calculate $m$ by using the following formula.
$$m = frac{Delta y}{Delta x} = frac{y_2-y_1}{x_2-x_1}$$
Call the slope of the first line $m_1$ and the slope of the second line $m_2$.
$$m_1 = frac{y_2-y_1}{x_2-x_1}$$
$$m_2 = frac{y_1-y_0}{x_1-x_0}$$
Use
$$m_1 = -frac{1}{m_2}$$
which gives
$$frac{y_2-y_1}{x_2-x_1} = -frac{1}{frac{y_1-y_0}{x_1-x_0}} implies frac{y_2-y_1}{x_2-x_1} = frac{x_1-x_0}{y_1-y_0}$$
and you have $(x_1, y_1)$ and $(x_2, y_2)$, so you can reach an equation for $y_0$ and $x_0$ followed by calculating for $(x_0, y_0)$, for which there are infinite possibilities.
Ah ok...the length for the new line from (x0,y0) to (x1,y1) is predefined, so this would limit the infinite number of possibilites a bit?
– Mike Maikaefer
Nov 23 at 8:58
If that's the case, the yes. If there is a fixed length, there would be only one solution which satisfies both the equation and the length given. (Two if you choose one coordinate on either side.) (If not, any $(x_0, y_0)$ satisfying the equation you get for $y_0$ and $x_0$ will work.)
– KM101
Nov 23 at 9:03
add a comment |
up vote
0
down vote
When two lines are perpendicular, their slopes (denoted by $m$) are negative reciprocals. In general, you can calculate $m$ by using the following formula.
$$m = frac{Delta y}{Delta x} = frac{y_2-y_1}{x_2-x_1}$$
Call the slope of the first line $m_1$ and the slope of the second line $m_2$.
$$m_1 = frac{y_2-y_1}{x_2-x_1}$$
$$m_2 = frac{y_1-y_0}{x_1-x_0}$$
Use
$$m_1 = -frac{1}{m_2}$$
which gives
$$frac{y_2-y_1}{x_2-x_1} = -frac{1}{frac{y_1-y_0}{x_1-x_0}} implies frac{y_2-y_1}{x_2-x_1} = frac{x_1-x_0}{y_1-y_0}$$
and you have $(x_1, y_1)$ and $(x_2, y_2)$, so you can reach an equation for $y_0$ and $x_0$ followed by calculating for $(x_0, y_0)$, for which there are infinite possibilities.
Ah ok...the length for the new line from (x0,y0) to (x1,y1) is predefined, so this would limit the infinite number of possibilites a bit?
– Mike Maikaefer
Nov 23 at 8:58
If that's the case, the yes. If there is a fixed length, there would be only one solution which satisfies both the equation and the length given. (Two if you choose one coordinate on either side.) (If not, any $(x_0, y_0)$ satisfying the equation you get for $y_0$ and $x_0$ will work.)
– KM101
Nov 23 at 9:03
add a comment |
up vote
0
down vote
up vote
0
down vote
When two lines are perpendicular, their slopes (denoted by $m$) are negative reciprocals. In general, you can calculate $m$ by using the following formula.
$$m = frac{Delta y}{Delta x} = frac{y_2-y_1}{x_2-x_1}$$
Call the slope of the first line $m_1$ and the slope of the second line $m_2$.
$$m_1 = frac{y_2-y_1}{x_2-x_1}$$
$$m_2 = frac{y_1-y_0}{x_1-x_0}$$
Use
$$m_1 = -frac{1}{m_2}$$
which gives
$$frac{y_2-y_1}{x_2-x_1} = -frac{1}{frac{y_1-y_0}{x_1-x_0}} implies frac{y_2-y_1}{x_2-x_1} = frac{x_1-x_0}{y_1-y_0}$$
and you have $(x_1, y_1)$ and $(x_2, y_2)$, so you can reach an equation for $y_0$ and $x_0$ followed by calculating for $(x_0, y_0)$, for which there are infinite possibilities.
When two lines are perpendicular, their slopes (denoted by $m$) are negative reciprocals. In general, you can calculate $m$ by using the following formula.
$$m = frac{Delta y}{Delta x} = frac{y_2-y_1}{x_2-x_1}$$
Call the slope of the first line $m_1$ and the slope of the second line $m_2$.
$$m_1 = frac{y_2-y_1}{x_2-x_1}$$
$$m_2 = frac{y_1-y_0}{x_1-x_0}$$
Use
$$m_1 = -frac{1}{m_2}$$
which gives
$$frac{y_2-y_1}{x_2-x_1} = -frac{1}{frac{y_1-y_0}{x_1-x_0}} implies frac{y_2-y_1}{x_2-x_1} = frac{x_1-x_0}{y_1-y_0}$$
and you have $(x_1, y_1)$ and $(x_2, y_2)$, so you can reach an equation for $y_0$ and $x_0$ followed by calculating for $(x_0, y_0)$, for which there are infinite possibilities.
edited Nov 23 at 8:58
answered Nov 23 at 8:52
KM101
2,527416
2,527416
Ah ok...the length for the new line from (x0,y0) to (x1,y1) is predefined, so this would limit the infinite number of possibilites a bit?
– Mike Maikaefer
Nov 23 at 8:58
If that's the case, the yes. If there is a fixed length, there would be only one solution which satisfies both the equation and the length given. (Two if you choose one coordinate on either side.) (If not, any $(x_0, y_0)$ satisfying the equation you get for $y_0$ and $x_0$ will work.)
– KM101
Nov 23 at 9:03
add a comment |
Ah ok...the length for the new line from (x0,y0) to (x1,y1) is predefined, so this would limit the infinite number of possibilites a bit?
– Mike Maikaefer
Nov 23 at 8:58
If that's the case, the yes. If there is a fixed length, there would be only one solution which satisfies both the equation and the length given. (Two if you choose one coordinate on either side.) (If not, any $(x_0, y_0)$ satisfying the equation you get for $y_0$ and $x_0$ will work.)
– KM101
Nov 23 at 9:03
Ah ok...the length for the new line from (x0,y0) to (x1,y1) is predefined, so this would limit the infinite number of possibilites a bit?
– Mike Maikaefer
Nov 23 at 8:58
Ah ok...the length for the new line from (x0,y0) to (x1,y1) is predefined, so this would limit the infinite number of possibilites a bit?
– Mike Maikaefer
Nov 23 at 8:58
If that's the case, the yes. If there is a fixed length, there would be only one solution which satisfies both the equation and the length given. (Two if you choose one coordinate on either side.) (If not, any $(x_0, y_0)$ satisfying the equation you get for $y_0$ and $x_0$ will work.)
– KM101
Nov 23 at 9:03
If that's the case, the yes. If there is a fixed length, there would be only one solution which satisfies both the equation and the length given. (Two if you choose one coordinate on either side.) (If not, any $(x_0, y_0)$ satisfying the equation you get for $y_0$ and $x_0$ will work.)
– KM101
Nov 23 at 9:03
add a comment |
up vote
0
down vote
There's no need to deal with slopes at all. Let $(a, b)$ be a vector, then $J(a, b):=(-b,a)$ is the rotated vector $(a, b)$ by $90^circ$. Now let $p_i=(x_i,y_i)$. Then
$$p_0=p_1+J(p_2-p_1),$$
that is explicitly written
$$begin{pmatrix}x_0\ y_0
end{pmatrix}=begin{pmatrix}x_1\ y_1
end{pmatrix}+Jbegin{pmatrix}x_2-x_1\y_2-y_1
end{pmatrix}=begin{pmatrix}x_1\ y_1
end{pmatrix}+begin{pmatrix}y_1-y_2\x_2-x_1
end{pmatrix}=
begin{pmatrix}x_1+y_1-y_2\ y_1+x_2-x_1
end{pmatrix}.
$$
add a comment |
up vote
0
down vote
There's no need to deal with slopes at all. Let $(a, b)$ be a vector, then $J(a, b):=(-b,a)$ is the rotated vector $(a, b)$ by $90^circ$. Now let $p_i=(x_i,y_i)$. Then
$$p_0=p_1+J(p_2-p_1),$$
that is explicitly written
$$begin{pmatrix}x_0\ y_0
end{pmatrix}=begin{pmatrix}x_1\ y_1
end{pmatrix}+Jbegin{pmatrix}x_2-x_1\y_2-y_1
end{pmatrix}=begin{pmatrix}x_1\ y_1
end{pmatrix}+begin{pmatrix}y_1-y_2\x_2-x_1
end{pmatrix}=
begin{pmatrix}x_1+y_1-y_2\ y_1+x_2-x_1
end{pmatrix}.
$$
add a comment |
up vote
0
down vote
up vote
0
down vote
There's no need to deal with slopes at all. Let $(a, b)$ be a vector, then $J(a, b):=(-b,a)$ is the rotated vector $(a, b)$ by $90^circ$. Now let $p_i=(x_i,y_i)$. Then
$$p_0=p_1+J(p_2-p_1),$$
that is explicitly written
$$begin{pmatrix}x_0\ y_0
end{pmatrix}=begin{pmatrix}x_1\ y_1
end{pmatrix}+Jbegin{pmatrix}x_2-x_1\y_2-y_1
end{pmatrix}=begin{pmatrix}x_1\ y_1
end{pmatrix}+begin{pmatrix}y_1-y_2\x_2-x_1
end{pmatrix}=
begin{pmatrix}x_1+y_1-y_2\ y_1+x_2-x_1
end{pmatrix}.
$$
There's no need to deal with slopes at all. Let $(a, b)$ be a vector, then $J(a, b):=(-b,a)$ is the rotated vector $(a, b)$ by $90^circ$. Now let $p_i=(x_i,y_i)$. Then
$$p_0=p_1+J(p_2-p_1),$$
that is explicitly written
$$begin{pmatrix}x_0\ y_0
end{pmatrix}=begin{pmatrix}x_1\ y_1
end{pmatrix}+Jbegin{pmatrix}x_2-x_1\y_2-y_1
end{pmatrix}=begin{pmatrix}x_1\ y_1
end{pmatrix}+begin{pmatrix}y_1-y_2\x_2-x_1
end{pmatrix}=
begin{pmatrix}x_1+y_1-y_2\ y_1+x_2-x_1
end{pmatrix}.
$$
answered Nov 23 at 11:45
Michael Hoppe
10.6k31733
10.6k31733
add a comment |
add a comment |
Mike Maikaefer is a new contributor. Be nice, and check out our Code of Conduct.
Mike Maikaefer is a new contributor. Be nice, and check out our Code of Conduct.
Mike Maikaefer is a new contributor. Be nice, and check out our Code of Conduct.
Mike Maikaefer is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3010127%2fprepend-a-vector-with-90-degree-angle-to-an-existing-one%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown