Show right angles for orthogonal vectors in 3D

672 Views Asked by At

This question is one of simple computational geometry, similar to what I posted in https://stackoverflow.com/questions/34186711/rgl-vector-diagrams-show-right-angles-for-orthogonal-vectors. But no one answered, so I thought I would ask here.

Given: 2 orthogonal vectors in 3D, how to draw the right angle |_ symbol at their intersection?

The problem reduces to the following: Given three points, p1, p2, p3, find the points labeled p21, p23, and p123 in the diagram below. The first two are simple examples of finding a point along a line between two points, but I'm stumped on finding the coordinates of the third point, p123, that is the position of a point a distance d along a line parallel to the line p2->p3 starting at p21.

vector3d-diagram

For example, with the points below,

p1 <- c(0,0,0)
p2 <- c(1,1,0)
p3 <- c(1,1,1)

the following diagram marks the points p21 and p23 in red. How do I find what I called p123?

enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

Point $p_{123}$ is the sum $p_2+(p_{23}-p_2)+(p_{21}-p_2)$, that is: $$ p_{123}=dp_{3}+dp_{1}+(1-2d)p_2. $$ Example: if $p_2=(1,1,0)$, $p_{1}=(0,0,0)$ and $p_3=(1,1,1)$, then $p_{123}=(1-d,1-d,d)$.