Browse Source
Nanometric work
Nanometric work
- D_PAD members converted; - style improved; - GetPosition made returning value, added SetPosition; - highly experimental, test it please!pull/1/head
65 changed files with 1245 additions and 725 deletions
-
183d-viewer/3d_draw.cpp
-
9bitmap2component/bitmap2component.cpp
-
24common/common.cpp
-
82common/projet_config.cpp
-
6gerbview/class_gerber_draw_item.h
-
19include/class_board_item.h
-
16include/common.h
-
376include/length.h
-
78include/lengthpcb.h
-
51include/limited_int.h
-
30include/param_config.h
-
162include/vectorpcb.h
-
27pcbnew/block_module_editor.cpp
-
20pcbnew/board_items_to_polygon_shape_transform.cpp
-
28pcbnew/class_board.cpp
-
4pcbnew/class_board.h
-
6pcbnew/class_dimension.h
-
8pcbnew/class_drawsegment.h
-
7pcbnew/class_marker_pcb.h
-
5pcbnew/class_mire.h
-
7pcbnew/class_module.cpp
-
4pcbnew/class_module.h
-
34pcbnew/class_module_transform_functions.cpp
-
4pcbnew/class_netinfo_item.cpp
-
107pcbnew/class_pad.cpp
-
18pcbnew/class_pad.h
-
42pcbnew/class_pad_draw_functions.cpp
-
6pcbnew/class_pcb_text.h
-
5pcbnew/class_text_mod.h
-
15pcbnew/class_track.h
-
15pcbnew/class_zone.cpp
-
4pcbnew/class_zone.h
-
8pcbnew/clean.cpp
-
4pcbnew/dialogs/dialog_gendrill.cpp
-
114pcbnew/dialogs/dialog_pad_properties.cpp
-
6pcbnew/dragsegm.cpp
-
6pcbnew/drc.cpp
-
26pcbnew/drc_clearance_test_functions.cpp
-
2pcbnew/editmod.cpp
-
6pcbnew/editrack.cpp
-
58pcbnew/export_gencad.cpp
-
12pcbnew/export_vrml.cpp
-
10pcbnew/gen_holes_and_tools_lists_for_drill.cpp
-
15pcbnew/gen_modules_placefile.cpp
-
12pcbnew/globaleditpad.cpp
-
26pcbnew/gpcb_exchange.cpp
-
8pcbnew/graphpcb.cpp
-
12pcbnew/ioascii.cpp
-
2pcbnew/magnetic_tracks_functions.cpp
-
22pcbnew/modedit.cpp
-
52pcbnew/move-drag_pads.cpp
-
104pcbnew/muonde.cpp
-
27pcbnew/pcbnew_config.cpp
-
24pcbnew/plot_rtn.cpp
-
14pcbnew/print_board_functions.cpp
-
16pcbnew/ratsnest.cpp
-
8pcbnew/solve.cpp
-
42pcbnew/specctra_export.cpp
-
2pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp
-
8pcbnew/zones_convert_to_polygons_aux_functions.cpp
-
2pcbnew/zones_polygons_insulated_copper_islands.cpp
-
2pcbnew/zones_polygons_test_connections.cpp
-
4polygon/math_for_graphics.h
-
77potrace/auxiliary.h
-
2potrace/render.cpp
@ -0,0 +1,162 @@ |
|||
/** |
|||
* @file vectorpcb.h |
|||
* @brief Planar vector definitions for PCBNEW. |
|||
*/ |
|||
|
|||
#ifndef VECTORPCB_H_INCLUDED |
|||
#define VECTORPCB_H_INCLUDED 1 |
|||
|
|||
/// @TODO: nice template and refiling for it |
|||
class VECTOR_PCB |
|||
{ |
|||
public: |
|||
LENGTH_PCB data[2]; |
|||
|
|||
/** A vector from pair of coords. Constructor is avoided in favor to POD-like object. |
|||
*/ |
|||
static VECTOR_PCB fromXY( LENGTH_PCB x, LENGTH_PCB y ) |
|||
{ |
|||
VECTOR_PCB z = { { x, y } }; |
|||
return z; |
|||
} |
|||
|
|||
/** @defgroup vector-elements Access individual attributes |
|||
* @{ |
|||
*/ |
|||
LENGTH_PCB &operator[]( int i ) |
|||
{ |
|||
return data[i]; |
|||
} |
|||
|
|||
const LENGTH_PCB &operator[]( int i ) const |
|||
{ |
|||
return data[i]; |
|||
} |
|||
|
|||
/** @} */ |
|||
|
|||
/** @defgroup vector-cartesian Access to cartesian coordinates |
|||
* Definitions follow the agreement: |
|||
* - methods are named exactly as attributes, thus setter and getter have same name; |
|||
* - all methods (setters and getterrs) return actual attribute value; |
|||
* - method without argument gets the attribute; |
|||
* - method with argument sets it to argument value. |
|||
* These methods different than operator[] |
|||
* because vector actually may have any storage layout, |
|||
* so cartesian coords may be calculated rahter than actually stored. |
|||
* E. g. homogeneous coordinates is likely to be used in perspective. |
|||
* @{ |
|||
*/ |
|||
|
|||
const LENGTH_PCB x() const |
|||
{ |
|||
return data[0]; |
|||
} |
|||
|
|||
const LENGTH_PCB x( LENGTH_PCB nx ) |
|||
{ |
|||
return data[0] = nx; |
|||
} |
|||
|
|||
const LENGTH_PCB y() const |
|||
{ |
|||
return data[1]; |
|||
} |
|||
|
|||
const LENGTH_PCB y( LENGTH_PCB ny ) |
|||
{ |
|||
return data[1] = ny; |
|||
} |
|||
|
|||
/** @} */ |
|||
|
|||
/** @defgroup vector-comparisons Compare vectors |
|||
* @{ |
|||
*/ |
|||
|
|||
bool operator == ( const VECTOR_PCB &b ) const |
|||
{ |
|||
return data[0] == b.data[0] && data[1] == b.data[1]; |
|||
} |
|||
|
|||
bool operator != ( const VECTOR_PCB &b ) const |
|||
{ |
|||
return !(*this == b); |
|||
} |
|||
|
|||
/** @} */ |
|||
|
|||
/** @defgroup vector-arithmetic Arithmetic operations on vectors |
|||
* @{ |
|||
*/ |
|||
|
|||
VECTOR_PCB & operator -= ( const VECTOR_PCB &b ) |
|||
{ |
|||
data[0] -= b.data[0]; |
|||
data[1] -= b.data[1]; |
|||
return *this; |
|||
} |
|||
|
|||
VECTOR_PCB operator - ( const VECTOR_PCB &b ) const |
|||
{ |
|||
VECTOR_PCB z = *this; |
|||
z -= b; |
|||
return z; |
|||
} |
|||
|
|||
VECTOR_PCB & operator += ( const VECTOR_PCB &b ) |
|||
{ |
|||
data[0] += b.data[0]; |
|||
data[1] += b.data[1]; |
|||
return *this; |
|||
} |
|||
|
|||
VECTOR_PCB operator + ( VECTOR_PCB b ) const |
|||
{ |
|||
VECTOR_PCB z = *this; |
|||
z += b; |
|||
return z; |
|||
} |
|||
|
|||
VECTOR_PCB & operator *= ( int b ) |
|||
{ |
|||
data[0] *= b; |
|||
data[1] *= b; |
|||
return *this; |
|||
} |
|||
|
|||
VECTOR_PCB operator * ( int b ) const |
|||
{ |
|||
VECTOR_PCB z = *this; |
|||
z *= b; |
|||
return z; |
|||
} |
|||
|
|||
VECTOR_PCB & operator /= ( int b ) |
|||
{ |
|||
data[0] /= b; |
|||
data[1] /= b; |
|||
return *this; |
|||
} |
|||
|
|||
VECTOR_PCB operator / ( int b ) const |
|||
{ |
|||
VECTOR_PCB z = *this; |
|||
z /= b; |
|||
return z; |
|||
} |
|||
|
|||
/** @} */ |
|||
}; |
|||
|
|||
#define TO_LEGACY_LU_WXP( p ) ( wxPoint( \ |
|||
TO_LEGACY_LU( ( p )[0] ), \ |
|||
TO_LEGACY_LU( ( p )[1] ) ) ) |
|||
#define TO_LEGACY_LU_WXS( p ) ( wxSize( \ |
|||
TO_LEGACY_LU( ( p )[0] ), \ |
|||
TO_LEGACY_LU( ( p )[1] ) ) ) |
|||
#define FROM_LEGACY_LU_VEC( p ) ( VECTOR_PCB::fromXY( \ |
|||
FROM_LEGACY_LU( ( p ).x ), \ |
|||
FROM_LEGACY_LU( ( p ).y ) ) ) |
|||
|
|||
#endif /* def VECTORPCB_H_INCLUDED */ |
Write
Preview
Loading…
Cancel
Save
Reference in new issue