blob: 991ebc617507215464c4f393f859a8c4f7f5522a (
plain)
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
|
#include <math.h>
#include "tectonics.h"
void get_cairo_size(cairo_t *cr, int *width, int *height)
{
cairo_surface_t *surface = cairo_get_target(cr);
*width = cairo_image_surface_get_width(surface);
*height = cairo_image_surface_get_height(surface);
}
double rand01()
{
return ((double) rand())/RAND_MAX;
}
double distance(struct point_t p1, struct point_t p2)
{
double dx = p1.x-p2.x;
double dy = p1.y-p2.y;
return sqrt(dx*dx + dy*dy);
}
|