H2Lib  3.0
curve2d.h
Go to the documentation of this file.
1 /* ------------------------------------------------------------
2  This is the file "curve2d.h" of the H2Lib package.
3  All rights reserved, Steffen Boerm 2010
4  ------------------------------------------------------------ */
5 
9 #ifndef CURVE2D_H
10 #define CURVE2D_H
11 
25 typedef struct _curve2d curve2d;
26 
30 typedef curve2d *pcurve2d;
31 
35 typedef const curve2d *pccurve2d;
36 
37 #ifdef USE_CAIRO
38 #include <cairo/cairo.h>
39 #endif
40 
41 #include "settings.h"
42 
46 struct _curve2d {
51 
53  real (*x)[2];
55  uint (*e)[2];
56 
58  real (*n)[2];
61 };
62 
63 /* ------------------------------------------------------------
64  constructors / destructors
65  ------------------------------------------------------------ */
66 
80 
87 HEADER_PREFIX void
89 
95 HEADER_PREFIX void
97 
98 /* ------------------------------------------------------------
99  curve creation
100  ------------------------------------------------------------ */
101 
113 
125 
141 
156 
157 /* ------------------------------------------------------------
158  output functions
159  ------------------------------------------------------------ */
160 
166 HEADER_PREFIX void
168 
169 #ifdef USE_CAIRO
170 
177 HEADER_PREFIX void
178 draw_curve2d(pccurve2d gr, cairo_t *cr, real scale);
179 #endif
180 
185 #endif
void draw_curve2d(pccurve2d gr, cairo_t *cr, real scale)
Draw the polygon to a cairo surface.
const curve2d * pccurve2d
Abbreviation for a pointer to constant a curve2d object.
Definition: curve2d.h:35
pcurve2d new_hilbert_curve2d(uint n, real l)
Create a new Hilbert-curve of order . and edge length around the origin.
Representation of a polygon in 2D.
Definition: curve2d.h:46
unsigned uint
Unsigned integer type.
Definition: settings.h:70
pcurve2d new_square_curve2d(uint edges, real a)
Create a new square with edges and edge length around the origin.
pcurve2d new_circle_curve2d(uint edges, real r)
Create a new polygon approximation of a circle with edges and radius around the origin...
curve2d * pcurve2d
Abbreviation for a pointer to a curve2d object.
Definition: curve2d.h:30
void del_curve2d(pcurve2d gr)
Free Storage allocated for a curve2d object.
pcurve2d new_curve2d(uint vertices, uint edges)
create a new curve2d object with a certain number of vertice and edges.
#define HEADER_PREFIX
Prefix for function declarations.
Definition: settings.h:43
double real
real floating point type.
Definition: settings.h:97
pcurve2d new_star_curve2d(uint edges, real r)
Create a new polygon of a star with 16 spikes, edges and radius around the origin.
void print_curve2d(pccurve2d gr)
print geometrical information to stdout.
real(* x)[2]
Vertex coordinates.
Definition: curve2d.h:53
real * preal
Pointer to real array.
Definition: settings.h:145
uint edges
Number of edges.
Definition: curve2d.h:50
void prepare_curve2d(pcurve2d gr)
This function computes the normal vectors n , the gram determinants g from the geometrical informatio...
preal g
Edge lengths = gram determinants.
Definition: curve2d.h:60
uint vertices
Number of vertices.
Definition: curve2d.h:48
uint(* e)[2]
Edge vertices.
Definition: curve2d.h:55
real(* n)[2]
Normal vectors.
Definition: curve2d.h:58