Montag, 9. Juli 2012

Euclidean Distance 2D

float euclideanDistance2D(float start_x, float start_y, float end_x, float end_y) {
    float dx = Math.abs(start_x - end_x);
    float dy = Math.abs(start_y - end_y);
    return Math.sqrt(dx * dx + dy * dy);
}
This function calculates the euclidean/direct distance between two points (start, end) in the 2D plane.

Keine Kommentare:

Kommentar veröffentlichen