Mapper  0.9.0
API documentation
Classes | Typedefs | Functions
geometry.h File Reference

(c9e89e9 on 26 Jul 2017)

#include "types.h"
Include dependency graph for geometry.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  _Path
 
struct  _Transform
 

Typedefs

typedef struct _Path Path
 
typedef struct _Transform Transform
 

Functions

int path_alloc (Path **ppath, u32 npts)
 Allocates a path with room for a given number of points. More...
 
void path_map (Path *path, const Transform *mx)
 Transforms all the points in a path according to the given matrix. More...
 
bool path_unmap (Path *path, const Transform *mx)
 Transforms all the points in a path according to the inverse of the given matrix. More...
 
void matrix_clear (Transform *matrix)
 Resets the matrix to the identity matrix. More...
 
void matrix_translate (Transform *matrix, double dx, double dy)
 Translates the matrix by a given amount. More...
 
void matrix_rotate (Transform *matrix, double angle)
 Rotates the matrix counterclockwise around the origin by the given angle, in degrees. More...
 
void matrix_rotate_point (Transform *matrix, double x, double y, double angle)
 Rotates the matrix counterclockwise around the given point by the given angle, in degrees. More...
 
void matrix_scale (Transform *matrix, double sx, double sy)
 Scales the matrix by the given amount on each axis. More...
 
void matrix_map (const Transform *matrix, const double *pts, double *opts, int count)
 Maps a contiguous set of points from one array to another. More...
 
bool matrix_unmap (const Transform *matrix, const double *pts, double *opts, int count)
 Maps a contiguous set of points from one array to another, using the inverse of the provided matrix. More...
 
bool matrix_invert (Transform *dest, const Transform *src)
 Replaces the destination matrix with the inverse of the source matrix. More...
 
void matrix_dump (const Transform *mx)
 

Typedef Documentation

◆ Path

typedef struct _Path Path

◆ Transform

typedef struct _Transform Transform

Function Documentation

◆ matrix_clear()

void matrix_clear ( Transform matrix)

Resets the matrix to the identity matrix.

◆ matrix_dump()

void matrix_dump ( const Transform mx)

◆ matrix_invert()

bool matrix_invert ( Transform dest,
const Transform src 
)

Replaces the destination matrix with the inverse of the source matrix.

Returns TRUE if successful, FALSE if the inversion failed because the source transform is singular.

◆ matrix_map()

void matrix_map ( const Transform matrix,
const double *  pts,
double *  opts,
int  count 
)

Maps a contiguous set of points from one array to another.

The output array may overlap, or be the same, as the input array.

◆ matrix_rotate()

void matrix_rotate ( Transform matrix,
double  angle 
)

Rotates the matrix counterclockwise around the origin by the given angle, in degrees.

◆ matrix_rotate_point()

void matrix_rotate_point ( Transform matrix,
double  x,
double  y,
double  angle 
)

Rotates the matrix counterclockwise around the given point by the given angle, in degrees.

◆ matrix_scale()

void matrix_scale ( Transform matrix,
double  sx,
double  sy 
)

Scales the matrix by the given amount on each axis.

◆ matrix_translate()

void matrix_translate ( Transform matrix,
double  dx,
double  dy 
)

Translates the matrix by a given amount.

◆ matrix_unmap()

bool matrix_unmap ( const Transform matrix,
const double *  pts,
double *  opts,
int  count 
)

Maps a contiguous set of points from one array to another, using the inverse of the provided matrix.

The output array may overlap, or be the same, as the input array. If the matrix is singular, FALSE is returned and no points are changed; otherwise all points will be mapped and TRUE is returned.

◆ path_alloc()

int path_alloc ( Path **  ppath,
u32  npts 
)

Allocates a path with room for a given number of points.

The first parameter can be non-null for a preallocated Path structure, or nullptr to create a new structure on the heap.

◆ path_map()

void path_map ( Path path,
const Transform mx 
)

Transforms all the points in a path according to the given matrix.

◆ path_unmap()

bool path_unmap ( Path path,
const Transform mx 
)

Transforms all the points in a path according to the inverse of the given matrix.

Returns TRUE if the path was mapped, FALSE if the mapping failed due to a noninvertible matrix.