3d finding perpendicular points ...

97 Views Asked by At

I have 3 (cartesian) points: v0, v1 and v2 whose values are shown below:

enter image description here

I need to calculate the points p0, p1 and p2 given that d may be any distance perpendicular from the midpoint of any two vertices.

For example, p0 is found by taking the midpoint of v1 and v2 and then moving perpendicular a distance d to find p0. I can find the midpoints, but after that, I am unsure how to find p0, p1 and p2 (as my 3d cartesian/vector math is very limited).

If an example could be given to show how to calculate (step by step) the values of p0, p1 and p2 that would be very much appreciated.

2

There are 2 best solutions below

5
On BEST ANSWER

I give you the formula for $p_0$, the other points are calculated similarly. First calculate the midpoint $m$ of $v_1,v_2$, which is simply $m=(v_1+v_2)/2$. Then $p_0$ lies on the line from $v_0$ through $m$, i.e. $p_0=v_0+\lambda\cdot\frac{m-v_0}{||m-v_0||}$, where $\lambda$ is the desired distance from $p_0$ to $v_0$. Thus, $\lambda=||m-v_0||+d$. Our final result should be \begin{align*} p_0=v_0+\frac{||m-v_0||+d}{||m-v_0||}\cdot(m-v_0)=v_0+\left(1+\frac{d}{||m-v_0||}\right)(m-v_0). \end{align*} Here, $||x||$ is the Euclidian norm of $x$, which is for $x=(x_1,x_2,x_3)\in\mathbb R^3$ just $||x||=\sqrt{x_1^2+x_2^2+x_3^2}$.

Here is an example: Let's say $v_0=(1,0,1),v_1=(1,1,-2),v_2=(3,-1,4),d=3$. Then $m=(v_1+v_2)/2=(4,0,2)/2=(2,0,1)$. Then $m-v_0=(1,0,0)$, hence $||m-v_0||=\sqrt{1^2+0^2+0^2}=1$. Finally, \begin{align*} p_0=v_0+\left(1+\frac{d}{||m-v_0||}\right)(m-v_0)=(1,0,1)+4(1,0,0)=(5,0,1). \end{align*}

2
On

You can compute the midpoint of two vertices by averaging the coordinates, so the point between $v_1$ and $v_2$ is $\frac 12(v_1+v_2)$ in each axis. Call it $v_4$Now you have two points on the line through $v_0$ and $v_4$, so you can parameterize the line as $v_4+t(v_0-v_4)$. To get the right distance you just want $d=\pm t|v_0-v_4|$ where you have to choose the sign to get the right side of the line.