Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

c distance in the cartesian plane

#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: #distance #cartesian #plane
ADD COMMENT
Topic
Name
7+9 =