Transformations

This sections is about transformations in already made formations

Motivation

Besides allowing the user to set desired formations, it's important to make operations that can edit the disposition of the drones and the formation itself. Therefore, some transformation procedures were developed, so that it's possible to translate, scale and rotate the whole formation.

Don't worry that the possible collisions that could be caused by these moves will be avoided by our collision avoidance algorithm.

Inside the code

In order to create the three transformations, it was based on matrix operations, generating a 4x4 matrix that multiplies the current coordinates of each drone, resulting in a 4x1 matrix. The calculations for each transformation are shown below.

After finding the updated values of the desired coordinates for each drone, some adjustments are made intending to complete the transformation process, so the current position of the drone must be taken into account. The biggest challenge is the rotation operation because the formation has to be centered on the origin of the map, to achieve this, the formation is translated to the needed point, the rotation is applied and then the new arrangement is translated back to its initial position.

The operations

Scale

Translate

Rotate

Last updated