[Math] Parametric Equation for a Cone with Any Direction About the Origin

rotationssolid-geometryvectors

I'm trying to find the parametric equation for a cone with its apex at the origin, an aperture of $2\phi$, and an axis parallel to some vector $\vec d$. The cone is right-circular and is meant to be able to extend indefinitely as $t$ increases.

The idea is to model the shape of insect repellent spray as it is released from an aerosol can. The spray begins when $t=0$ and continues for all $t \ge 0$. The specified direction vector $\vec d$ is meant to determine the speed of propagation of the cone (in terms of $t$) as well as the direction of propagation (from the apex to the center of the base).

So far I've tried assuming that a general cone along the z-axis with apex at the origin and equation $\begin{pmatrix} x \\ y \\ z \end{pmatrix} = t \begin{pmatrix} \tan(\phi) \cos(\theta) \\ \tan(\phi) \sin(\theta) \\ 1 \end{pmatrix}$ has a direction vector of $\vec a =\begin{pmatrix} 0 \\ 0 \\ 1 \end{pmatrix}$. If I want that cone to go in another direction $\vec d$ than I can use trigonometry to find the rotation angles between $\vec d$ and $\vec a$ along each x-, y-, and z-axis; put those values into the three elemental rotation matrices; and apply those matrices to the original cone equation. This didn't really work out though.

Then I found this post and the implicit cone equation $\vec u \cdot \vec d – |\vec u||\vec v|\cos(\phi) = 0$ (for $\vec u = [x, y, z]$ and some direction vector $\vec d = [d_1, d_2, d_3]$). Only problem is I've never heard the term 'implicit' before and I don't know how to turn that equation into a vector form.

If anyone is able to convert that implicit cone equation into vector form and/or give me the vector equation for a right-circular cone with any direction, I would really appreciate it.

Best Answer

There are several options, depending on exactly what you want to do.


Let $\hat{d}$ be the unit ($\lVert\hat{d}\rVert = 1$) direction vector, $$\hat{d} = \frac{\vec{d}}{\lVert\vec{d}\rVert} \tag{1}\label{NA1}$$

Let $\hat{u}$ be an unit vector perpendicular to $\hat{d}$; essentially, the direction perpendicular to the spray for which $\varphi = 0$.

If your spray is radially symmetric, then you can pick $\hat{u}$ freely. One way to pick it is to calculate $\hat{e}_x \cdot \hat{d}$, $\hat{e}_y \cdot \hat{d}$, and $\hat{e}_z \cdot \hat{d}$ (the $\hat{e}$ unit vectors being the axis vectors, i.e. $\hat{e}_x = \left [ \begin{matrix} 1 \\ 0 \\ 0 \end{matrix} \right ]$), and let $\hat{e}$ be $\hat{e}_x$, $\hat{e}_y$, or $\hat{e}_z$, depending on which one was closest to zero, then $$\vec{u} = \hat{e} - \hat{e} \left ( \hat{e} \cdot \hat{d} \right ), \quad \hat{u} = \frac{\vec{u}}{\lVert\vec{u}\rVert} \tag{2}\label{NA2}$$

If you let $$ \hat{d} = \left [ \begin{matrix} d_x \\ d_y \\ d_z \end{matrix} \right ], \quad \hat{u} = \left [ \begin{matrix} u_x \\ u_y \\ u_z \end{matrix} \right ], \quad \hat{v} = \hat{d} \times \hat{u} = \left [ \begin{matrix} v_x \\ v_y \\ v_z \end{matrix} \right ] = \left [ \begin{matrix} d_y u_z - d_z u_y \\ d_z u_x - d_x u_z \\ d_x u_y - d_y u_x \end{matrix} \right ] $$ then the rotation matrix $\mathbf{R}$ that rotates $z$ axis towards $\hat{d}$, $x$ axis towards $\hat{u}$, and $y$ axis towards $\hat{v}$, is $$ \mathbf{R} = \left [ \begin{matrix} u_x & v_x & d_x \\ u_y & v_y & d_y \\ u_z & v_z & d_z \\ \end{matrix} \right ] \tag{3a}\label{NA3a} $$ Because $\mathbf{R}$ is an orthonormal matrix, the inverse rotation is $$ \mathbf{R}^{-1} = \mathbf{R}^T = \left [ \begin{matrix} u_x & u_y & u_z \\ v_x & v_y & v_z \\ d_x & d_y & d_z \\ \end{matrix} \right ] \tag{3b}\label{NA3b} $$

This means that if you have a vector $\vec{p}$ in the coordinate system where the spray is along the positive $z$ axis and $\varphi = 0$ along positive $x$ axis, then $$\vec{q} = \mathbf{R}\vec{p} \quad \iff \quad \vec{p} = \mathbf{R}^T \vec{q} \tag{4}\label{NA4}$$ i.e. vector $\vec{q}$ is the corresponding vector in the coordinate system where the spray is along $\hat{d}$, and $\varphi = 0$ along $\hat{u}$.


Let's say you want to use spherical coordinates $(r ,\, \varphi ,\, \theta)$ where $r$ is the distance from the nozzle, $\theta$ is the angle to the spray direction vector $\vec{d}$, and $\varphi$ is an angle around the axis of the direction.

Let's say the unit vector $\hat{d}$ describes the spray axis, and $\hat{u}$ describes the direction where $\varphi = 0$, both perpendicular to each other ($\hat{d} \perp \hat{u}$; $\hat{d} \cdot \hat{u} = 0$; $\hat{v} = \hat{d} \times \hat{u}$; $\hat{v} \perp \hat{u}$; and $\hat{v} \perp \hat{d}$).

You do not need to use the rotation matrix $\mathbf{R}$ to generate a vector given $r$ (length), $\theta$ (angle to axis of spray), and $\varphi$ (rotation around axis of spray). The result $\vec{q} = \mathbf{R}\vec{p}$ is equal to $$ \vec{q}(r, \varphi, \theta) = r \cos(\theta) \hat{d} + r \sin(\theta) \cos(\varphi) \hat{u} + r \sin(\theta) \sin(\varphi) \hat{v} \tag{5}\label{NA5} $$


To test whether vector $\vec{p}$ is within the right circular cone that has the apex at origin, axis $\vec{d}$, and aperture $2\theta$, use $$\vec{p} \cdot \vec{d} \le \lVert \vec{p} \rVert \lVert \vec{d} \rVert \cos(\theta) \tag{6}\label{NA6}$$ Note that when the dot products equal the product of their norms, the two vectors are parallel, $$\vec{p} \cdot \vec{d} = \lVert \vec{p} \rVert \lVert \vec{d} \rVert \quad \iff \quad \vec{p} \parallel \vec{d}$$ and at the limit, $$\vec{p} \cdot \vec{d} = \lVert \vec{p} \rVert \lVert \vec{d} \rVert \cos(\theta)$$ the vector is at the surface of the right circular cone.

Related Question