Ova

How to parameterize an ellipse in 3-D?

Published in 3D Ellipse Parameterization 6 mins read

To parameterize an ellipse in 3D, you need to define its center, orientation, and the lengths of its semi-axes. This involves extending the familiar 2D ellipse equation into three-dimensional vector space.

The general parametric equation for an ellipse in 3D space is given by:

$\mathbf{P}(t) = \mathbf{C} + \mathbf{U} \cos(t) + \mathbf{V} \sin(t)$

Where:

  • $\mathbf{P}(t)$ is a 3D vector representing a point on the ellipse at parameter $t$.
  • $\mathbf{C}$ is a 3D vector representing the center of the ellipse.
  • $\mathbf{U}$ is a 3D vector representing the direction and length of one semi-axis of the ellipse.
  • $\mathbf{V}$ is a 3D vector representing the direction and length of the other semi-axis of the ellipse.
  • $\cos(t)$ and $\sin(t)$ are scalar functions that modulate the influence of $\mathbf{U}$ and $\mathbf{V}$, respectively.
  • $t$ is the parameter, typically ranging from $0$ to $2\pi$ radians, to trace the entire ellipse.

Understanding the Components of a 3D Ellipse Parameterization

For $\mathbf{P}(t)$ to describe an ellipse, the vectors $\mathbf{U}$ and $\mathbf{V}$ must satisfy specific conditions:

1. The Center Vector ($\mathbf{C}$)

This is a 3D position vector that determines the location of the ellipse's center. If the center is at $(h, k, m)$, then $\mathbf{C} = \begin{pmatrix} h \ k \ m \end{pmatrix}$.

2. Semi-Axis Vectors ($\mathbf{U}$ and $\mathbf{V}$)

These two vectors define the shape and orientation of the ellipse in space.

  • Orthogonality: $\mathbf{U}$ and $\mathbf{V}$ must be orthogonal to each other. This means their dot product must be zero: $\mathbf{U} \cdot \mathbf{V} = 0$. This condition ensures that $\mathbf{U}$ and $\mathbf{V}$ correspond to the actual perpendicular axes of the ellipse, forming the plane in which the ellipse lies.
  • Magnitude: The magnitude (length) of $\mathbf{U}$ determines the length of one semi-axis, and the magnitude of $\mathbf{V}$ determines the length of the other semi-axis. Let $a = |\mathbf{U}|$ and $b = |\mathbf{V}|$ be the semi-axis lengths. These correspond to the 'width' $|a|$ and 'height' $|b|$ from a 2D context, now extended to 3D space.
Component Description Example (Conceptual)
$\mathbf{C}$ 3D vector for the ellipse's center. $(1, 2, 3)$
$\mathbf{U}$ 3D vector for first semi-axis (direction & length $a$). $(2, 0, 0)$ (length $a=2$, along x-axis)
$\mathbf{V}$ 3D vector for second semi-axis (direction & length $b$), must be orthogonal to $\mathbf{U}$. $(0, 3, 0)$ (length $b=3$, along y-axis)
$t$ Parameter from $0$ to $2\pi$ for tracing the curve. Angle in radians

Relationship to 2D Ellipse Parameterization

The 3D parameterization is a direct extension of the 2D case. In 2D, an ellipse centered at $(h,k)$ with semi-axes $a$ and $b$ aligned with the x and y axes is given by:
$x(t) = a \cos(t) + h$
$y(t) = b \sin(t) + k$

This can be written in vector form as:
$\mathbf{P}(t) = \begin{pmatrix} h \ k \end{pmatrix} + \begin{pmatrix} a \ 0 \end{pmatrix} \cos(t) + \begin{pmatrix} 0 \ b \end{pmatrix} \sin(t)$

Here, $\mathbf{C} = \begin{pmatrix} h \ k \end{pmatrix}$, $\mathbf{U} = \begin{pmatrix} a \ 0 \end{pmatrix}$, and $\mathbf{V} = \begin{pmatrix} 0 \ b \end{pmatrix}$.
Notice that $\mathbf{U}$ and $\mathbf{V}$ are orthogonal ($\begin{pmatrix} a \ 0 \end{pmatrix} \cdot \begin{pmatrix} 0 \ b \end{pmatrix} = 0$) and their magnitudes are $a$ and $b$, respectively. The 3D form simply generalizes these vectors to three dimensions.

Steps to Parameterize an Ellipse in 3D

To explicitly define a 3D ellipse:

  1. Define the Center Point ($\mathbf{C}$): Choose the 3D coordinates $(C_x, C_y, C_z)$ for the center of your ellipse.

    • Example: $\mathbf{C} = \begin{pmatrix} 1 \ 2 \ 3 \end{pmatrix}$
  2. Define the Semi-Axis Vectors ($\mathbf{U}$ and $\mathbf{V}$):

    • Choose a 3D vector $\mathbf{U}$ that determines the direction and length of the first semi-axis.
      • Example: For a semi-axis of length 4 along the global X-axis, $\mathbf{U} = \begin{pmatrix} 4 \ 0 \ 0 \end{pmatrix}$.
    • Choose another 3D vector $\mathbf{V}$ that determines the direction and length of the second semi-axis.
      • This vector must be orthogonal to $\mathbf{U}$ (i.e., $\mathbf{U} \cdot \mathbf{V} = 0$).
      • Example: If $\mathbf{U} = \begin{pmatrix} 4 \ 0 \ 0 \end{pmatrix}$, then $\mathbf{V}$ could be $\begin{pmatrix} 0 \ 5 \ 0 \end{pmatrix}$ (length 5 along Y-axis) or $\begin{pmatrix} 0 \ 0 \ 5 \end{pmatrix}$ (length 5 along Z-axis) or any vector in the YZ plane orthogonal to $\mathbf{U}$. Let's pick $\mathbf{V} = \begin{pmatrix} 0 \ 5 \ 0 \end{pmatrix}$.
  3. Construct the Parametric Equation: Substitute your chosen $\mathbf{C}$, $\mathbf{U}$, and $\mathbf{V}$ into the general formula.

    • Using the examples above:
      $\mathbf{P}(t) = \begin{pmatrix} 1 \ 2 \ 3 \end{pmatrix} + \begin{pmatrix} 4 \ 0 \ 0 \end{pmatrix} \cos(t) + \begin{pmatrix} 0 \ 5 \ 0 \end{pmatrix} \sin(t)$

    This expands to component form:
    $x(t) = 1 + 4 \cos(t)$
    $y(t) = 2 + 5 \sin(t)$
    $z(t) = 3$

This particular example describes an ellipse centered at $(1,2,3)$, lying in the plane $z=3$, with a semi-major axis of length 5 along the y-axis and a semi-minor axis of length 4 along the x-axis.

Practical Insights and Examples

Example 1: Ellipse in a Plane Parallel to XY-Plane

  • Center: $\mathbf{C} = \begin{pmatrix} 0 \ 0 \ 5 \end{pmatrix}$
  • Semi-axis 1 (length 3, along X-axis): $\mathbf{U} = \begin{pmatrix} 3 \ 0 \ 0 \end{pmatrix}$
  • Semi-axis 2 (length 2, along Y-axis): $\mathbf{V} = \begin{pmatrix} 0 \ 2 \ 0 \end{pmatrix}$
    • ($\mathbf{U} \cdot \mathbf{V} = 0$)
  • Equation: $\mathbf{P}(t) = \begin{pmatrix} 0 \ 0 \ 5 \end{pmatrix} + \begin{pmatrix} 3 \ 0 \ 0 \end{pmatrix} \cos(t) + \begin{pmatrix} 0 \ 2 \ 0 \end{pmatrix} \sin(t)$
    • $x(t) = 3 \cos(t)$
    • $y(t) = 2 \sin(t)$
    • $z(t) = 5$

Example 2: Tilted Ellipse in 3D Space

To create a tilted ellipse, the semi-axis vectors $\mathbf{U}$ and $\mathbf{V}$ need to point in arbitrary 3D directions while remaining orthogonal.

  • Center: $\mathbf{C} = \begin{pmatrix} 1 \ 1 \ 1 \end{pmatrix}$
  • Semi-axis 1 (length 4): Let's choose a vector not aligned with an axis. $\mathbf{U} = \begin{pmatrix} 4/\sqrt{2} \ 4/\sqrt{2} \ 0 \end{pmatrix} = \begin{pmatrix} 2.828 \ 2.828 \ 0 \end{pmatrix}$ (length is $\sqrt{(4/\sqrt{2})^2 + (4/\sqrt{2})^2} = \sqrt{8+8} = \sqrt{16} = 4$)
  • Semi-axis 2 (length 2): This vector must be orthogonal to $\mathbf{U}$. A simple orthogonal vector in the XY plane would be $\begin{pmatrix} -1 \ 1 \ 0 \end{pmatrix}$, normalized and scaled to length 2.
    • Unit vector orthogonal to $\mathbf{U}$ (in XY plane): $\begin{pmatrix} -1/\sqrt{2} \ 1/\sqrt{2} \ 0 \end{pmatrix}$.
    • Scaled to length 2: $\mathbf{V} = \begin{pmatrix} -2/\sqrt{2} \ 2/\sqrt{2} \ 0 \end{pmatrix} = \begin{pmatrix} -1.414 \ 1.414 \ 0 \end{pmatrix}$.
    • Check orthogonality: $\mathbf{U} \cdot \mathbf{V} = (4/\sqrt{2})(-2/\sqrt{2}) + (4/\sqrt{2})(2/\sqrt{2}) + 0 = -8/2 + 8/2 = 0$.
  • Equation: $\mathbf{P}(t) = \begin{pmatrix} 1 \ 1 \ 1 \end{pmatrix} + \begin{pmatrix} 4/\sqrt{2} \ 4/\sqrt{2} \ 0 \end{pmatrix} \cos(t) + \begin{pmatrix} -2/\sqrt{2} \ 2/\sqrt{2} \ 0 \end{pmatrix} \sin(t)$
    • $x(t) = 1 + (4/\sqrt{2}) \cos(t) - (2/\sqrt{2}) \sin(t)$
    • $y(t) = 1 + (4/\sqrt{2}) \cos(t) + (2/\sqrt{2}) \sin(t)$
    • $z(t) = 1$

This ellipse lies in the plane $z=1$ but is rotated 45 degrees relative to the X and Y axes.

For Ellipses in Arbitrary Planes

If the ellipse needs to be in an arbitrary 3D plane, you typically first define an orthonormal basis for that plane (two orthogonal unit vectors, say $\mathbf{e_1}$ and $\mathbf{e_2}$) and then scale them by the desired semi-axis lengths $a$ and $b$:
$\mathbf{U} = a \mathbf{e_1}$
$\mathbf{V} = b \mathbf{e_2}$

And the equation becomes:
$\mathbf{P}(t) = \mathbf{C} + a \mathbf{e_1} \cos(t) + b \mathbf{e_2} \sin(t)$

This method allows for full control over the ellipse's position, orientation, and dimensions in any 3D space.