Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/raymath.h
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,15 @@ RMAPI float Vector2Distance(Vector2 v1, Vector2 v2)
return result;
}

// Calculate a vector with a distance and angle
// Angle is in radians (full rotation is 2.0f * PI), starts up and goes clockwise
RMAPI Vector2 Vector2DistanceAngle(float distance, float angle)
{
Vector2 result = { distance*cosf(-(angle - (PI*0.5f))), distance*-sinf(-(angle - (PI*0.5f))) };

return result;
}

// Calculate square distance between two vectors
RMAPI float Vector2DistanceSqr(Vector2 v1, Vector2 v2)
{
Expand Down
Loading