Taking the results of (Determine distance of point to straight), where the straight is given by:

%$g: \vec{x} = \vec{p} + \mu \vec{u_{0}} $%

let the point R be an element of a second straight h.

%$ h: R = \vec{r}=\vec{a}+\lambda\vec{b_0},\; |\vec{b_0}|=1$%

So the distance d becomes a function of λ
%$ d = d(\lambda) $%

%$ d = \sqrt{ \displaystyle{(\vec{r}-\vec{p})^{2} - ((\vec{r}-\vec{p})\cdot\vec{u_{0}})^{2}}}$%

%$ d = \sqrt{ \displaystyle{(\vec{a}+\lambda\vec{b_{0}}-\vec{p})^{2} - ((\vec{a}+\lambda\vec{b_{0}}-\vec{p})\cdot\vec{u_{0}})^{2}}}$%

For convenience I now treat d2 and will come back to d later.

%$ d^2(\lambda) $% %$=$% %$(\vec{a}+\lambda \vec{b}_{0} - \vec{p})^2 - ((\vec{a}+\lambda \vec{b}_{0} - \vec{p})\cdot \vec{u}_{0})^2$%
%$ d^2(\lambda) $% %$=$% %$ \vec{a}^2 + \lambda^2 \vec{b}_{0}^2 + \vec{p}^2 + 2 \vec{a} \lambda \vec{b}_{0} - 2 \vec{a} \vec{p} - 2 \vec{b}_{0} \lambda \vec{p} $%
%$- \Big( (\vec{a} \cdot \vec{u}_{0})^2 + \lambda^2 (\vec{b}_{0}\cdot \vec{u}_{0})^2 + (\vec{p}\cdot \vec{u}_{0})^2 + 2 \lambda (\vec{a} \cdot \vec{u}_{0})(\vec{b}_{0} \cdot \vec{u}_{0}) - (\vec{a} \cdot \vec{u}_{0})(\vec{p} \cdot \vec{u}_{0}) -2 \lambda (\vec{b}_{0} \cdot \vec{u}_{0})(\vec{p} \cdot \vec{u}_{0}) \Big)$%
%$ d^2(\lambda) $% %$=$% %$a_x^2 (1 - u_{0x}^2) + \lambda^2 b_{0x}^2 (1 - u_{0x}^2) + p_x^2 (1 - u_{0x}^2)+ 2 a_x \lambda b_{0x} (1 - u_{0x})- 2 a_x p_x (1 - u_{0x}) - 2 \lambda b_{0x} p_x (1 - u_{0x})$%
%$+ a_y^2 (1 - u_{0y}^2) + \lambda^2 b_{0y}^2 (1 - u_{0y}^2) + p_y^2 (1 - u_{0y}^2)+ 2 a_y \lambda b_{0y} (1 - u_{0y})- 2 a_y p_y (1 - u_{0y}) - 2 \lambda b_{0y} p_y (1 - u_{0y})$%
%$+ a_z^2 (1 - u_{0z}^2) + \lambda^2 b_{0z}^2 (1 - u_{0z}^2) + p_z^2 (1 - u_{0z}^2)+ 2 a_z \lambda b_{0z} (1 - u_{0z})- 2 a_z p_z (1 - u_{0z}) - 2 \lambda b_{0z} p_z (1 - u_{0z})$%
%$ d^2(\lambda) $% %$=$% %$ \lambda^2 \Big[ b_{0x}^2 (1 - u_{0x}^2) + b_{0y}^2 (1 - u_{0y}^2) + b_{0z}^2 (1 - u_{0z}^2) \Big]$%
%$ + 2 \lambda \Big[ (a_x b_{0x} - b_{0x} p_x)(1-u_{0x}) + (a_y b_{0y} - b_{0y} p_y)(1-u_{0y}) + (a_z b_{0z} - b_{0z} p_z)(1-u_{0z}) \Big] $%
%$ + \Big[ (a_x^2 + p_x^2)(1-u_{0x}^2) + 2 a_x p_x (1-u_{0x}) + (a_y^2 + p_y^2)(1-u_{0y}^2) + 2 a_y p_y (1-u_{0y}) (a_z^2 + p_z^2)(1-u_{0z}^2) + 2 a_z p_z (1-u_{0z}) \Big]$%
%$ d^2(\lambda) $% %$=$% %$ \lambda^2 \cdot A + 2\cdot \lambda \cdot B + C$%
%$ with $% %$ A $% %$=$% %$\Big[ b_{0x}^2 (1 - u_{0x}^2) + b_{0y}^2 (1 - u_{0y}^2) + b_{0z}^2 (1 - u_{0z}^2) \Big]$%
%$ B $% %$=$% %$\Big[ (a_x b_{0x} - b_{0x} p_x)(1-u_{0x}) + (a_y b_{0y} - b_{0y} p_y)(1-u_{0y}) + (a_z b_{0z} - b_{0z} p_z)(1-u_{0z}) \Big] $%

%$ C $% %$=$% %$ \Big[ (a_x^2 + p_x^2)(1-u_{0x}^2) + 2 a_x p_x (1-u_{0x}) + (a_y^2 + p_y^2)(1-u_{0y}^2) + 2 a_y p_y (1-u_{0y}) (a_z^2 + p_z^2)(1-u_{0z}^2) + 2 a_z p_z (1-u_{0z}) \Big]$%
coming back to d

%$\to$% %$ d(\lambda) $% %$=$% %$ \sqrt{\lambda^2 \cdot A + 2\cdot \lambda \cdot B + C}$%
Now calculate the minium of

%$ d(\lambda) $%:

i.e.

%$\frac{\displaystyle d}{\displaystyle d\lambda}d \stackrel{!}{=} 0 \mbox{ and } \left.\frac{\displaystyle d^2}{\displaystyle d\lambda^2}d\;\right|_{\lambda=\lambda_{min}} > 0$%

%$\frac{\displaystyle d}{\displaystyle d\lambda}d = \frac{\displaystyle \lambda A + B}{\displaystyle \sqrt{\lambda^2 \cdot A + 2\cdot \lambda \cdot B + C}} = \frac{\displaystyle \lambda A + B}{\displaystyle d}$%

%$\frac{\displaystyle {d^2}}{\displaystyle {d \lambda^2}} d = \frac{\displaystyle d}{\displaystyle d\lambda} \left( \frac{\displaystyle \lambda A + B}{\displaystyle d} \right) = \frac{\displaystyle {A \cdot d - (\lambda A + B) \cdot \left( \frac{\displaystyle d}{\displaystyle d\lambda}d \right)}}{\displaystyle {d^2}}$%

%$\to \frac{\displaystyle {d^2}}{\displaystyle {d \lambda^2}} d = \frac{\displaystyle A}{\displaystyle d} - \frac{\displaystyle 1}{\displaystyle d} \cdot \left(\frac{\displaystyle d}{\displaystyle d\lambda} d \right)^2$%

%$\mbox{i.e. with: } \left.\frac{\displaystyle d}{\displaystyle d\lambda}\right|_{\lambda_{min}}d = 0 $%

%$\to \left.\frac{\displaystyle {d^2}}{\displaystyle {d \lambda^2}} d\right|_{\lambda=\lambda_{min}} = \frac{\displaystyle A}{\displaystyle d}$%

with

%$ A = b_{0x}^2 (1 - u_{0x}^2) + b_{0y}^2 (1 - u_{0y}^2) + b_{0z}^2 (1 - u_{0z}^2) $% %$\mbox { and } |\vec{u_0}| = 1,\; 0 \le u_{0i} \le 1, |\vec{b_0}| = 1,\; 0 \le b_{0i} \le 1 $% %$\mbox { and } \vec{u_0} \neq \vec{b_0} \mbox { and } \vec{u_0} \times \vec{u_0} \neq \vec{0} \mbox{ i.e. }\vec{u_0} \not\| \vec{b_0}$%

%$ \to A > 0 $%

%$ \mbox{ i.e. if } \frac{\displaystyle d}{\displaystyle d\lambda}d = 0 \mbox{ then it is a minimum.} $%

%$ \mbox{solving: } \frac{\displaystyle d}{\displaystyle d\lambda}d = 0 $% %$ \mbox{, given } d \neq 0 $% %$ \mbox{, gives: } \frac{\displaystyle \lambda A + B}{\displaystyle d} = 0 \to \lambda_{min}=\frac{\displaystyle B}{\displaystyle A} $%

%$ \to \lambda_{min} = \frac{\displaystyle{\Big[ (a_x b_{0x} - b_{0x} p_x)(1-u_{0x}) + (a_y b_{0y} - b_{0y} p_y)(1-u_{0y}) + (a_z b_{0z} - b_{0z} p_z)(1-u_{0z}) \Big]}}{\displaystyle{\Big[ b_{0x}^2 (1 - u_{0x}^2) + b_{0y}^2 (1 - u_{0y}^2) + b_{0z}^2 (1 - u_{0z}^2) \Big]}}$%

%$ \to \vec{r}_{min}=\vec{a}+\frac{\displaystyle{\Big[ (a_x b_{0x} - b_{0x} p_x)(1-u_{0x}) + (a_y b_{0y} - b_{0y} p_y)(1-u_{0y}) + (a_z b_{0z} - b_{0z} p_z)(1-u_{0z}) \Big]}}{\displaystyle{\Big[ b_{0x}^2 (1 - u_{0x}^2) + b_{0y}^2 (1 - u_{0y}^2) + b_{0z}^2 (1 - u_{0z}^2) \Big]}}\vec{b_0} $%

analogue to this calculation you can derive the equivalent point of straight g.

%$ \mu_{min} = \frac{\displaystyle B'}{\displaystyle A'} $%

%$ \to \mu_{min} = \frac{\displaystyle{\Big[ (p_x u_{0x} - u_{0x} a_x)(1-b_{0x}) + (p_y u_{0y} - u_{0y} a_y)(1-b_{0y}) + (p_z u_{0z} - u_{0z} a_z)(1-b_{0z}) \Big]}}{\displaystyle{\Big[ u_{0x}^2 (1 - b_{0x}^2) + u_{0y}^2 (1 - b_{0y}^2) + u_{0z}^2 (1 - b_{0z}^2) \Big]}}$%

%$ \to \vec{x}_{min}=\vec{p}+\mu_{min}\vec{u_0} $%

%$ \to \vec{x}_{min}=\vec{p}+\frac{\displaystyle{\Big[ (p_x u_{0x} - u_{0x} a_x)(1-b_{0x}) + (p_y u_{0y} - u_{0y} a_y)(1-b_{0y}) + (p_z u_{0z} - u_{0z} a_z)(1-b_{0z}) \Big]}}{\displaystyle{\Big[ u_{0x}^2 (1 - b_{0x}^2) + u_{0y}^2 (1 - b_{0y}^2) + u_{0z}^2 (1 - b_{0z}^2) \Big]}}\vec{u_0} $%

%$ \mbox{Vertex }\vec{v} = \frac{\displaystyle{1}}{\displaystyle{2}}(\vec{r}_{min} - \vec{x}_{min})$%

%$ \vec{v}$% %$=$% %$\frac{\displaystyle{1}}{\displaystyle{2}}\Bigg(\vec{a} - \vec{p}$%
%$+\frac{\displaystyle{\Big[ (a_x b_{0x} - b_{0x} p_x)(1-u_{0x}) + (a_y b_{0y} - b_{0y} p_y)(1-u_{0y}) + (a_z b_{0z} - b_{0z} p_z)(1-u_{0z}) \Big]}}{\displaystyle{\Big[ b_{0x}^2 (1 - u_{0x}^2) + b_{0y}^2 (1 - u_{0y}^2) + b_{0z}^2 (1 - u_{0z}^2) \Big]}}\vec{b_0}$%
%$\left.- \frac{\displaystyle{\Big[ (p_x u_{0x} - u_{0x} a_x)(1-b_{0x}) + (p_y u_{0y} - u_{0y} a_y)(1-b_{0y}) + (p_z u_{0z} - u_{0z} a_z)(1-b_{0z}) \Big]}}{\displaystyle{\Big[ u_{0x}^2 (1 - b_{0x}^2) + u_{0y}^2 (1 - b_{0y}^2) + u_{0z}^2 (1 - b_{0z}^2) \Big]}}\vec{u_0}\right)$%

...Back to Vertex Finding

-- PeterZumbruch - 23 Feb 2004
Topic revision: r5 - 2005-06-29, PeterZumbruch
Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki Send feedback | Imprint | Privacy Policy (in German)