Data Structures Lerax  v3.0-104-ge031
Opinionated Data Structures & Algorithms
Loading...
Searching...
No Matches
point.h
Go to the documentation of this file.
1
12
13#ifndef POINT_H
14#define POINT_H
15
19struct Point {
20 float x;
21 float y;
22};
23
24
28typedef struct Point Point;
29
36Point* point_create(float x, float y);
37
44
49void point_set(Point *p, float x, float y);
50
55void point_get(Point *p, float *x, float *y);
56
62
68
73void point_copy(Point *origin, Point *destination);
74
81float point_distance(Point *px, Point *py);
82
83#endif
float point_distance(Point *px, Point *py)
calculate the euclidean distance between two points
void point_copy(Point *origin, Point *destination)
Copy point origin to destination.
Point * point_create(float x, float y)
create a new Point and set x an y
void point_set(Point *p, float x, float y)
Set the values of p.x and p.y.
void point_free(Point *p)
free memory for the Point p
void point_get(Point *p, float *x, float *y)
Get the values of p.x and p.y through the pointers *x and *y.
float point_get_x(Point *p)
Get the x value.
float point_get_y(Point *p)
Get the y value.
struct Point as 2D space pointer.
Definition point.h:19
float x
Definition point.h:20
float y
Definition point.h:21