KiCad PCB EDA Suite
curve.h File Reference
#include "auxiliary.h"

Go to the source code of this file.

Classes

struct  privcurve_s
 
struct  sums_s
 
struct  potrace_privpath_s
 

Typedefs

typedef struct privcurve_s privcurve_t
 
typedef struct sums_s sums_t
 
typedef struct potrace_privpath_s potrace_privpath_t
 
typedef potrace_privpath_t privpath_t
 
typedef potrace_path_t path_t
 

Functions

path_tpath_new (void)
 
void path_free (path_t *p)
 
void pathlist_free (path_t *plist)
 
int privcurve_init (privcurve_t *curve, int n)
 
void privcurve_to_curve (privcurve_t *pc, potrace_curve_t *c)
 

Typedef Documentation

Definition at line 71 of file curve.h.

Definition at line 67 of file curve.h.

typedef struct privcurve_s privcurve_t

Definition at line 33 of file curve.h.

Definition at line 70 of file curve.h.

typedef struct sums_s sums_t

Definition at line 43 of file curve.h.

Function Documentation

void path_free ( path_t p)

Definition at line 58 of file curve.cpp.

References potrace_privpath_s::curve, potrace_privpath_s::lon, potrace_privpath_s::ocurve, potrace_privpath_s::po, potrace_path_s::priv, privcurve_free_members(), potrace_privpath_s::pt, and potrace_privpath_s::sums.

Referenced by bm_to_pathlist(), and pathlist_free().

59 {
60  if( p )
61  {
62  if( p->priv )
63  {
64  free( p->priv->pt );
65  free( p->priv->lon );
66  free( p->priv->sums );
67  free( p->priv->po );
70  }
71 
72  free( p->priv );
73  /* do not free p->fcurve ! */
74  }
75 
76  free( p );
77 }
static void privcurve_free_members(privcurve_t *curve)
Definition: curve.cpp:46
privcurve_t curve
Definition: curve.h:62
privcurve_t ocurve
Definition: curve.h:63
struct potrace_privpath_s * priv
Definition: potracelib.h:103
point_t * pt
Definition: curve.h:53
sums_t * sums
Definition: curve.h:57
path_t* path_new ( void  )

Definition at line 26 of file curve.cpp.

References potrace_path_s::priv, and SAFE_CALLOC.

Referenced by findpath().

27 {
28  path_t* p = NULL;
29  privpath_t* priv = NULL;
30 
31  SAFE_CALLOC( p, 1, path_t );
32  memset( p, 0, sizeof(path_t) );
33  SAFE_CALLOC( priv, 1, privpath_t );
34  memset( priv, 0, sizeof(privpath_t) );
35  p->priv = priv;
36  return p;
37 
38 calloc_error:
39  free( p );
40  free( priv );
41  return NULL;
42 }
#define SAFE_CALLOC(var, n, typ)
Definition: curve.cpp:19
struct potrace_privpath_s * priv
Definition: potracelib.h:103
void pathlist_free ( path_t plist)

Definition at line 81 of file curve.cpp.

References list_forall_unlink, and path_free().

Referenced by potrace_state_free().

82 {
83  path_t* p;
84 
85  list_forall_unlink( p, plist ) {
86  path_free( p );
87  }
88 }
#define list_forall_unlink(elt, list)
Definition: lists.h:166
void path_free(path_t *p)
Definition: curve.cpp:58
int privcurve_init ( privcurve_t curve,
int  n 
)

Definition at line 98 of file curve.cpp.

References privcurve_s::alpha, privcurve_s::alpha0, privcurve_s::beta, privcurve_s::c, privcurve_s::n, SAFE_CALLOC, privcurve_s::tag, and privcurve_s::vertex.

Referenced by adjust_vertices(), and opticurve().

99 {
100  memset( curve, 0, sizeof(privcurve_t) );
101  curve->n = n;
102  SAFE_CALLOC( curve->tag, n, int );
103  SAFE_CALLOC( curve->c, n, dpoint3_t );
104  SAFE_CALLOC( curve->vertex, n, dpoint_t );
105  SAFE_CALLOC( curve->alpha, n, double );
106  SAFE_CALLOC( curve->alpha0, n, double );
107  SAFE_CALLOC( curve->beta, n, double );
108  return 0;
109 
110 calloc_error:
111  free( curve->tag );
112  free( curve->c );
113  free( curve->vertex );
114  free( curve->alpha );
115  free( curve->alpha0 );
116  free( curve->beta );
117  return 1;
118 }
double * alpha
Definition: curve.h:29
#define SAFE_CALLOC(var, n, typ)
Definition: curve.cpp:19
dpoint_t * vertex
Definition: curve.h:28
double * beta
Definition: curve.h:31
double * alpha0
Definition: curve.h:30
int * tag
Definition: curve.h:21
int n
Definition: curve.h:20
dpoint_t dpoint3_t[3]
Definition: curve.cpp:94
dpoint_t(* c)[3]
Definition: curve.h:22
void privcurve_to_curve ( privcurve_t pc,
potrace_curve_t c 
)

Definition at line 122 of file curve.cpp.

References privcurve_s::c, potrace_curve_s::c, privcurve_s::n, potrace_curve_s::n, privcurve_s::tag, and potrace_curve_s::tag.

Referenced by process_path().

123 {
124  c->n = pc->n;
125  c->tag = pc->tag;
126  c->c = pc->c;
127 }
potrace_dpoint_t(* c)[3]
Definition: potracelib.h:86
int * tag
Definition: curve.h:21
int n
Definition: curve.h:20
dpoint_t(* c)[3]
Definition: curve.h:22