-
Notifications
You must be signed in to change notification settings - Fork 1
/
point.h
34 lines (24 loc) · 843 Bytes
/
point.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
* A basic 3D point.
*/
#ifndef POINT_H
#define POINT_H
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
typedef struct point{
double x, y, z;
} point;
/* creates a new point */
point* createp(double x, double y, double z);
void setxyz(point* p, double x, double y, double z);/* Give the point the specified x, y, z */
int peq(point* p1, point* p2); /* returns true if points are equal, false if not */
/* returns true if the value is in between the specified value */
/* if inclusive is true <= will be used; < will be used if not */
int pinrng(double lower, double upper, double p, int inclusive);
/* calculates the distance between two points */
double distp(point* p1, point* p2);
/* returns a string representation of the point in standard coordinate format */
char* tostringp(point* p);
#endif