pcb 4.1.1
An interactive printed circuit board layout editor.

auxiliary.h File Reference

This header file collects some general-purpose macros (and static inline functions) that are used in various places. More...

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

Go to the source code of this file.

Data Structures

struct  point_s

Defines

#define sign(x)   ((x)>0 ? 1 : (x)<0 ? -1 : 0)
#define abs(a)   ((a)>0 ? (a) : -(a))
#define min(a, b)   ((a)<(b) ? (a) : (b))
#define max(a, b)   ((a)>(b) ? (a) : (b))
#define sq(a)   ((a)*(a))
#define cu(a)   ((a)*(a)*(a))

Typedefs

typedef struct point_s point_t
typedef potrace_dpoint_t dpoint_t

Functions

static dpoint_t dpoint (point_t p)
 Convert point_t to dpoint_t.
static dpoint_t interval (double lambda, dpoint_t a, dpoint_t b)
 Range over the straight line segment [a,b] when lambda ranges over [0,1].
static int mod (int a, int n)
 
static int floordiv (int a, int n)
 The "floordiv" macro returns the largest integer <= a/n, and again this works correctly for negative a, as long as a,n are integers and n>0.

Detailed Description

This header file collects some general-purpose macros (and static inline functions) that are used in various places.


Copyright.


PCB, interactive printed circuit board design

Copyright (C) 2001-2007 Peter Selinger.

This file is part of Potrace. It is free software and it is covered by the GNU General Public License. See the file COPYING for details.

Definition in file auxiliary.h.


Define Documentation

#define cu (   a)    ((a)*(a)*(a))

Definition at line 108 of file auxiliary.h.

#define sign (   x)    ((x)>0 ? 1 : (x)<0 ? -1 : 0)
#define sq (   a)    ((a)*(a))

Definition at line 107 of file auxiliary.h.

Referenced by adjust_vertices(), ftherm_rect_in_reg(), and opti_penalty().


Typedef Documentation

Definition at line 38 of file auxiliary.h.

typedef struct point_s point_t

Definition at line 36 of file auxiliary.h.


Function Documentation

static dpoint_t dpoint ( point_t  p) [inline, static]

Convert point_t to dpoint_t.

Definition at line 44 of file auxiliary.h.

References point_s::x, potrace_dpoint_s::x, point_s::y, and potrace_dpoint_s::y.

static int floordiv ( int  a,
int  n 
) [inline, static]

The "floordiv" macro returns the largest integer <= a/n, and again this works correctly for negative a, as long as a,n are integers and n>0.

Definition at line 91 of file auxiliary.h.

Referenced by calc_lon().

static dpoint_t interval ( double  lambda,
dpoint_t  a,
dpoint_t  b 
) [inline, static]

Range over the straight line segment [a,b] when lambda ranges over [0,1].

Definition at line 57 of file auxiliary.h.

References potrace_dpoint_s::x, and potrace_dpoint_s::y.

Referenced by opti_penalty(), opticurve(), and smooth().

static int mod ( int  a,
int  n 
) [inline, static]

The "mod" macro works correctly for negative a. Also note that the test for a>=n, while redundant, speeds up the mod function by 70% in the average case (significant since the program spends about 16% of its time here - or 40% without the test).

Definition at line 80 of file auxiliary.h.

Referenced by adjust_vertices(), bestpolygon(), calc_lon(), DumpKeys2(), opti_penalty(), opticurve(), and smooth().