H2Lib  3.0
Data Structures | Typedefs | Functions
curve2d

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 curve2dpcurve2d
 Abbreviation for a pointer to a curve2d object.
 
typedef const curve2dpccurve2d
 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 $ n $ edges and radius $ r $ around the origin. More...
 
pcurve2d new_square_curve2d (uint edges, real a)
 Create a new square with $ n $ edges and edge length $ a $ around the origin. More...
 
pcurve2d new_hilbert_curve2d (uint n, real l)
 Create a new Hilbert-curve of order $ n $. and edge length $ l $ around the origin. More...
 
pcurve2d new_star_curve2d (uint edges, real r)
 Create a new polygon of a star with 16 spikes, $ n $ edges and radius $ r $ 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...
 

Detailed Description

Representation of a 2D curve by using a polygon.

This module offers basic functions to create, load and save polygons curves.

Function Documentation

void del_curve2d ( pcurve2d  gr)

Free Storage allocated for a curve2d object.

Parameters
grCurve2d object to be deleted.
void draw_curve2d ( pccurve2d  gr,
cairo_t *  cr,
real  scale 
)

Draw the polygon to a cairo surface.

Parameters
grCurve2d object to be drawn.
crCairo surface to be drawn on.
scaleSet the linewidth for the drawing.
pcurve2d new_circle_curve2d ( uint  edges,
real  r 
)

Create a new polygon approximation of a circle with $ n $ edges and radius $ r $ around the origin.

Parameters
edgesThe number of edges $n$ for the circle approximation.
rThe radius $r$ of the circle approximation.
Returns
Returns a new curve2d object, which is an approximation of a circle of radius $r$.
pcurve2d new_curve2d ( uint  vertices,
uint  edges 
)

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.

Parameters
verticesNumber of vertices for the new polygon object.
edgesNumber of edges for the new polygon object.
Returns
The newly created curve2d object is returned.
pcurve2d new_hilbert_curve2d ( uint  n,
real  l 
)

Create a new Hilbert-curve of order $ n $. and edge length $ l $ around the origin.

The number of edges for a Hilbert-curve of order $ n $ is $2^{2n} $. The number of vertices for a Hilbert-curve of order $n$ is $2^{2n}-1$. The Hilbert-curve is NOT closed.

Parameters
nThe order of the Hilbert-curve.
lThe edge length $l$ of the Hilbert-curve.
Returns
Returns a new curve2d object, which is a Hilbert-curve with edge length $l$.
pcurve2d new_square_curve2d ( uint  edges,
real  a 
)

Create a new square with $ n $ edges and edge length $ a $ around the origin.

Parameters
edgesThe number of edges $n$ for the square.
aThe edge length $a$ of the square.
Returns
Returns a new curve2d object, which is a square with edge length $a$.
pcurve2d new_star_curve2d ( uint  edges,
real  r 
)

Create a new polygon of a star with 16 spikes, $ n $ edges and radius $ r $ around the origin.

The spikes of the star lie on a circle with radius $r$, the inner dips lie on a circle of radius $r/4$.

Parameters
edgesThe number of edges $n$ for the star. The number of edges have to be a multiple of 16.
rThe outer radius $r$ of the star.
Returns
Returns a new curve2d object, which is a star of radius $r$.
void prepare_curve2d ( pcurve2d  gr)

This function computes the normal vectors n , the gram determinants g from the geometrical information.

Parameters
grGeometry to be prepared.
void print_curve2d ( pccurve2d  gr)

print geometrical information to stdout.

Parameters
grCurve2d object to be printed out.