Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

calculate distance between 2 points X Y axis

#include <stdio.h>
#include <math.h>
	//math.h library for square root and power functions
	//uses pythagorean theorem to calculate distance

float Distance(float x1, float y1, float x2, float y2)
{
    return sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
}
 
PREVIOUS NEXT
Tagged: #calculate #distance #points #X #Y #axis
ADD COMMENT
Topic
Name
9+4 =