H2Lib
3.0
|
Representation of a 2D curve by using a polygon. More...
Data Structures | |
struct | _curve2d |
Representation of a polygon in 2D. More... | |
Typedefs | |
typedef struct _curve2d | curve2d |
Abbreviation for struct _curve2d . | |
typedef curve2d * | pcurve2d |
Abbreviation for a pointer to a curve2d object. | |
typedef const curve2d * | pccurve2d |
Abbreviation for a pointer to constant a curve2d object. | |
Functions | |
pcurve2d | new_curve2d (uint vertices, uint edges) |
create a new curve2d object with a certain number of vertice and edges. More... | |
void | prepare_curve2d (pcurve2d gr) |
This function computes the normal vectors n , the gram determinants g from the geometrical information. More... | |
void | del_curve2d (pcurve2d gr) |
Free Storage allocated for a curve2d object. More... | |
pcurve2d | new_circle_curve2d (uint edges, real r) |
Create a new polygon approximation of a circle with edges and radius around the origin. More... | |
pcurve2d | new_square_curve2d (uint edges, real a) |
Create a new square with edges and edge length around the origin. More... | |
pcurve2d | new_hilbert_curve2d (uint n, real l) |
Create a new Hilbert-curve of order . and edge length around the origin. More... | |
pcurve2d | new_star_curve2d (uint edges, real r) |
Create a new polygon of a star with 16 spikes, edges and radius around the origin. More... | |
void | print_curve2d (pccurve2d gr) |
print geometrical information to stdout. More... | |
void | draw_curve2d (pccurve2d gr, cairo_t *cr, real scale) |
Draw the polygon to a cairo surface. More... | |
Representation of a 2D curve by using a polygon.
This module offers basic functions to create, load and save polygons curves.
void del_curve2d | ( | pcurve2d | gr | ) |
Draw the polygon to a cairo surface.
gr | Curve2d object to be drawn. |
cr | Cairo surface to be drawn on. |
scale | Set the linewidth for the drawing. |
Create a new polygon approximation of a circle with edges and radius around the origin.
edges | The number of edges for the circle approximation. |
r | The radius of the circle approximation. |
create a new curve2d object with a certain number of vertice and edges.
This function will allocated storage for the members x
, e
, n
and g
of the struct curve2d.
vertices | Number of vertices for the new polygon object. |
edges | Number of edges for the new polygon object. |
Create a new Hilbert-curve of order . and edge length around the origin.
The number of edges for a Hilbert-curve of order is . The number of vertices for a Hilbert-curve of order is . The Hilbert-curve is NOT closed.
n | The order of the Hilbert-curve. |
l | The edge length of the Hilbert-curve. |
Create a new square with edges and edge length around the origin.
edges | The number of edges for the square. |
a | The edge length of the square. |
Create a new polygon of a star with 16 spikes, edges and radius around the origin.
The spikes of the star lie on a circle with radius , the inner dips lie on a circle of radius .
edges | The number of edges for the star. The number of edges have to be a multiple of 16. |
r | The outer radius of the star. |
void prepare_curve2d | ( | pcurve2d | gr | ) |
This function computes the normal vectors n
, the gram determinants g
from the geometrical information.
gr | Geometry to be prepared. |