*3.1. 2D Trajectories*

Here we will examine several illustrative examples of the properties of Bernstein polynomials and rational Bernstein polynomials in 2D. All the plots presented can be generated using the example code available at [40].

Figures 1–9 contain several examples of 2D trajectories in the spatial domain. Two trajectories are plotted in Figure 1 along with an obstacle. The trajectories **C**[1] (*t*) and **C**[2] (*t*) are defined as in Equation (5) with *t*<sup>0</sup> = 10 s and *tf* = 20 s where the Bernstein coefficients are temporally equidistant. The vector of Bernstein coefficients of trajectory **C**[1] (*t*) is

$$\mathbf{P}\_5^{[1]} = \begin{bmatrix} 0 & 2 & 4 & 6 & 8 & 10 \\ 5 & 0 & 2 & 3 & 10 & 3 \end{bmatrix}.$$

The vector of Bernstein coefficients of trajectory **C**[2] (*t*) is

> **<sup>P</sup>**[2] <sup>5</sup> = 1 3 6 8 10 12 6 9 10 11 8 8 .

The circular obstacle has a radius of 1 and is centered at point [3, 4] -. Figure 2 highlights the endpoints property (Property A2). Note that the trajectory **C**[1] (*t*) passes through its first and last Bernstein coefficients **<sup>P</sup>**[1] 0,5 = [0, 5] and [10, 3] -, respectively. Likewise, the trajectory **C**[2] (*t*) passes through its first and last Bernstein coefficients [1, 6] - and [12, 8] -, respectively. The convex hull property (Property A1) is illustrated in Figure 3.

Useful operations can be efficiently performed on Bernstein polynomials by manipulating only their coefficients. The de Casteljau algorithm (Property A5) allows one to split a Bernstein polynomial into two separate polynomials. This is shown in Figure 4 where trajectories **C**[1] (*t*) and **C**[2] (*t*) are split at *tdiv* = 15 s. Degree elevation (Property A6) is performed on both trajectories in Figure 5. Note that in both Figures 4 and 5, the convex hulls are more accurate than the conservative convex hulls in Figure 3. This idea will be expanded upon in the next section.

**Figure 1.** Spatial representation of two Bernstein polynomial trajectories in 2D near a circular obstacle. Trajectory **C**[1] (*t*) is drawn in blue and trajectory **C**[2] (*t*) is drawn in orange. The solid lines are the polynomials and the dashed lines connect the Bernstein coefficients for convenience. Note that the temporal aspect of the trajectories above has been omitted for clarity of presenting the geometric properties of Bernstein polynomials.

**Figure 2.** Trajectories **C**[1] (*t*) (blue) and **C**[2] (*t*) (orange) with their endpoints highlighted in 2D.

**Figure 3.** Convex hulls drawn as black dotted lines around the Bernstein coefficients of trajectories **C**[1] (*t*) (blue) and **C**[2] (*t*) (orange). The dashed lines connect the control points of their corresponding trajectories.

**Figure 4.** Trajectories **C**[1] (*t*) (split into blue and green) and **C**[2] (*t*) (split into orange and red) split at *tdiv* = 15 s. Convex hulls are drawn around the Bernstein coefficients of the new split trajectories.

**Figure 5.** Convex hull drawn around the elevated Bernstein coefficients of trajectories **C**[1] (*t*) (blue) and **C**[2] (*t*) (orange).

**Figure 6.** Squared speed of the trajectories **C**[1] (*t*) and **C**[2] (*t*). A convex hull is drawn around the Bernstein coefficients. Note that even though the coefficients may be negative, the actual curve is not.

**Figure 7.** Illustration of the quantity expressed in Equation (8) for trajectories **C**[1] (*t*) and **C**[2] (*t*).

**Figure 8.** Angular rates of trajectories **C**[1] (*t*) and **C**[2] (*t*). Note that the angular rates are rational Bernstein polynomials.

**Figure 9.** Squared distance between trajectories and the center of the circular obstacle.

Bernstein polynomials can also be used to extract useful information about the dynamics of the trajectories. In Figure 6, Bernstein polynomials representing the squared speed of trajectories **C**[1] (*t*)=[*x*[1] (*t*), *y*[1] (*t*)] and **C**[2] (*t*)=[*x*[2] (*t*), *y*[2] (*t*)] are shown along with their corresponding coefficients and convex hulls. The squared speed is computed using the derivative and arithmetic operation properties (Properties A3 and A7) as follows

$$(\upsilon^{[1]}(t))^2 = (\dot{\mathfrak{x}}^{[1]}(t))^2 + (\dot{y}^{[1]}(t))^2$$

Note that the squared speed of a trajectory described by a Bernstein polynomial is also a Bernstein polynomial.

Letting **C**[1] (*t*)=[*x*[1] (*t*), *y*[1] (*t*)]-, the heading angle *ψ*(*t*) of a trajectory can be computed as

$$\psi^{[1]}(t) = \tan^{-1}\left(\frac{\dot{y}^{[1]}(t)}{\dot{x}^{[1]}(t)}\right). \tag{7}$$

Since the inverse tangent of a Bernstein polynomial is not a Bernstein polynomial, we take the tangent of both sides of the equation, yielding

$$\tan(\psi^{[1]}(t)) = \left(\frac{\dot{y}^{[1]}(t)}{\dot{x}^{[1]}(t)}\right)'\tag{8}$$

which is a rational Bernstein polynomial. Figure 7 illustrates the quantity expressed in Equation (8) computed for trajectories **C**[1] (*t*) and **C**[2] (*t*).

To determine the angular rate along the trajectory at any point in *t* ∈ [*t*0, *tf* ], we can take the derivative of the heading angle, yielding

$$
\omega^{[1]}(t) = \psi^{[1]}(t) = \frac{\dot{x}^{[1]}(t)\ddot{y}^{[1]}(t) - \ddot{x}^{[1]}(t)\dot{y}^{[1]}(t)}{(\dot{x}^{[1]}(t))^2 + (\dot{y}^{[1]}(t))^2}.\tag{9}
$$

Since the angular rate can be determined using Properties A3 and A7, it can be represented as a rational Bernstein polynomial. The angular rates of trajectories **C**[1] (*t*) and **C**[2] (*t*) are shown in Figure 8.

Finally, the Bernstein polynomial representing the squared distance between two trajectories at every point in time can be computed from

$$\begin{aligned} d^2(t) &= (x^{[2]}(t) - x^{[1]}(t))^2 + (y^{[2]}(t) - y^{[1]}(t))^2, \\ &\quad \forall t \in [t\_0, t\_f] \end{aligned} \tag{10}$$

The center point of a circular, static obstacle **Obs**(*t*), can be represented as a Bernstein polynomial whose coefficients are all identical and set to the position of the obstacle, i.e.,

$$\mathbf{p}^{[\text{Obs}]} = \begin{bmatrix} \mathbf{x}^{[\text{Obs}]} & \cdots & \mathbf{x}^{[\text{Obs}]} \\ \mathbf{y}^{[\text{Obs}]} & \cdots & \mathbf{y}^{[\text{Obs}]} \end{bmatrix}.$$

The degree of the Bernstein polynomial representing the center point of the circular obstacle is equal to that of the order of the Bernstein polynomials representing the trajectories.

#### *3.2. 3D Trajectories*

We now introduce two 3D Bernstein polynomials with *t*<sup>0</sup> = 10 s and *tf* = 20 s, where the coefficients are equidistant in time, and illustrate their properties in Figures 10–17. The Bernstein coefficients of trajectory **C**[3] (*t*) are

$$\mathbf{P}\_5^{[3]} = \begin{bmatrix} 7 & 3 & 1 & 1 & 3 & 7 \\ 1 & 2 & 3 & 8 & 3 & 5 \\ 0 & 2 & 1 & 9 & 8 & 10 \end{bmatrix} \prime$$

and the Bernstein coefficients of trajectory **C**[4] (*t*) are


These polynomials are drawn in Figure 10.

**Figure 10.** Two 3D Bernstein polynomial trajectories near a spherical obstacle. Trajectory **C**[3] (*t*) is drawn in blue and trajectory **C**[4] (*t*) is drawn in orange.

Similar to the 2D examples, Figures 11–14 illustrate the end points, convex hull, de Casteljau, and elevation properties, respectively. Figures 15 and 16 show the squared speed and squared acceleration of trajectories **C**[3] (*t*) and **C**[4] (*t*), respectively. These values were computed using the derivative and arithmetic properties. Finally, Figure 17 shows the squared Euclidean distance between the trajectories and the center of the spherical obstacle at every point in time. The distance was found using Property A7.

**Figure 11.** 3D trajectories **C**[3] (*t*) and **C**[4] (*t*) with their endpoints highlighted.

**Figure 12.** 3D convex hulls drawn as transparent blue surfaces around the Bernstein coefficients of trajectories **C**[3] (*t*) and **C**[4] (*t*).

**Figure 13.** Trajectories **C**[3] (*t*) and **C**[4] (*t*) split at *tdiv* = 15 s. Convex hulls are drawn around the Bernstein coefficients of the new split trajectories.

**Figure 14.** Convex hull drawn around the elevated Bernstein coefficients of trajectories **C**[3] (*t*) and **C**[4] (*t*).

**Figure 15.** Squared speed of the trajectories **C**[3] (*t*) and **C**[4] (*t*). A convex hull is drawn around the Bernstein coefficients. Note that even though the coefficients may be negative, the actual curve is not.

**Figure 16.** Squared acceleration of the trajectories **C**[3] (*t*) and **C**[4] (*t*) with corresponding convex hulls.

**Figure 17.** Squared distances between the trajectories and then center of the spherical obstacle.
