-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgeometry.h
36 lines (26 loc) · 1007 Bytes
/
geometry.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
35
36
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <float.h>
#include "types.h"
#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
#define FLT_DELTA 0.000000000000001
#define FLT_LARGE 10000000000000000.0
int f_eq(float a, float b);
int f_gt_eq(float a, float b);
int f_lt_eq(float a, float b);
float cos_cache(int angle);
float sin_cache(int angle);
void bisect_line(struct point *pt, struct line *line);
float dist(struct point *p1, struct point *p2);
float mag(struct point *pt);
void norm(struct point *pt);
void get_equation(struct line *l, struct line_eq *eq);
void get_intersection(struct line_eq *l1, struct line_eq *l2,
struct point *itsec);
int ray_intersects(struct ray *ray, struct line *line, struct point *itsec);
int intersect(struct line *l1, struct line *l2, struct point *p);
int intersect_seg_line(struct line *seg, struct line *line, struct point *p);
void print_point(struct point *p);
void print_line(struct line *line);