Flatten 3D triangle while maintaining edge lengths
I currently try to flatten a triangle in 3d space while maintaining the edge lengths. The triangle consists of 3 vertices, all with x,y,z coordinates and is drawn clockwise. The second vertex yields 1 for the z value, the other two vertices are aligned to the x-axis and yield 0 for z.
Directly setting the z value would violate the edge length constraint. The target is to transform the 3d triangle so it could be completely projected in 2d.
I tried to calculate the angle between a vector lying on the ground and an edge vector to get a rotation matrix. To flatten the triangle I would have to rotate the triangle with exactly this angle.
This however is error-prone under real life conditions. I'm currently looking for a way to transform the triangle directly without the need of a rotation.
geometry triangle 3d rotations
add a comment |
I currently try to flatten a triangle in 3d space while maintaining the edge lengths. The triangle consists of 3 vertices, all with x,y,z coordinates and is drawn clockwise. The second vertex yields 1 for the z value, the other two vertices are aligned to the x-axis and yield 0 for z.
Directly setting the z value would violate the edge length constraint. The target is to transform the 3d triangle so it could be completely projected in 2d.
I tried to calculate the angle between a vector lying on the ground and an edge vector to get a rotation matrix. To flatten the triangle I would have to rotate the triangle with exactly this angle.
This however is error-prone under real life conditions. I'm currently looking for a way to transform the triangle directly without the need of a rotation.
geometry triangle 3d rotations
The transformation that you’re describing is precisely a rotation followed by a trivial orthogonal projection onto the $x$-$y$ plane. What’s “error prone” about this? If you don’t want to construct a rotation matrix, you can either use Rodrigues' formula or a pair of reflections, both of which can be done via direct computation on the vertices.
– amd
Jun 29 at 21:14
Also, you’re working in 3-D: the vertices are “clockwise” relative to what?
– amd
Jun 29 at 21:15
add a comment |
I currently try to flatten a triangle in 3d space while maintaining the edge lengths. The triangle consists of 3 vertices, all with x,y,z coordinates and is drawn clockwise. The second vertex yields 1 for the z value, the other two vertices are aligned to the x-axis and yield 0 for z.
Directly setting the z value would violate the edge length constraint. The target is to transform the 3d triangle so it could be completely projected in 2d.
I tried to calculate the angle between a vector lying on the ground and an edge vector to get a rotation matrix. To flatten the triangle I would have to rotate the triangle with exactly this angle.
This however is error-prone under real life conditions. I'm currently looking for a way to transform the triangle directly without the need of a rotation.
geometry triangle 3d rotations
I currently try to flatten a triangle in 3d space while maintaining the edge lengths. The triangle consists of 3 vertices, all with x,y,z coordinates and is drawn clockwise. The second vertex yields 1 for the z value, the other two vertices are aligned to the x-axis and yield 0 for z.
Directly setting the z value would violate the edge length constraint. The target is to transform the 3d triangle so it could be completely projected in 2d.
I tried to calculate the angle between a vector lying on the ground and an edge vector to get a rotation matrix. To flatten the triangle I would have to rotate the triangle with exactly this angle.
This however is error-prone under real life conditions. I'm currently looking for a way to transform the triangle directly without the need of a rotation.
geometry triangle 3d rotations
geometry triangle 3d rotations
edited Nov 22 at 17:52
Robert Howard
1,9161822
1,9161822
asked Jun 29 at 18:05
Sector
254
254
The transformation that you’re describing is precisely a rotation followed by a trivial orthogonal projection onto the $x$-$y$ plane. What’s “error prone” about this? If you don’t want to construct a rotation matrix, you can either use Rodrigues' formula or a pair of reflections, both of which can be done via direct computation on the vertices.
– amd
Jun 29 at 21:14
Also, you’re working in 3-D: the vertices are “clockwise” relative to what?
– amd
Jun 29 at 21:15
add a comment |
The transformation that you’re describing is precisely a rotation followed by a trivial orthogonal projection onto the $x$-$y$ plane. What’s “error prone” about this? If you don’t want to construct a rotation matrix, you can either use Rodrigues' formula or a pair of reflections, both of which can be done via direct computation on the vertices.
– amd
Jun 29 at 21:14
Also, you’re working in 3-D: the vertices are “clockwise” relative to what?
– amd
Jun 29 at 21:15
The transformation that you’re describing is precisely a rotation followed by a trivial orthogonal projection onto the $x$-$y$ plane. What’s “error prone” about this? If you don’t want to construct a rotation matrix, you can either use Rodrigues' formula or a pair of reflections, both of which can be done via direct computation on the vertices.
– amd
Jun 29 at 21:14
The transformation that you’re describing is precisely a rotation followed by a trivial orthogonal projection onto the $x$-$y$ plane. What’s “error prone” about this? If you don’t want to construct a rotation matrix, you can either use Rodrigues' formula or a pair of reflections, both of which can be done via direct computation on the vertices.
– amd
Jun 29 at 21:14
Also, you’re working in 3-D: the vertices are “clockwise” relative to what?
– amd
Jun 29 at 21:15
Also, you’re working in 3-D: the vertices are “clockwise” relative to what?
– amd
Jun 29 at 21:15
add a comment |
2 Answers
2
active
oldest
votes
Let's say the three vertices of the triangle are
$$
vec{v}_1 = left [ begin{matrix} x_1 \ y_1 \ z_1 end{matrix} right ],
quad
vec{v}_2 = left [ begin{matrix} x_2 \ y_2 \ z_2 end{matrix} right ],
quad
vec{v}_3 = left [ begin{matrix} x_3 \ y_3 \ z_3 end{matrix} right ]
$$
You can construct a two-dimensional coordinate system, where $vec{v}_1$ is at origin, $vec{v}_2$ is on the positive $x$ axis, and $vec{v}_3$ is somewhere above the $x$ axis (i.e., has a positive $y$ coordinate).
If we use
$$vec{V}_1 = left [ begin{matrix} 0 \ 0 end{matrix} right ], quad
vec{V}_2 = left [ begin{matrix} h \ 0 end{matrix} right ], quad
vec{V}_3 = left [ begin{matrix} i \ j end{matrix} right ]$$
then the rules to keep the edge lengths intact are
$$leftlbracebegin{aligned}
h^2 &= lVert vec{v}_2 - vec{v}_1 rVert^2 \
i^2 + j^2 &= lVert vec{v}_3 - vec{v}_1 rVert^2 \
(h-i)^2 + j^2 &= lVert vec{v}_3 - vec{v}_2 rVert^2
end{aligned}right.$$
i.e.
$$leftlbracebegin{aligned}
h^2 &= (x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2 \
i^2 + j^2 &= (x_3 - x_1)^2 + (y_3 - y_1)^2 + (z_3 - z_1)^2 \
(h-i)^2 + j^2 &= (x_3 - x_2)^2 + (y_3 - y_2)^2 + (z_3 - z_2)^2
end{aligned}right.$$
If the three points are all separate and not on the same line, there is a solution:
$$begin{aligned}
h &= sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2} \
i &= frac{(x_3 - x_1)(x_2 - x_1) + (y_3 - y_1)(y_2 - y_1) + (z_3 - z_1)(z_2 - z_1)}{h} \
j &= sqrt{(x_3 - x_1)^2 + (y_3 - y_1)^2 + (z_3 - z_1)^2 - i^2}
end{aligned}$$
This means that in the triangle, if we drop a line from the third vertex, perpendicular to the line between the first two vertices, the two lines intersect at distance $i$ from the first vertex towards the second vertex. (But note that $i$ can be negative, meaning the opposite direction.) The distance between the third vertex and the intersection is $j$.
OP has a triangle with $z_1 = z_2 = 0$, and wants to find out where the third vertex would be, if the triangle is rotated around the first edge to bring the third vertex to the $xy$ plane.
First, we need two unit vectors. The first unit vector, $hat{u}$, is from $vec{v}_1$ towards $vec{v}_2$:
$$hat{u} = frac{vec{v}_2 - vec{v}_1}{lVertvec{v}_2 - vec{v}_1rVert} = left [ begin{matrix} frac{x_2 - x_1}{h} \ frac{y_2 - y_1}{h} \ 0 end{matrix} right ]$$
The second vector is perpendicular to the first, but also on the $xy$ plane. There are two options:
$$hat{v}_{+} = left [ begin{matrix} frac{y_2 - y_1}{h} \ frac{x_1 - x_2}{h} \ 0 end{matrix} right ] quad text{or} quad
hat{v}_{-} = left [ begin{matrix} frac{y_1 - y_2}{h} \ frac{x_2 - x_1}{h} \ 0 end{matrix} right ]$$
Typically, you pick the one that is in the same halfspace as $vec{v}_3$, i.e. has the larger (positive) dot product; this corresponds to the smaller rotation angle:
$$hat{v} = begin{cases}
hat{v}_{+}, & hat{v}_{+} cdot vec{v}_3 ge hat{v}_{-} cdot vec{v}_3 \
hat{v}_{-}, & hat{v}_{+} cdot vec{v}_3 lt hat{v}_{-} cdot vec{v}_3 end{cases}$$
Then, the location of the third vertex on the $xy$ plane is $vec{v}_3^prime$,
$$vec{v}_3^prime = vec{v}_1 + i hat{u} + j hat{v}$$
This is the exact same location you get, if you rotate the triangle around the edge between vertices $vec{v}_1$ and $vec{v}_2$, bringing the third vertex also to the $xy$ plane. The two options, $hat{v}_{+}$ and $hat{v}_{-}$ correspond to rotations that differ by 180°.
add a comment |
Given three points $p_1$, $p_2$ and $p_3$.
Define two circles $C_1$ with $p_1$ as center and $l_1$ as radius and $C_2$ with $p_2$ as center and $l_2$ as radius.
Where $l_1 = |p_1 - p_3|$ and $l_2 = |p_2 - p_3|$ .
The intersection of circles $C_1$ and $C_2$ define two points, one of which can be identified with the point $p_3$.
Now, given any arbitrary plane with normal $n$ containing the points $p_1$ and $p_2$ you can compute the point $p_3$ as one of the intersection points of the above two circles both defined with normal $n$.
See: circle circle intersection + cordinates + 3d + normal plane
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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%2f2836060%2fflatten-3d-triangle-while-maintaining-edge-lengths%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Let's say the three vertices of the triangle are
$$
vec{v}_1 = left [ begin{matrix} x_1 \ y_1 \ z_1 end{matrix} right ],
quad
vec{v}_2 = left [ begin{matrix} x_2 \ y_2 \ z_2 end{matrix} right ],
quad
vec{v}_3 = left [ begin{matrix} x_3 \ y_3 \ z_3 end{matrix} right ]
$$
You can construct a two-dimensional coordinate system, where $vec{v}_1$ is at origin, $vec{v}_2$ is on the positive $x$ axis, and $vec{v}_3$ is somewhere above the $x$ axis (i.e., has a positive $y$ coordinate).
If we use
$$vec{V}_1 = left [ begin{matrix} 0 \ 0 end{matrix} right ], quad
vec{V}_2 = left [ begin{matrix} h \ 0 end{matrix} right ], quad
vec{V}_3 = left [ begin{matrix} i \ j end{matrix} right ]$$
then the rules to keep the edge lengths intact are
$$leftlbracebegin{aligned}
h^2 &= lVert vec{v}_2 - vec{v}_1 rVert^2 \
i^2 + j^2 &= lVert vec{v}_3 - vec{v}_1 rVert^2 \
(h-i)^2 + j^2 &= lVert vec{v}_3 - vec{v}_2 rVert^2
end{aligned}right.$$
i.e.
$$leftlbracebegin{aligned}
h^2 &= (x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2 \
i^2 + j^2 &= (x_3 - x_1)^2 + (y_3 - y_1)^2 + (z_3 - z_1)^2 \
(h-i)^2 + j^2 &= (x_3 - x_2)^2 + (y_3 - y_2)^2 + (z_3 - z_2)^2
end{aligned}right.$$
If the three points are all separate and not on the same line, there is a solution:
$$begin{aligned}
h &= sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2} \
i &= frac{(x_3 - x_1)(x_2 - x_1) + (y_3 - y_1)(y_2 - y_1) + (z_3 - z_1)(z_2 - z_1)}{h} \
j &= sqrt{(x_3 - x_1)^2 + (y_3 - y_1)^2 + (z_3 - z_1)^2 - i^2}
end{aligned}$$
This means that in the triangle, if we drop a line from the third vertex, perpendicular to the line between the first two vertices, the two lines intersect at distance $i$ from the first vertex towards the second vertex. (But note that $i$ can be negative, meaning the opposite direction.) The distance between the third vertex and the intersection is $j$.
OP has a triangle with $z_1 = z_2 = 0$, and wants to find out where the third vertex would be, if the triangle is rotated around the first edge to bring the third vertex to the $xy$ plane.
First, we need two unit vectors. The first unit vector, $hat{u}$, is from $vec{v}_1$ towards $vec{v}_2$:
$$hat{u} = frac{vec{v}_2 - vec{v}_1}{lVertvec{v}_2 - vec{v}_1rVert} = left [ begin{matrix} frac{x_2 - x_1}{h} \ frac{y_2 - y_1}{h} \ 0 end{matrix} right ]$$
The second vector is perpendicular to the first, but also on the $xy$ plane. There are two options:
$$hat{v}_{+} = left [ begin{matrix} frac{y_2 - y_1}{h} \ frac{x_1 - x_2}{h} \ 0 end{matrix} right ] quad text{or} quad
hat{v}_{-} = left [ begin{matrix} frac{y_1 - y_2}{h} \ frac{x_2 - x_1}{h} \ 0 end{matrix} right ]$$
Typically, you pick the one that is in the same halfspace as $vec{v}_3$, i.e. has the larger (positive) dot product; this corresponds to the smaller rotation angle:
$$hat{v} = begin{cases}
hat{v}_{+}, & hat{v}_{+} cdot vec{v}_3 ge hat{v}_{-} cdot vec{v}_3 \
hat{v}_{-}, & hat{v}_{+} cdot vec{v}_3 lt hat{v}_{-} cdot vec{v}_3 end{cases}$$
Then, the location of the third vertex on the $xy$ plane is $vec{v}_3^prime$,
$$vec{v}_3^prime = vec{v}_1 + i hat{u} + j hat{v}$$
This is the exact same location you get, if you rotate the triangle around the edge between vertices $vec{v}_1$ and $vec{v}_2$, bringing the third vertex also to the $xy$ plane. The two options, $hat{v}_{+}$ and $hat{v}_{-}$ correspond to rotations that differ by 180°.
add a comment |
Let's say the three vertices of the triangle are
$$
vec{v}_1 = left [ begin{matrix} x_1 \ y_1 \ z_1 end{matrix} right ],
quad
vec{v}_2 = left [ begin{matrix} x_2 \ y_2 \ z_2 end{matrix} right ],
quad
vec{v}_3 = left [ begin{matrix} x_3 \ y_3 \ z_3 end{matrix} right ]
$$
You can construct a two-dimensional coordinate system, where $vec{v}_1$ is at origin, $vec{v}_2$ is on the positive $x$ axis, and $vec{v}_3$ is somewhere above the $x$ axis (i.e., has a positive $y$ coordinate).
If we use
$$vec{V}_1 = left [ begin{matrix} 0 \ 0 end{matrix} right ], quad
vec{V}_2 = left [ begin{matrix} h \ 0 end{matrix} right ], quad
vec{V}_3 = left [ begin{matrix} i \ j end{matrix} right ]$$
then the rules to keep the edge lengths intact are
$$leftlbracebegin{aligned}
h^2 &= lVert vec{v}_2 - vec{v}_1 rVert^2 \
i^2 + j^2 &= lVert vec{v}_3 - vec{v}_1 rVert^2 \
(h-i)^2 + j^2 &= lVert vec{v}_3 - vec{v}_2 rVert^2
end{aligned}right.$$
i.e.
$$leftlbracebegin{aligned}
h^2 &= (x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2 \
i^2 + j^2 &= (x_3 - x_1)^2 + (y_3 - y_1)^2 + (z_3 - z_1)^2 \
(h-i)^2 + j^2 &= (x_3 - x_2)^2 + (y_3 - y_2)^2 + (z_3 - z_2)^2
end{aligned}right.$$
If the three points are all separate and not on the same line, there is a solution:
$$begin{aligned}
h &= sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2} \
i &= frac{(x_3 - x_1)(x_2 - x_1) + (y_3 - y_1)(y_2 - y_1) + (z_3 - z_1)(z_2 - z_1)}{h} \
j &= sqrt{(x_3 - x_1)^2 + (y_3 - y_1)^2 + (z_3 - z_1)^2 - i^2}
end{aligned}$$
This means that in the triangle, if we drop a line from the third vertex, perpendicular to the line between the first two vertices, the two lines intersect at distance $i$ from the first vertex towards the second vertex. (But note that $i$ can be negative, meaning the opposite direction.) The distance between the third vertex and the intersection is $j$.
OP has a triangle with $z_1 = z_2 = 0$, and wants to find out where the third vertex would be, if the triangle is rotated around the first edge to bring the third vertex to the $xy$ plane.
First, we need two unit vectors. The first unit vector, $hat{u}$, is from $vec{v}_1$ towards $vec{v}_2$:
$$hat{u} = frac{vec{v}_2 - vec{v}_1}{lVertvec{v}_2 - vec{v}_1rVert} = left [ begin{matrix} frac{x_2 - x_1}{h} \ frac{y_2 - y_1}{h} \ 0 end{matrix} right ]$$
The second vector is perpendicular to the first, but also on the $xy$ plane. There are two options:
$$hat{v}_{+} = left [ begin{matrix} frac{y_2 - y_1}{h} \ frac{x_1 - x_2}{h} \ 0 end{matrix} right ] quad text{or} quad
hat{v}_{-} = left [ begin{matrix} frac{y_1 - y_2}{h} \ frac{x_2 - x_1}{h} \ 0 end{matrix} right ]$$
Typically, you pick the one that is in the same halfspace as $vec{v}_3$, i.e. has the larger (positive) dot product; this corresponds to the smaller rotation angle:
$$hat{v} = begin{cases}
hat{v}_{+}, & hat{v}_{+} cdot vec{v}_3 ge hat{v}_{-} cdot vec{v}_3 \
hat{v}_{-}, & hat{v}_{+} cdot vec{v}_3 lt hat{v}_{-} cdot vec{v}_3 end{cases}$$
Then, the location of the third vertex on the $xy$ plane is $vec{v}_3^prime$,
$$vec{v}_3^prime = vec{v}_1 + i hat{u} + j hat{v}$$
This is the exact same location you get, if you rotate the triangle around the edge between vertices $vec{v}_1$ and $vec{v}_2$, bringing the third vertex also to the $xy$ plane. The two options, $hat{v}_{+}$ and $hat{v}_{-}$ correspond to rotations that differ by 180°.
add a comment |
Let's say the three vertices of the triangle are
$$
vec{v}_1 = left [ begin{matrix} x_1 \ y_1 \ z_1 end{matrix} right ],
quad
vec{v}_2 = left [ begin{matrix} x_2 \ y_2 \ z_2 end{matrix} right ],
quad
vec{v}_3 = left [ begin{matrix} x_3 \ y_3 \ z_3 end{matrix} right ]
$$
You can construct a two-dimensional coordinate system, where $vec{v}_1$ is at origin, $vec{v}_2$ is on the positive $x$ axis, and $vec{v}_3$ is somewhere above the $x$ axis (i.e., has a positive $y$ coordinate).
If we use
$$vec{V}_1 = left [ begin{matrix} 0 \ 0 end{matrix} right ], quad
vec{V}_2 = left [ begin{matrix} h \ 0 end{matrix} right ], quad
vec{V}_3 = left [ begin{matrix} i \ j end{matrix} right ]$$
then the rules to keep the edge lengths intact are
$$leftlbracebegin{aligned}
h^2 &= lVert vec{v}_2 - vec{v}_1 rVert^2 \
i^2 + j^2 &= lVert vec{v}_3 - vec{v}_1 rVert^2 \
(h-i)^2 + j^2 &= lVert vec{v}_3 - vec{v}_2 rVert^2
end{aligned}right.$$
i.e.
$$leftlbracebegin{aligned}
h^2 &= (x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2 \
i^2 + j^2 &= (x_3 - x_1)^2 + (y_3 - y_1)^2 + (z_3 - z_1)^2 \
(h-i)^2 + j^2 &= (x_3 - x_2)^2 + (y_3 - y_2)^2 + (z_3 - z_2)^2
end{aligned}right.$$
If the three points are all separate and not on the same line, there is a solution:
$$begin{aligned}
h &= sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2} \
i &= frac{(x_3 - x_1)(x_2 - x_1) + (y_3 - y_1)(y_2 - y_1) + (z_3 - z_1)(z_2 - z_1)}{h} \
j &= sqrt{(x_3 - x_1)^2 + (y_3 - y_1)^2 + (z_3 - z_1)^2 - i^2}
end{aligned}$$
This means that in the triangle, if we drop a line from the third vertex, perpendicular to the line between the first two vertices, the two lines intersect at distance $i$ from the first vertex towards the second vertex. (But note that $i$ can be negative, meaning the opposite direction.) The distance between the third vertex and the intersection is $j$.
OP has a triangle with $z_1 = z_2 = 0$, and wants to find out where the third vertex would be, if the triangle is rotated around the first edge to bring the third vertex to the $xy$ plane.
First, we need two unit vectors. The first unit vector, $hat{u}$, is from $vec{v}_1$ towards $vec{v}_2$:
$$hat{u} = frac{vec{v}_2 - vec{v}_1}{lVertvec{v}_2 - vec{v}_1rVert} = left [ begin{matrix} frac{x_2 - x_1}{h} \ frac{y_2 - y_1}{h} \ 0 end{matrix} right ]$$
The second vector is perpendicular to the first, but also on the $xy$ plane. There are two options:
$$hat{v}_{+} = left [ begin{matrix} frac{y_2 - y_1}{h} \ frac{x_1 - x_2}{h} \ 0 end{matrix} right ] quad text{or} quad
hat{v}_{-} = left [ begin{matrix} frac{y_1 - y_2}{h} \ frac{x_2 - x_1}{h} \ 0 end{matrix} right ]$$
Typically, you pick the one that is in the same halfspace as $vec{v}_3$, i.e. has the larger (positive) dot product; this corresponds to the smaller rotation angle:
$$hat{v} = begin{cases}
hat{v}_{+}, & hat{v}_{+} cdot vec{v}_3 ge hat{v}_{-} cdot vec{v}_3 \
hat{v}_{-}, & hat{v}_{+} cdot vec{v}_3 lt hat{v}_{-} cdot vec{v}_3 end{cases}$$
Then, the location of the third vertex on the $xy$ plane is $vec{v}_3^prime$,
$$vec{v}_3^prime = vec{v}_1 + i hat{u} + j hat{v}$$
This is the exact same location you get, if you rotate the triangle around the edge between vertices $vec{v}_1$ and $vec{v}_2$, bringing the third vertex also to the $xy$ plane. The two options, $hat{v}_{+}$ and $hat{v}_{-}$ correspond to rotations that differ by 180°.
Let's say the three vertices of the triangle are
$$
vec{v}_1 = left [ begin{matrix} x_1 \ y_1 \ z_1 end{matrix} right ],
quad
vec{v}_2 = left [ begin{matrix} x_2 \ y_2 \ z_2 end{matrix} right ],
quad
vec{v}_3 = left [ begin{matrix} x_3 \ y_3 \ z_3 end{matrix} right ]
$$
You can construct a two-dimensional coordinate system, where $vec{v}_1$ is at origin, $vec{v}_2$ is on the positive $x$ axis, and $vec{v}_3$ is somewhere above the $x$ axis (i.e., has a positive $y$ coordinate).
If we use
$$vec{V}_1 = left [ begin{matrix} 0 \ 0 end{matrix} right ], quad
vec{V}_2 = left [ begin{matrix} h \ 0 end{matrix} right ], quad
vec{V}_3 = left [ begin{matrix} i \ j end{matrix} right ]$$
then the rules to keep the edge lengths intact are
$$leftlbracebegin{aligned}
h^2 &= lVert vec{v}_2 - vec{v}_1 rVert^2 \
i^2 + j^2 &= lVert vec{v}_3 - vec{v}_1 rVert^2 \
(h-i)^2 + j^2 &= lVert vec{v}_3 - vec{v}_2 rVert^2
end{aligned}right.$$
i.e.
$$leftlbracebegin{aligned}
h^2 &= (x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2 \
i^2 + j^2 &= (x_3 - x_1)^2 + (y_3 - y_1)^2 + (z_3 - z_1)^2 \
(h-i)^2 + j^2 &= (x_3 - x_2)^2 + (y_3 - y_2)^2 + (z_3 - z_2)^2
end{aligned}right.$$
If the three points are all separate and not on the same line, there is a solution:
$$begin{aligned}
h &= sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + (z_2 - z_1)^2} \
i &= frac{(x_3 - x_1)(x_2 - x_1) + (y_3 - y_1)(y_2 - y_1) + (z_3 - z_1)(z_2 - z_1)}{h} \
j &= sqrt{(x_3 - x_1)^2 + (y_3 - y_1)^2 + (z_3 - z_1)^2 - i^2}
end{aligned}$$
This means that in the triangle, if we drop a line from the third vertex, perpendicular to the line between the first two vertices, the two lines intersect at distance $i$ from the first vertex towards the second vertex. (But note that $i$ can be negative, meaning the opposite direction.) The distance between the third vertex and the intersection is $j$.
OP has a triangle with $z_1 = z_2 = 0$, and wants to find out where the third vertex would be, if the triangle is rotated around the first edge to bring the third vertex to the $xy$ plane.
First, we need two unit vectors. The first unit vector, $hat{u}$, is from $vec{v}_1$ towards $vec{v}_2$:
$$hat{u} = frac{vec{v}_2 - vec{v}_1}{lVertvec{v}_2 - vec{v}_1rVert} = left [ begin{matrix} frac{x_2 - x_1}{h} \ frac{y_2 - y_1}{h} \ 0 end{matrix} right ]$$
The second vector is perpendicular to the first, but also on the $xy$ plane. There are two options:
$$hat{v}_{+} = left [ begin{matrix} frac{y_2 - y_1}{h} \ frac{x_1 - x_2}{h} \ 0 end{matrix} right ] quad text{or} quad
hat{v}_{-} = left [ begin{matrix} frac{y_1 - y_2}{h} \ frac{x_2 - x_1}{h} \ 0 end{matrix} right ]$$
Typically, you pick the one that is in the same halfspace as $vec{v}_3$, i.e. has the larger (positive) dot product; this corresponds to the smaller rotation angle:
$$hat{v} = begin{cases}
hat{v}_{+}, & hat{v}_{+} cdot vec{v}_3 ge hat{v}_{-} cdot vec{v}_3 \
hat{v}_{-}, & hat{v}_{+} cdot vec{v}_3 lt hat{v}_{-} cdot vec{v}_3 end{cases}$$
Then, the location of the third vertex on the $xy$ plane is $vec{v}_3^prime$,
$$vec{v}_3^prime = vec{v}_1 + i hat{u} + j hat{v}$$
This is the exact same location you get, if you rotate the triangle around the edge between vertices $vec{v}_1$ and $vec{v}_2$, bringing the third vertex also to the $xy$ plane. The two options, $hat{v}_{+}$ and $hat{v}_{-}$ correspond to rotations that differ by 180°.
answered Jun 29 at 20:04
Nominal Animal
6,7252517
6,7252517
add a comment |
add a comment |
Given three points $p_1$, $p_2$ and $p_3$.
Define two circles $C_1$ with $p_1$ as center and $l_1$ as radius and $C_2$ with $p_2$ as center and $l_2$ as radius.
Where $l_1 = |p_1 - p_3|$ and $l_2 = |p_2 - p_3|$ .
The intersection of circles $C_1$ and $C_2$ define two points, one of which can be identified with the point $p_3$.
Now, given any arbitrary plane with normal $n$ containing the points $p_1$ and $p_2$ you can compute the point $p_3$ as one of the intersection points of the above two circles both defined with normal $n$.
See: circle circle intersection + cordinates + 3d + normal plane
add a comment |
Given three points $p_1$, $p_2$ and $p_3$.
Define two circles $C_1$ with $p_1$ as center and $l_1$ as radius and $C_2$ with $p_2$ as center and $l_2$ as radius.
Where $l_1 = |p_1 - p_3|$ and $l_2 = |p_2 - p_3|$ .
The intersection of circles $C_1$ and $C_2$ define two points, one of which can be identified with the point $p_3$.
Now, given any arbitrary plane with normal $n$ containing the points $p_1$ and $p_2$ you can compute the point $p_3$ as one of the intersection points of the above two circles both defined with normal $n$.
See: circle circle intersection + cordinates + 3d + normal plane
add a comment |
Given three points $p_1$, $p_2$ and $p_3$.
Define two circles $C_1$ with $p_1$ as center and $l_1$ as radius and $C_2$ with $p_2$ as center and $l_2$ as radius.
Where $l_1 = |p_1 - p_3|$ and $l_2 = |p_2 - p_3|$ .
The intersection of circles $C_1$ and $C_2$ define two points, one of which can be identified with the point $p_3$.
Now, given any arbitrary plane with normal $n$ containing the points $p_1$ and $p_2$ you can compute the point $p_3$ as one of the intersection points of the above two circles both defined with normal $n$.
See: circle circle intersection + cordinates + 3d + normal plane
Given three points $p_1$, $p_2$ and $p_3$.
Define two circles $C_1$ with $p_1$ as center and $l_1$ as radius and $C_2$ with $p_2$ as center and $l_2$ as radius.
Where $l_1 = |p_1 - p_3|$ and $l_2 = |p_2 - p_3|$ .
The intersection of circles $C_1$ and $C_2$ define two points, one of which can be identified with the point $p_3$.
Now, given any arbitrary plane with normal $n$ containing the points $p_1$ and $p_2$ you can compute the point $p_3$ as one of the intersection points of the above two circles both defined with normal $n$.
See: circle circle intersection + cordinates + 3d + normal plane
answered Jun 29 at 22:26
Mauricio Cele Lopez Belon
56748
56748
add a comment |
add a comment |
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%2f2836060%2fflatten-3d-triangle-while-maintaining-edge-lengths%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
The transformation that you’re describing is precisely a rotation followed by a trivial orthogonal projection onto the $x$-$y$ plane. What’s “error prone” about this? If you don’t want to construct a rotation matrix, you can either use Rodrigues' formula or a pair of reflections, both of which can be done via direct computation on the vertices.
– amd
Jun 29 at 21:14
Also, you’re working in 3-D: the vertices are “clockwise” relative to what?
– amd
Jun 29 at 21:15