pcb 4.1.1
An interactive printed circuit board layout editor.
|
This header file collects some general-purpose macros (and static inline functions) that are used in various places. More...
#include "potracelib.h"
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. |
This header file collects some general-purpose macros (and static inline functions) that are used in various places.
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 abs | ( | a | ) | ((a)>0 ? (a) : -(a)) |
Definition at line 104 of file auxiliary.h.
Referenced by AdjustTwoLine(), calc_lon(), ClosePolygon(), common_thindraw_pcb_pad(), ComputeCost(), drc_lines(), ElementOrientation(), FortyFiveLine(), gcode_do_export(), gerber_draw_arc(), NotifyMode(), rubber_callback(), simple_optimize_corner(), TargetPoint(), XORDrawAttachedArc(), XORDrawAttachedLine(), and XYtoNetLength().
#define cu | ( | a | ) | ((a)*(a)*(a)) |
Definition at line 108 of file auxiliary.h.
#define max | ( | a, | |
b | |||
) | ((a)>(b) ? (a) : (b)) |
Definition at line 106 of file auxiliary.h.
Referenced by adjust_tree(), cntrbox_adjust(), find_or_create_acc(), FortyFiveLine(), gerber_draw_arc(), GetMaxBottomLayer(), gts_bb_tree_point_closest_bboxes(), gts_matrix_quadratic_optimization(), hid_parse_actionstring(), IsRectangleInPolygon(), miter(), oproute_rubberband_segment(), orthopull_1(), search_footprint_hash(), seg_in_region(), triBoxOverlap(), vect_inters2(), and vendorDrillMap().
#define min | ( | a, | |
b | |||
) | ((a)<(b) ? (a) : (b)) |
Definition at line 105 of file auxiliary.h.
Referenced by ActionSetViaLayers(), adjust_tree(), adjust_vertices(), calc_lon(), closest_cluster_pair(), cntrbox_adjust(), find_smallest_degree(), FortyFiveLine(), gts_bb_tree_point_closest_bboxes(), gts_graph_bubble_partition(), gts_range_add_value(), IsRectangleInPolygon(), search_footprint_hash(), seg_in_region(), triBoxOverlap(), vect_inters2(), vendorDrillMap(), and xor_path().
Definition at line 103 of file auxiliary.h.
Referenced by bm_to_pathlist(), calc_lon(), dorth_infty(), findpath(), gts_point_orientation_3d_sos(), gts_point_orientation_sos(), opti_penalty(), opticurve(), and sortp().
#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 potrace_dpoint_t dpoint_t |
Definition at line 38 of file auxiliary.h.
Definition at line 36 of file auxiliary.h.
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().
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().