KiCad PCB EDA Suite
auxiliary.h File Reference
#include <stdlib.h>
#include "potracelib.h"

Go to the source code of this file.

Classes

struct  point_s
 

Macros

#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)
 
static dpoint_t interval (double lambda, dpoint_t a, dpoint_t b)
 
static int mod (int a, int n)
 
static int floordiv (int a, int n)
 

Macro Definition Documentation

◆ abs

#define abs (   a)    ( ( a ) > 0 ? ( a ) : -( a ) )

Definition at line 84 of file auxiliary.h.

◆ cu

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

Definition at line 88 of file auxiliary.h.

◆ max

#define max (   a,
 
)    ( ( a ) > ( b ) ? ( a ) : ( b ) )

Definition at line 86 of file auxiliary.h.

◆ min

#define min (   a,
 
)    ( ( a ) < ( b ) ? ( a ) : ( b ) )

Definition at line 85 of file auxiliary.h.

◆ sign

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

Definition at line 83 of file auxiliary.h.

◆ sq

#define sq (   a)    ( ( a ) * ( a ) )

Definition at line 87 of file auxiliary.h.

Typedef Documentation

◆ dpoint_t

Definition at line 29 of file auxiliary.h.

◆ point_t

typedef struct point_s point_t

Definition at line 27 of file auxiliary.h.

Function Documentation

◆ dpoint()

static dpoint_t dpoint ( point_t  p)
inlinestatic

Definition at line 32 of file auxiliary.h.

33 {
34  dpoint_t res;
35 
36  res.x = p.x;
37  res.y = p.y;
38  return res;
39 }
long y
Definition: auxiliary.h:25
long x
Definition: auxiliary.h:24

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

◆ floordiv()

static int floordiv ( int  a,
int  n 
)
inlinestatic

Definition at line 70 of file auxiliary.h.

71 {
72  return a >= 0 ? a / n : -1 - ( -1 - a ) / n;
73 }

Referenced by calc_lon().

◆ interval()

static dpoint_t interval ( double  lambda,
dpoint_t  a,
dpoint_t  b 
)
inlinestatic

Definition at line 43 of file auxiliary.h.

44 {
45  dpoint_t res;
46 
47  res.x = a.x + lambda * ( b.x - a.x );
48  res.y = a.y + lambda * ( b.y - a.y );
49  return res;
50 }

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

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

◆ mod()

static int mod ( int  a,
int  n 
)
inlinestatic

Definition at line 64 of file auxiliary.h.

65 {
66  return a >= n ? a % n : a >= 0 ? a : n - 1 - ( -1 - a ) % n;
67 }