Hello,

I am using raylib in another course and this is how it is implemented:

// Calculate vector length

RMAPI float Vector2Length(Vector2 v)

{

float result = sqrtf((v.x*v.x) + (v.y*v.y));

```
return result;
```

}

// Calculate vector square length

RMAPI float Vector2LengthSqr(Vector2 v)

{

float result = (v.x*v.x) + (v.y*v.y);

```
return result;
```

}

// Calculate distance between two vectors

RMAPI float Vector2Distance(Vector2 v1, Vector2 v2)

{

float result = sqrtf((v1.x - v2.x)*(v1.x - v2.x) + (v1.y - v2.y)*(v1.y - v2.y));

```
return result;
```

}

// Calculate square distance between two vectors

RMAPI float Vector2DistanceSqr(Vector2 v1, Vector2 v2)

{

float result = ((v1.x - v2.x)*(v1.x - v2.x) + (v1.y - v2.y)*(v1.y - v2.y));

```
return result;
```

}