diff --git a/3d-viewer/3d_canvas/cinfo3d_visu.cpp b/3d-viewer/3d_canvas/cinfo3d_visu.cpp index d3996f7651..17070fd63f 100644 --- a/3d-viewer/3d_canvas/cinfo3d_visu.cpp +++ b/3d-viewer/3d_canvas/cinfo3d_visu.cpp @@ -34,6 +34,7 @@ #include <3d_math.h> #include "3d_fastmath.h" #include +#include // for KiROUND /** * Trace mask used to enable or disable the trace output of this class. diff --git a/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.cpp b/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.cpp index fba9f634fe..c4f03baa4f 100644 --- a/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.cpp +++ b/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_ogl_legacy.cpp @@ -35,6 +35,7 @@ #include #include #include <3d_math.h> +#include // for KiROUND #include diff --git a/3d-viewer/CMakeLists.txt b/3d-viewer/CMakeLists.txt index 747abe9442..731f9fb703 100644 --- a/3d-viewer/CMakeLists.txt +++ b/3d-viewer/CMakeLists.txt @@ -106,7 +106,7 @@ add_dependencies( 3d-viewer pcbcommon ) target_link_libraries( 3d-viewer gal - polygon + kimath ${Boost_} ${wxWidgets_LIBRARIES} ${OPENGL_LIBRARIES} diff --git a/CMakeLists.txt b/CMakeLists.txt index b89c3e0efb..6e3553e3dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1027,7 +1027,6 @@ add_subdirectory( cvpcb ) add_subdirectory( eeschema ) add_subdirectory( gerbview ) add_subdirectory( pcbnew ) -add_subdirectory( polygon ) add_subdirectory( pagelayout_editor ) add_subdirectory( bitmap2component ) add_subdirectory( pcb_calculator ) diff --git a/LICENSE.README b/LICENSE.README index 609b1d69d3..fefa0fcd17 100644 --- a/LICENSE.README +++ b/LICENSE.README @@ -13,6 +13,7 @@ Licensed under AGPLv3 (or later): - TTL [https://www.sintef.no/projectweb/geometry-toolkits/ttl/], sources in include/ttl/* Licensed under BOOSTv1: - libcontext [https://github.com/boostorg/context] in thirdparty/libcontext +- clipper in thirdparty/clipper Licensed under ISC: - portions of code in include/geometry/polygon_triangulation.h Licensed under MIT: @@ -22,6 +23,8 @@ Licensed under MIT: Licensed under GPLv2 (or later): - dxflib in thirdparty/dxflib_qcad - potrace in thirdparty/potrace +- math_for_graphics in thirdparty/other_math +- SutherlandHodgmanClipPoly in thirdparty/other_math Licensed under ZLib: - nanosvg in thirdparty/nanosvg Licensed under CC-BY-SA-4.0: diff --git a/bitmap2component/bitmap2cmp_gui.cpp b/bitmap2component/bitmap2cmp_gui.cpp index 1c2429c123..3c173371bb 100644 --- a/bitmap2component/bitmap2cmp_gui.cpp +++ b/bitmap2component/bitmap2cmp_gui.cpp @@ -26,13 +26,9 @@ #include "bitmap2component.h" #include #include -#include -#include -#include -#include #include +#include // for KiROUND #include -#include #include #include #include diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 88d26e6766..c97c1997b4 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -40,7 +40,7 @@ set( GAL_SRCS gal/graphics_abstraction_layer.cpp gal/hidpi_gl_canvas.cpp gal/stroke_font.cpp - geometry/hetriang.cpp + view/view_controls.cpp view/view_overlay.cpp view/wx_view_controls.cpp @@ -72,7 +72,8 @@ set( GAL_SRCS add_library( gal STATIC ${GAL_SRCS} ) target_link_libraries( gal - polygon + ttl + kimath bitmaps ${GLEW_LIBRARIES} ${CAIRO_LIBRARIES} @@ -258,7 +259,6 @@ set( COMMON_SRCS array_options.cpp base64.cpp base_struct.cpp - bezier_curves.cpp bin_mod.cpp bitmap.cpp bitmap_base.cpp @@ -270,7 +270,6 @@ set( COMMON_SRCS common.cpp config_params.cpp confirm.cpp - convert_basic_shapes_to_polygon.cpp cursor_store.cpp dialog_shim.cpp displlst.cpp @@ -313,7 +312,6 @@ set( COMMON_SRCS lib_tree_model_adapter.cpp lockfile.cpp marker_base.cpp - md5_hash.cpp msgpanel.cpp observable.cpp prependpath.cpp @@ -364,8 +362,6 @@ set( COMMON_SRCS view/view_item.cpp view/view_group.cpp - math/math_util.cpp - tool/action_manager.cpp tool/action_menu.cpp tool/action_toolbar.cpp @@ -388,17 +384,6 @@ set( COMMON_SRCS tool/zoom_menu.cpp tool/zoom_tool.cpp - geometry/convex_hull.cpp - geometry/geometry_utils.cpp - geometry/seg.cpp - geometry/shape.cpp - geometry/shape_collisions.cpp - geometry/shape_arc.cpp - geometry/shape_file_io.cpp - geometry/shape_line_chain.cpp - geometry/shape_poly_set.cpp - geometry/trigo.cpp - libeval/numeric_evaluator.cpp ) @@ -415,8 +400,8 @@ add_dependencies( common libcontext ) add_dependencies( common version_header ) target_link_libraries( common + kimath bitmaps - polygon gal ${Boost_LIBRARIES} ${CURL_LIBRARIES} @@ -501,6 +486,7 @@ target_include_directories( pcbcommon PUBLIC target_link_libraries( pcbcommon PUBLIC common + kimath ) diff --git a/common/base_screen.cpp b/common/base_screen.cpp index 99087be3ae..ae0d7eb216 100644 --- a/common/base_screen.cpp +++ b/common/base_screen.cpp @@ -29,13 +29,15 @@ * @brief BASE_SCREEN object implementation. */ -#include -#include -#include -#include + #include -#include +#include #include +#include +#include +#include +#include // for KiROUND +#include #include diff --git a/common/base_units.cpp b/common/base_units.cpp index 56f9388fe0..13da3b54a5 100644 --- a/common/base_units.cpp +++ b/common/base_units.cpp @@ -34,11 +34,13 @@ * depending on the application. */ -#include #include -#include -#include #include +#include +#include // for KiROUND +#include +#include + #include "libeval/numeric_evaluator.h" diff --git a/common/bitmap_base.cpp b/common/bitmap_base.cpp index 02f00d90db..b93c557774 100644 --- a/common/bitmap_base.cpp +++ b/common/bitmap_base.cpp @@ -26,16 +26,15 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "fctsys.h" -#include "gr_basic.h" -#include "macros.h" -#include "trigo.h" -#include "common.h" -#include "richio.h" -#include "plotter.h" - -#include "bitmap_base.h" - +#include +#include // for EDA_RECT +#include // for COLOR4D +#include +#include // for KiROUND +#include // for make_unique, unique_ptr +#include +#include +#include // for wxBitmap #include diff --git a/common/config_params.cpp b/common/config_params.cpp index 2e3fdd174a..0d9ed403c3 100644 --- a/common/config_params.cpp +++ b/common/config_params.cpp @@ -23,19 +23,15 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include +#include // for ColorByName, EDA_COLOR_T, UNSPECIFIE... +#include // for LOCALE_IO +#include // for PARAM_CFG_INT_WITH_SCALE, PARAM_CFG_... +#include // for COLOR4D +#include // for KiROUND +#include // for wxConfigBase +#include // for wxASSERT +#include // for wxString, operator!=, operator== void wxConfigLoadParams( wxConfigBase* aCfg, diff --git a/common/dialogs/dialog_page_settings.cpp b/common/dialogs/dialog_page_settings.cpp index 58003e7202..b84edb9bb4 100644 --- a/common/dialogs/dialog_page_settings.cpp +++ b/common/dialogs/dialog_page_settings.cpp @@ -21,31 +21,31 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // for KiROUND, Clamp +#include +#include +#include #include +#include +#include +#include #include #include #ifdef EESCHEMA -#include #include +#include #endif -#include -#include -#include -#include - #define MAX_PAGE_EXAMPLE_SIZE 200 diff --git a/common/dialogs/dialog_page_settings.h b/common/dialogs/dialog_page_settings.h index 872e024f7d..136710c61e 100644 --- a/common/dialogs/dialog_page_settings.h +++ b/common/dialogs/dialog_page_settings.h @@ -24,6 +24,8 @@ #ifndef _DIALOG_PAGES_SETTINGS_H_ #define _DIALOG_PAGES_SETTINGS_H_ +#include +#include #include #include diff --git a/common/eda_text.cpp b/common/eda_text.cpp index 1ff069d4a2..0d0f818189 100644 --- a/common/eda_text.cpp +++ b/common/eda_text.cpp @@ -27,15 +27,32 @@ * @brief Implementation of base KiCad text object. */ -#include -#include -#include -#include -#include // RotatePoint +#include // for max +#include // for NULL +#include // for swap +#include // for vector -#include +#include // for EDA_ITEM #include -#include +#include // for BASIC_GAL, basic_gal +#include // for wxStringSplit +#include // for Mils2iu +#include // for KICAD_T, SCH_LABEL_T, SCH_TEXT_T, SCH_G... +#include // for EDA_RECT +#include // for EDA_TEXT, TEXT_EFFECTS, GR_TEXT_VJUSTIF... +#include // for COLOR4D, COLOR4D::BLACK +#include // for STROKE_FONT +#include // for GRText +#include // for UnescapeString +#include // for KiROUND +#include // for VECTOR2D +#include // for RotatePoint + +#include // for wxASSERT +#include // for wxPoint, wxString, wxArrayString, wxSize + +class OUTPUTFORMATTER; +class wxFindReplaceData; // Sadly we store the orientation of hierarchical and global labels using a different // int encoding than that for local labels: diff --git a/common/gal/cairo/cairo_gal.cpp b/common/gal/cairo/cairo_gal.cpp index 8c9d9f92c3..7e003937e4 100644 --- a/common/gal/cairo/cairo_gal.cpp +++ b/common/gal/cairo/cairo_gal.cpp @@ -33,6 +33,7 @@ #include #include #include +#include // for KiROUND #include #include diff --git a/common/gal/graphics_abstraction_layer.cpp b/common/gal/graphics_abstraction_layer.cpp index 13607a3fcc..a8c1ca8fcd 100644 --- a/common/gal/graphics_abstraction_layer.cpp +++ b/common/gal/graphics_abstraction_layer.cpp @@ -29,6 +29,8 @@ #include #include +#include // for KiROUND + #include using namespace KIGFX; diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index 66fff1d010..1178728b29 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -39,6 +39,7 @@ #include #include #include +#include // for KiROUND #include diff --git a/common/gal/stroke_font.cpp b/common/gal/stroke_font.cpp index 68e0b63968..efae66e271 100644 --- a/common/gal/stroke_font.cpp +++ b/common/gal/stroke_font.cpp @@ -28,6 +28,7 @@ #include #include +#include // for KiROUND #include diff --git a/common/gr_basic.cpp b/common/gr_basic.cpp index fb8966a0cf..c42e4dc689 100644 --- a/common/gr_basic.cpp +++ b/common/gr_basic.cpp @@ -36,6 +36,7 @@ #include #include #include +#include // for KiROUND static const bool FILLED = true; static const bool NOT_FILLED = false; diff --git a/common/gr_text.cpp b/common/gr_text.cpp index ee213c70af..ee5adfd349 100644 --- a/common/gr_text.cpp +++ b/common/gr_text.cpp @@ -38,6 +38,7 @@ #include #include #include +#include // for KiROUND #include diff --git a/common/lset.cpp b/common/lset.cpp index 9317e07adc..61a66022a2 100644 --- a/common/lset.cpp +++ b/common/lset.cpp @@ -22,11 +22,17 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - +#include // for bitset, __bitset<>::ref... #include #include +#include // for string, endl, basic_ost... +#include // for size_t -#include +#include // for Clamp +#include // for LSET, PCB_LAYER_ID, LSEQ +#include // for arrayDim +#include // for wxASSERT, wxASSERT_MSG +#include // for wxT, wxChar LSET::LSET( const PCB_LAYER_ID* aArray, unsigned aCount ) : diff --git a/common/page_layout/ws_data_item.cpp b/common/page_layout/ws_data_item.cpp index cee37d8f80..16f3cf29eb 100644 --- a/common/page_layout/ws_data_item.cpp +++ b/common/page_layout/ws_data_item.cpp @@ -52,6 +52,7 @@ #include #include #include +#include // for KiROUND #include #include #include diff --git a/common/plotters/GERBER_plotter.cpp b/common/plotters/GERBER_plotter.cpp index 897b6dccb5..9685c4cd1f 100644 --- a/common/plotters/GERBER_plotter.cpp +++ b/common/plotters/GERBER_plotter.cpp @@ -37,6 +37,7 @@ #include #include #include +#include // for KiROUND #include diff --git a/common/plotters/HPGL_plotter.cpp b/common/plotters/HPGL_plotter.cpp index b0f646edd5..e206ac1217 100644 --- a/common/plotters/HPGL_plotter.cpp +++ b/common/plotters/HPGL_plotter.cpp @@ -203,6 +203,8 @@ #include #include #include +#include // for KiROUND + // The hpgl command to close a polygon def, fill it and plot outline: // PM 2; ends the polygon definition and closes it if not closed diff --git a/common/plotters/PDF_plotter.cpp b/common/plotters/PDF_plotter.cpp index 1fbc1092a5..31efacb630 100644 --- a/common/plotters/PDF_plotter.cpp +++ b/common/plotters/PDF_plotter.cpp @@ -38,6 +38,7 @@ #include #include #include +#include // for KiROUND /* diff --git a/common/plotters/PS_plotter.cpp b/common/plotters/PS_plotter.cpp index c912d057cb..5ec3e66d48 100644 --- a/common/plotters/PS_plotter.cpp +++ b/common/plotters/PS_plotter.cpp @@ -36,6 +36,7 @@ #include #include #include +#include // for KiROUND /* Forward declaration of the font width metrics (yes extern! this is the way to forward declare variables */ diff --git a/common/plotters/plotter.cpp b/common/plotters/plotter.cpp index e82825509b..7db68a3ca7 100644 --- a/common/plotters/plotter.cpp +++ b/common/plotters/plotter.cpp @@ -51,6 +51,7 @@ #include #include #include +#include // for KiROUND PLOTTER::PLOTTER( ) { diff --git a/common/preview_items/arc_geom_manager.cpp b/common/preview_items/arc_geom_manager.cpp index 49888f90ff..252fd44d38 100644 --- a/common/preview_items/arc_geom_manager.cpp +++ b/common/preview_items/arc_geom_manager.cpp @@ -23,7 +23,7 @@ #include -#include // KiROUND +#include // for KiROUND using namespace KIGFX::PREVIEW; diff --git a/common/tool/edit_constraints.cpp b/common/tool/edit_constraints.cpp index 9194ca8a65..4b2c791b24 100644 --- a/common/tool/edit_constraints.cpp +++ b/common/tool/edit_constraints.cpp @@ -26,6 +26,7 @@ #include "tool/edit_points.h" #include +#include // for KiROUND #include diff --git a/common/tool/edit_points.cpp b/common/tool/edit_points.cpp index 42ec3730e4..2ba358e5ab 100644 --- a/common/tool/edit_points.cpp +++ b/common/tool/edit_points.cpp @@ -24,6 +24,7 @@ #include #include +#include // for KiROUND #include "tool/edit_points.h" bool EDIT_POINT::WithinPoint( const VECTOR2I& aPoint, unsigned int aSize ) const diff --git a/common/view/wx_view_controls.cpp b/common/view/wx_view_controls.cpp index 214f53aefb..7d7a690302 100644 --- a/common/view/wx_view_controls.cpp +++ b/common/view/wx_view_controls.cpp @@ -32,6 +32,8 @@ #include #include #include +#include // for KiROUND + using namespace KIGFX; diff --git a/cvpcb/CMakeLists.txt b/cvpcb/CMakeLists.txt index b779f6606b..93276deebb 100644 --- a/cvpcb/CMakeLists.txt +++ b/cvpcb/CMakeLists.txt @@ -89,6 +89,7 @@ target_link_libraries( cvpcb_kiface 3d-viewer gal common + kimath ${wxWidgets_LIBRARIES} ${GDI_PLUS_LIBRARIES} ) diff --git a/eeschema/dialogs/dialog_edit_component_in_lib.cpp b/eeschema/dialogs/dialog_edit_component_in_lib.cpp index c84b0f08b0..bcf960ab61 100644 --- a/eeschema/dialogs/dialog_edit_component_in_lib.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_lib.cpp @@ -28,6 +28,7 @@ #include #include #include +#include // for KiROUND #include #include diff --git a/eeschema/lib_arc.cpp b/eeschema/lib_arc.cpp index 12dae366ee..f4fa305621 100644 --- a/eeschema/lib_arc.cpp +++ b/eeschema/lib_arc.cpp @@ -32,6 +32,7 @@ #include #include #include +#include // for KiROUND #include #include diff --git a/eeschema/lib_circle.cpp b/eeschema/lib_circle.cpp index e686881c8c..25a91023e5 100644 --- a/eeschema/lib_circle.cpp +++ b/eeschema/lib_circle.cpp @@ -31,6 +31,7 @@ #include #include #include +#include // for KiROUND #include #include diff --git a/eeschema/lib_circle.h b/eeschema/lib_circle.h index aeb25ca53c..653fa76ed8 100644 --- a/eeschema/lib_circle.h +++ b/eeschema/lib_circle.h @@ -26,6 +26,7 @@ #define LIB_CIRCLE_H #include +#include // for KiROUND class LIB_CIRCLE : public LIB_ITEM diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index 40bf268e67..6bebffc9ff 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -40,6 +40,7 @@ #include #include #include +#include // for KiROUND #include #include diff --git a/eeschema/sch_no_connect.h b/eeschema/sch_no_connect.h index c623983877..639f0725d8 100644 --- a/eeschema/sch_no_connect.h +++ b/eeschema/sch_no_connect.h @@ -31,6 +31,8 @@ #include +#include // for KiROUND + class NETLIST_OBJECT_LIST; diff --git a/eeschema/sch_painter.cpp b/eeschema/sch_painter.cpp index facbb202a4..b816c3d368 100644 --- a/eeschema/sch_painter.cpp +++ b/eeschema/sch_painter.cpp @@ -59,6 +59,7 @@ #include #include #include +#include // for KiROUND #include "sch_painter.h" diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index 054a41f0f6..8c46cce6a2 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -36,6 +36,7 @@ #include #include #include +#include // for KiROUND #include #include diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp index 035eae7d9f..69f84674ff 100644 --- a/eeschema/sch_text.cpp +++ b/eeschema/sch_text.cpp @@ -39,6 +39,7 @@ #include #include #include +#include // for KiROUND #include #include diff --git a/eeschema/tools/ee_inspection_tool.cpp b/eeschema/tools/ee_inspection_tool.cpp index fb25a1c776..835af51e09 100644 --- a/eeschema/tools/ee_inspection_tool.cpp +++ b/eeschema/tools/ee_inspection_tool.cpp @@ -45,6 +45,7 @@ #include #include #include +#include // for KiROUND EE_INSPECTION_TOOL::EE_INSPECTION_TOOL() diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp index 502c6c5aaa..d150946cc0 100644 --- a/eeschema/tools/ee_selection_tool.cpp +++ b/eeschema/tools/ee_selection_tool.cpp @@ -46,6 +46,7 @@ #include #include // For MAX_SELECT_ITEM_IDS #include +#include // for KiROUND SELECTION_CONDITION EE_CONDITIONS::Empty = [] (const SELECTION& aSelection ) diff --git a/eeschema/tools/lib_edit_tool.cpp b/eeschema/tools/lib_edit_tool.cpp index 3aca62ff15..ff2308edbc 100644 --- a/eeschema/tools/lib_edit_tool.cpp +++ b/eeschema/tools/lib_edit_tool.cpp @@ -41,6 +41,7 @@ #include #include #include "lib_edit_tool.h" +#include // for KiROUND LIB_EDIT_TOOL::LIB_EDIT_TOOL() : diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index 0ddebf3066..1e3e137b7f 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -50,6 +50,7 @@ #include #include #include "sch_drawing_tools.h" +#include // for KiROUND char g_lastBusEntryShape = '/'; diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index a01fb42e8f..735d2a5877 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -51,6 +51,8 @@ #include #include #include +#include // for KiROUND + int SCH_EDITOR_CONTROL::New( const TOOL_EVENT& aEvent ) { diff --git a/eeschema/transform.cpp b/eeschema/transform.cpp index da1dbec8a8..a13dd5b857 100644 --- a/eeschema/transform.cpp +++ b/eeschema/transform.cpp @@ -27,6 +27,7 @@ #include #include #include +#include // for KiROUND bool TRANSFORM::operator==( const TRANSFORM& aTransform ) const diff --git a/gerbview/am_primitive.cpp b/gerbview/am_primitive.cpp index 2fade5ff93..2518c0bb95 100644 --- a/gerbview/am_primitive.cpp +++ b/gerbview/am_primitive.cpp @@ -34,6 +34,7 @@ #include #include #include +#include // for KiROUND #include #include diff --git a/gerbview/excellon_read_drill_file.cpp b/gerbview/excellon_read_drill_file.cpp index c36eaa53d7..df9e45acab 100644 --- a/gerbview/excellon_read_drill_file.cpp +++ b/gerbview/excellon_read_drill_file.cpp @@ -65,6 +65,7 @@ #include #include #include +#include // for KiROUND #include #include diff --git a/gerbview/gerber_draw_item.cpp b/gerbview/gerber_draw_item.cpp index 6f31ae141f..bb1cbca588 100644 --- a/gerbview/gerber_draw_item.cpp +++ b/gerbview/gerber_draw_item.cpp @@ -35,6 +35,7 @@ #include #include #include +#include // for KiROUND GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( GERBER_FILE_IMAGE* aGerberImageFile ) : EDA_ITEM( (EDA_ITEM*)NULL, GERBER_DRAW_ITEM_T ) diff --git a/gerbview/gerbview_printout.cpp b/gerbview/gerbview_printout.cpp index e72ed95f3b..fc8518d4c2 100644 --- a/gerbview/gerbview_printout.cpp +++ b/gerbview/gerbview_printout.cpp @@ -34,6 +34,7 @@ #include #include #include +#include // for KiROUND GERBVIEW_PRINTOUT::GERBVIEW_PRINTOUT( GBR_LAYOUT* aLayout, const BOARD_PRINTOUT_SETTINGS& aParams, diff --git a/gerbview/rs274_read_XY_and_IJ_coordinates.cpp b/gerbview/rs274_read_XY_and_IJ_coordinates.cpp index c2bdaf125d..5e4976557f 100644 --- a/gerbview/rs274_read_XY_and_IJ_coordinates.cpp +++ b/gerbview/rs274_read_XY_and_IJ_coordinates.cpp @@ -24,6 +24,7 @@ #include #include +#include // for KiROUND #include #include diff --git a/gerbview/rs274x.cpp b/gerbview/rs274x.cpp index 3195749719..11c9d99680 100644 --- a/gerbview/rs274x.cpp +++ b/gerbview/rs274x.cpp @@ -30,6 +30,7 @@ #include #include #include +#include // for KiROUND #include #include diff --git a/include/base_units.h b/include/base_units.h index 282c893b45..a8371921d1 100644 --- a/include/base_units.h +++ b/include/base_units.h @@ -34,9 +34,10 @@ #include -#include #include #include +#include // for KiROUND +#include //TODO: Abstract Base Units to a single class diff --git a/include/common.h b/include/common.h index ff49e6ca09..042a3ab661 100644 --- a/include/common.h +++ b/include/common.h @@ -69,33 +69,6 @@ typedef uint32_t timestamp_t; #define TEXT_ANGLE_HORIZ 0 #define TEXT_ANGLE_VERT 900 -//----------------------------------------------------------------- - -/** - * Round a floating point number to an integer using "round halfway cases away from zero". - * - * In Debug build an assert fires if will not fit into the return type. - */ -template -constexpr ret_type KiROUND( fp_type v ) -{ - using max_ret = long long int; - fp_type ret = v < 0 ? v - 0.5 : v + 0.5; - - if( std::numeric_limits::max() < ret || - std::numeric_limits::lowest() > ret ) - { - wxLogDebug - ( "Overflow KiROUND converting value %f to %s", double( v ), typeid(ret_type).name() ); - return 0; - } - - return ret_type( max_ret( ret ) ); -} - -//---------------------------------------------------------------- - - enum class EDA_UNITS { INCHES = 0, diff --git a/include/macros.h b/include/macros.h index 080b7cdf46..7d51b4d46a 100644 --- a/include/macros.h +++ b/include/macros.h @@ -126,27 +126,6 @@ void MIRROR( T& aPoint, const T& aMirrorRef ) } -/** - * Function Clamp - * limits @a value within the range @a lower <= @a value <= @a upper. It will work - * on temporary expressions, since they are evaluated only once, and it should work - * on most if not all numeric types, string types, or any type for which "operator < ()" - * is present. The arguments are accepted in this order so you can remember the - * expression as a memory aid: - *

- * result is: lower <= value <= upper - */ -template inline const T& Clamp( const T& lower, const T& value, const T& upper ) -{ - wxASSERT( lower <= upper ); - if( value < lower ) - return lower; - else if( upper < value ) - return upper; - return value; -} - - #ifdef SWIG /// Declare a std::vector and also the swig %template in unison #define DECL_VEC_FOR_SWIG(TypeName, MemberType) namespace std { %template(TypeName) vector; } typedef std::vector TypeName; diff --git a/include/tool/selection.h b/include/tool/selection.h index 991e59eb37..a4c9120936 100644 --- a/include/tool/selection.h +++ b/include/tool/selection.h @@ -26,6 +26,7 @@ #ifndef SELECTION_H #define SELECTION_H +#include #include #include #include diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt index c837b04057..3fd303d485 100644 --- a/libs/CMakeLists.txt +++ b/libs/CMakeLists.txt @@ -22,5 +22,5 @@ # # Build file for generic re-useable libraries - -add_subdirectory( sexpr ) \ No newline at end of file +add_subdirectory( kimath ) +add_subdirectory( sexpr ) diff --git a/libs/kimath/CMakeLists.txt b/libs/kimath/CMakeLists.txt new file mode 100644 index 0000000000..a3b3ffc0c3 --- /dev/null +++ b/libs/kimath/CMakeLists.txt @@ -0,0 +1,49 @@ +set( KIMATH_SRCS + src/bezier_curves.cpp + src/convert_basic_shapes_to_polygon.cpp + src/md5_hash.cpp + src/trigo.cpp + + src/geometry/convex_hull.cpp + src/geometry/geometry_utils.cpp + src/geometry/polygon_test_point_inside.cpp + src/geometry/seg.cpp + src/geometry/shape.cpp + src/geometry/shape_arc.cpp + src/geometry/shape_collisions.cpp + src/geometry/shape_file_io.cpp + src/geometry/shape_line_chain.cpp + src/geometry/shape_poly_set.cpp + + src/math/util.cpp +) + +# Include the other smaller math libraries in this one for convenience +add_library( kimath STATIC + ${KIMATH_SRCS} + $ + $ +) + +add_dependencies( kimath clipper ) +add_dependencies( kimath rtree ) +add_dependencies( kimath othermath ) + +target_link_libraries( kimath + ${wxWidgets_LIBRARIES} # wxLogDebug, wxASSERT + ${Boost_LIBRARIES} # Because of the OPT types +) + +target_include_directories( kimath PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/include + $ + $ + $ +) + +# core/optional.h is needed for OPT types +target_include_directories( kimath PRIVATE + ${PROJECT_SOURCE_DIR}/include + ${wxWidgets_LIBRARIES} + ${Boost_INCLUDE_DIR} +) diff --git a/polygon/determine_if_point_inside_polygon.odt b/libs/kimath/determine_if_point_inside_polygon.odt similarity index 100% rename from polygon/determine_if_point_inside_polygon.odt rename to libs/kimath/determine_if_point_inside_polygon.odt diff --git a/include/bezier_curves.h b/libs/kimath/include/bezier_curves.h similarity index 100% rename from include/bezier_curves.h rename to libs/kimath/include/bezier_curves.h diff --git a/include/convert_basic_shapes_to_polygon.h b/libs/kimath/include/convert_basic_shapes_to_polygon.h similarity index 98% rename from include/convert_basic_shapes_to_polygon.h rename to libs/kimath/include/convert_basic_shapes_to_polygon.h index 76590a5e58..bba344bf3b 100644 --- a/include/convert_basic_shapes_to_polygon.h +++ b/libs/kimath/include/convert_basic_shapes_to_polygon.h @@ -29,13 +29,8 @@ * @file convert_basic_shapes_to_polygon.h */ -#include - -#include -#include -#include - #include +#include // for wxPoint // The chamfer positions of chamfered rect shape. // the position is relative to a pad with orientation = 0 diff --git a/include/geometry/convex_hull.h b/libs/kimath/include/geometry/convex_hull.h similarity index 100% rename from include/geometry/convex_hull.h rename to libs/kimath/include/geometry/convex_hull.h diff --git a/include/geometry/direction45.h b/libs/kimath/include/geometry/direction45.h similarity index 99% rename from include/geometry/direction45.h rename to libs/kimath/include/geometry/direction45.h index 46f4500bb4..5f3ff3298e 100644 --- a/include/geometry/direction45.h +++ b/libs/kimath/include/geometry/direction45.h @@ -24,6 +24,7 @@ #include #include +#include // believe or not, X11 headers have a F****ING macro called Opposite... #undef Opposite diff --git a/include/geometry/geometry_utils.h b/libs/kimath/include/geometry/geometry_utils.h similarity index 98% rename from include/geometry/geometry_utils.h rename to libs/kimath/include/geometry/geometry_utils.h index 3acc3f1620..dd256c3280 100644 --- a/include/geometry/geometry_utils.h +++ b/libs/kimath/include/geometry/geometry_utils.h @@ -30,6 +30,9 @@ #ifndef GEOMETRY_UTILS_H #define GEOMETRY_UTILS_H +#include // for copysign +#include // for abs + #include class EDA_RECT; diff --git a/include/geometry/poly_grid_partition.h b/libs/kimath/include/geometry/poly_grid_partition.h similarity index 99% rename from include/geometry/poly_grid_partition.h rename to libs/kimath/include/geometry/poly_grid_partition.h index a449ff1f97..b78527d7db 100644 --- a/include/geometry/poly_grid_partition.h +++ b/libs/kimath/include/geometry/poly_grid_partition.h @@ -25,14 +25,18 @@ #ifndef __POLY_GRID_PARTITION_H #define __POLY_GRID_PARTITION_H + +#include +#include +#include +#include +#include + #include #include #include - -#include -#include -#include -#include +#include +#include /** * Class POLY_GRID_PARTITION @@ -422,7 +426,7 @@ public: } } } - + if( state.nearest < 0 ) return 0; @@ -439,7 +443,7 @@ public: return 0; } } - + if( state.dist_max > 0 ) { return m_flags[state.nearest] & LEAD_H ? 1 : 0; diff --git a/polygon/include/polygon_test_point_inside.h b/libs/kimath/include/geometry/polygon_test_point_inside.h similarity index 97% rename from polygon/include/polygon_test_point_inside.h rename to libs/kimath/include/geometry/polygon_test_point_inside.h index 07e25eb534..f2f59bea91 100644 --- a/polygon/include/polygon_test_point_inside.h +++ b/libs/kimath/include/geometry/polygon_test_point_inside.h @@ -22,7 +22,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#if 1 // Set to 0 to compile outside wxWidgets +#ifdef WX_COMPATIBILITY #include // for wxPoint definition #else // define here wxPoint if we want to compile outside wxWidgets diff --git a/include/geometry/polygon_triangulation.h b/libs/kimath/include/geometry/polygon_triangulation.h similarity index 99% rename from include/geometry/polygon_triangulation.h rename to libs/kimath/include/geometry/polygon_triangulation.h index fd00d04081..5e8c8428c5 100644 --- a/include/geometry/polygon_triangulation.h +++ b/libs/kimath/include/geometry/polygon_triangulation.h @@ -47,11 +47,14 @@ #define __POLYGON_TRIANGULATION_H #include +#include #include -#include -#include -#include "clipper.hpp" +#include +#include +#include +#include +#include class PolygonTriangulation { diff --git a/include/geometry/seg.h b/libs/kimath/include/geometry/seg.h similarity index 97% rename from include/geometry/seg.h rename to libs/kimath/include/geometry/seg.h index ece5511384..b6d47a20c9 100644 --- a/include/geometry/seg.h +++ b/libs/kimath/include/geometry/seg.h @@ -25,11 +25,14 @@ #ifndef __SEG_H #define __SEG_H -#include -#include +#include // for sqrt +#include // for abs +#include // for operator<<, ostream, basic_os... +#include // for swap -#include #include +#include // for rescale +#include typedef OPT OPT_VECTOR2I; diff --git a/include/geometry/shape.h b/libs/kimath/include/geometry/shape.h similarity index 98% rename from include/geometry/shape.h rename to libs/kimath/include/geometry/shape.h index 1b982ae5d0..12f0327419 100644 --- a/include/geometry/shape.h +++ b/libs/kimath/include/geometry/shape.h @@ -25,13 +25,15 @@ #ifndef __SHAPE_H #define __SHAPE_H -#include +#include // for assert #include +#include // for NULL + +#include #include #include -#include /** * Enum SHAPE_TYPE diff --git a/include/geometry/shape_arc.h b/libs/kimath/include/geometry/shape_arc.h similarity index 98% rename from include/geometry/shape_arc.h rename to libs/kimath/include/geometry/shape_arc.h index 1f23de170a..42d25a33f4 100644 --- a/include/geometry/shape_arc.h +++ b/libs/kimath/include/geometry/shape_arc.h @@ -25,8 +25,10 @@ #ifndef __SHAPE_ARC_H #define __SHAPE_ARC_H -#include #include +#include +#include // for BOX2I +#include // for VECTOR2I class SHAPE_LINE_CHAIN; diff --git a/include/geometry/shape_circle.h b/libs/kimath/include/geometry/shape_circle.h similarity index 97% rename from include/geometry/shape_circle.h rename to libs/kimath/include/geometry/shape_circle.h index d210856912..c77aed1931 100644 --- a/include/geometry/shape_circle.h +++ b/libs/kimath/include/geometry/shape_circle.h @@ -25,7 +25,9 @@ #ifndef __SHAPE_CIRCLE_H #define __SHAPE_CIRCLE_H -#include "shape.h" +#include +#include +#include class SHAPE_CIRCLE : public SHAPE { diff --git a/include/geometry/shape_file_io.h b/libs/kimath/include/geometry/shape_file_io.h similarity index 98% rename from include/geometry/shape_file_io.h rename to libs/kimath/include/geometry/shape_file_io.h index b2d5c110dd..89e558023c 100644 --- a/include/geometry/shape_file_io.h +++ b/libs/kimath/include/geometry/shape_file_io.h @@ -27,7 +27,7 @@ #define __SHAPE_FILE_IO_H #include -#include +#include // for string class SHAPE; diff --git a/include/geometry/shape_index.h b/libs/kimath/include/geometry/shape_index.h similarity index 99% rename from include/geometry/shape_index.h rename to libs/kimath/include/geometry/shape_index.h index 5f50f104b0..5ba1fe30e2 100644 --- a/include/geometry/shape_index.h +++ b/libs/kimath/include/geometry/shape_index.h @@ -27,9 +27,10 @@ #define __SHAPE_INDEX_H #include -#include -#include +#include +#include +#include /** * shapeFunctor template function diff --git a/include/geometry/shape_index_list.h b/libs/kimath/include/geometry/shape_index_list.h similarity index 98% rename from include/geometry/shape_index_list.h rename to libs/kimath/include/geometry/shape_index_list.h index 98fd33afea..a65f0654a5 100644 --- a/include/geometry/shape_index_list.h +++ b/libs/kimath/include/geometry/shape_index_list.h @@ -25,6 +25,12 @@ #ifndef __SHAPE_INDEX_LIST_H #define __SHAPE_INDEX_LIST_H +#include + +#include +#include +#include + template const SHAPE* defaultShapeFunctor( const T aItem ) { diff --git a/include/geometry/shape_line_chain.h b/libs/kimath/include/geometry/shape_line_chain.h similarity index 99% rename from include/geometry/shape_line_chain.h rename to libs/kimath/include/geometry/shape_line_chain.h index d1c7d26442..0c6e7a8019 100644 --- a/include/geometry/shape_line_chain.h +++ b/libs/kimath/include/geometry/shape_line_chain.h @@ -26,17 +26,20 @@ #ifndef __SHAPE_LINE_CHAIN #define __SHAPE_LINE_CHAIN + +#include // for max #include #include -#include +#include // for wxPoint #include -#include -#include -#include - #include +#include +#include +#include // for BOX2I +#include + /** * Class SHAPE_LINE_CHAIN diff --git a/include/geometry/shape_poly_set.h b/libs/kimath/include/geometry/shape_poly_set.h similarity index 99% rename from include/geometry/shape_poly_set.h rename to libs/kimath/include/geometry/shape_poly_set.h index 8d89827068..641ee76dff 100644 --- a/include/geometry/shape_poly_set.h +++ b/libs/kimath/include/geometry/shape_poly_set.h @@ -26,12 +26,21 @@ #ifndef __SHAPE_POLY_SET_H #define __SHAPE_POLY_SET_H -#include #include +#include // for deque +#include // for string, stringstream #include +#include // for set +#include // for out_of_range +#include // for abs +#include + +#include // for ClipType, PolyTree (ptr only) +#include // for SEG #include #include - +#include // for BOX2I +#include // for VECTOR2I #include diff --git a/include/geometry/shape_rect.h b/libs/kimath/include/geometry/shape_rect.h similarity index 98% rename from include/geometry/shape_rect.h rename to libs/kimath/include/geometry/shape_rect.h index 0ce3d2fbc5..6915f2df72 100644 --- a/include/geometry/shape_rect.h +++ b/libs/kimath/include/geometry/shape_rect.h @@ -25,10 +25,11 @@ #ifndef __SHAPE_RECT_H #define __SHAPE_RECT_H +#include #include #include -#include -#include +#include +#include class SHAPE_RECT : public SHAPE { diff --git a/include/geometry/shape_segment.h b/libs/kimath/include/geometry/shape_segment.h similarity index 98% rename from include/geometry/shape_segment.h rename to libs/kimath/include/geometry/shape_segment.h index 50fa87cdc8..9ca3cf13f0 100644 --- a/include/geometry/shape_segment.h +++ b/libs/kimath/include/geometry/shape_segment.h @@ -25,8 +25,10 @@ #ifndef __SHAPE_SEGMENT_H #define __SHAPE_SEGMENT_H -#include #include +#include +#include +#include class SHAPE_SEGMENT : public SHAPE { diff --git a/include/geometry/shape_simple.h b/libs/kimath/include/geometry/shape_simple.h similarity index 98% rename from include/geometry/shape_simple.h rename to libs/kimath/include/geometry/shape_simple.h index dded08ea94..904c02167d 100644 --- a/include/geometry/shape_simple.h +++ b/libs/kimath/include/geometry/shape_simple.h @@ -24,11 +24,11 @@ #ifndef __SHAPE_SIMPLE_H #define __SHAPE_SIMPLE_H -#include - -#include #include +#include #include +#include +#include /** * Class SHAPE_SIMPLE diff --git a/include/math/box2.h b/libs/kimath/include/math/box2.h similarity index 99% rename from include/math/box2.h rename to libs/kimath/include/math/box2.h index bee07c682b..3d099afb50 100644 --- a/include/math/box2.h +++ b/libs/kimath/include/math/box2.h @@ -30,6 +30,7 @@ #include #include +// Needed for the OPT definition #include /** diff --git a/include/math/matrix3x3.h b/libs/kimath/include/math/matrix3x3.h similarity index 100% rename from include/math/matrix3x3.h rename to libs/kimath/include/math/matrix3x3.h diff --git a/include/math/math_util.h b/libs/kimath/include/math/util.h similarity index 55% rename from include/math/math_util.h rename to libs/kimath/include/math/util.h index 197d41514a..0657aa6a61 100644 --- a/include/math/math_util.h +++ b/libs/kimath/include/math/util.h @@ -23,10 +23,56 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef __MATH_UTIL_H -#define __MATH_UTIL_H +#ifndef UTIL_H +#define UTIL_H #include +#include +#include +#include +#include + +/** + * Function Clamp + * limits @a value within the range @a lower <= @a value <= @a upper. It will work + * on temporary expressions, since they are evaluated only once, and it should work + * on most if not all numeric types, string types, or any type for which "operator < ()" + * is present. The arguments are accepted in this order so you can remember the + * expression as a memory aid: + *

+ * result is: lower <= value <= upper + */ +template inline const T& Clamp( const T& lower, const T& value, const T& upper ) +{ + wxASSERT( lower <= upper ); + if( value < lower ) + return lower; + else if( upper < value ) + return upper; + return value; +} + +/** + * Round a floating point number to an integer using "round halfway cases away from zero". + * + * In Debug build an assert fires if will not fit into the return type. + */ +template +constexpr ret_type KiROUND( fp_type v ) +{ + using max_ret = long long int; + fp_type ret = v < 0 ? v - 0.5 : v + 0.5; + + if( std::numeric_limits::max() < ret || + std::numeric_limits::lowest() > ret ) + { + wxLogDebug + ( "Overflow KiROUND converting value %f to %s", double( v ), typeid(ret_type).name() ); + return 0; + } + + return ret_type( max_ret( ret ) ); +} /** * Function rescale() @@ -58,4 +104,4 @@ static inline int round_nearest( double v ) return int( v < 0 ? v - 0.5 : v + 0.5 ); } -#endif // __MATH_UTIL_H +#endif // UTIL_H diff --git a/include/math/vector2d.h b/libs/kimath/include/math/vector2d.h similarity index 99% rename from include/math/vector2d.h rename to libs/kimath/include/math/vector2d.h index 421d9a9082..03254919f0 100644 --- a/include/math/vector2d.h +++ b/libs/kimath/include/math/vector2d.h @@ -32,10 +32,10 @@ #include #include -#include +#include #ifdef WX_COMPATIBILITY - #include +#include #endif /** diff --git a/include/md5_hash.h b/libs/kimath/include/md5_hash.h similarity index 100% rename from include/md5_hash.h rename to libs/kimath/include/md5_hash.h diff --git a/include/trigo.h b/libs/kimath/include/trigo.h similarity index 100% rename from include/trigo.h rename to libs/kimath/include/trigo.h diff --git a/common/bezier_curves.cpp b/libs/kimath/src/bezier_curves.cpp similarity index 95% rename from common/bezier_curves.cpp rename to libs/kimath/src/bezier_curves.cpp index a80a1abbce..a22cfc9acc 100644 --- a/common/bezier_curves.cpp +++ b/libs/kimath/src/bezier_curves.cpp @@ -26,6 +26,10 @@ /************************************/ #include +#include // for VECTOR2D, operator*, VECTOR2 +#include // for wxASSERT +#include // for wxPoint + BEZIER_POLY::BEZIER_POLY( const std::vector& aControlPoints ) { diff --git a/common/convert_basic_shapes_to_polygon.cpp b/libs/kimath/src/convert_basic_shapes_to_polygon.cpp similarity index 97% rename from common/convert_basic_shapes_to_polygon.cpp rename to libs/kimath/src/convert_basic_shapes_to_polygon.cpp index 5e9a9ca4b6..e0ef8a2752 100644 --- a/common/convert_basic_shapes_to_polygon.cpp +++ b/libs/kimath/src/convert_basic_shapes_to_polygon.cpp @@ -24,14 +24,18 @@ * or you may write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include -#include -#include -#include +#include // for max, min +#include // for atan2 +#include // for swap + #include #include +#include // for SHAPE_LINE_CHAIN +#include // for SHAPE_POLY_SET, SHAPE_POLY_SE... +#include +#include // for VECTOR2I +#include void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aBuffer, diff --git a/common/geometry/convex_hull.cpp b/libs/kimath/src/geometry/convex_hull.cpp similarity index 97% rename from common/geometry/convex_hull.cpp rename to libs/kimath/src/geometry/convex_hull.cpp index d2847a9181..feda897d86 100644 --- a/common/geometry/convex_hull.cpp +++ b/libs/kimath/src/geometry/convex_hull.cpp @@ -55,12 +55,14 @@ * Points in the result will be listed in counter-clockwise order. */ -#include #include +#include // for SHAPE_LINE_CHAIN +#include +#include // for VECTOR2I +#include #include #include -#include typedef long long coord2_t; // must be big enough to hold 2*max(|coordinate|)^2 diff --git a/common/geometry/geometry_utils.cpp b/libs/kimath/src/geometry/geometry_utils.cpp similarity index 97% rename from common/geometry/geometry_utils.cpp rename to libs/kimath/src/geometry/geometry_utils.cpp index 9e9ef014b7..d2448589a0 100644 --- a/common/geometry/geometry_utils.cpp +++ b/libs/kimath/src/geometry/geometry_utils.cpp @@ -27,8 +27,12 @@ * @brief a few functions useful in geometry calculations. */ +#include // for int64_t +#include // for max, min + #include #include +#include // for round_nearest // To approximate a circle by segments, a minimal seg count is mandatory #define MIN_SEGCOUNT_FOR_CIRCLE 6 diff --git a/polygon/polygon_test_point_inside.cpp b/libs/kimath/src/geometry/polygon_test_point_inside.cpp similarity index 98% rename from polygon/polygon_test_point_inside.cpp rename to libs/kimath/src/geometry/polygon_test_point_inside.cpp index 0c0799bd2d..9de3824954 100644 --- a/polygon/polygon_test_point_inside.cpp +++ b/libs/kimath/src/geometry/polygon_test_point_inside.cpp @@ -26,10 +26,7 @@ * @file polygon_test_point_inside.cpp */ -#include -#include - -#include "polygon_test_point_inside.h" +#include /* this algo uses the the Jordan curve theorem to find if a point is inside or outside a polygon: * It run a semi-infinite line horizontally (increasing x, fixed y) diff --git a/common/geometry/seg.cpp b/libs/kimath/src/geometry/seg.cpp similarity index 97% rename from common/geometry/seg.cpp rename to libs/kimath/src/geometry/seg.cpp index 62b4dff921..cb919368fe 100644 --- a/common/geometry/seg.cpp +++ b/libs/kimath/src/geometry/seg.cpp @@ -22,7 +22,10 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +#include // for min #include +#include // for rescale +#include // for VECTOR2I, VECTOR2 template int sgn( T aVal ) diff --git a/common/geometry/shape.cpp b/libs/kimath/src/geometry/shape.cpp similarity index 100% rename from common/geometry/shape.cpp rename to libs/kimath/src/geometry/shape.cpp diff --git a/common/geometry/shape_arc.cpp b/libs/kimath/src/geometry/shape_arc.cpp similarity index 95% rename from common/geometry/shape_arc.cpp rename to libs/kimath/src/geometry/shape_arc.cpp index 280574715c..af6fd1f67a 100644 --- a/common/geometry/shape_arc.cpp +++ b/libs/kimath/src/geometry/shape_arc.cpp @@ -22,12 +22,18 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include // for assert +#include // for cos, sin, M_PI, atan2, ceil +#include // for swap #include #include +#include // for SEG #include #include +#include // for BOX2I +#include // for VECTOR2I, VECTOR2D, VECTOR2 + bool SHAPE_ARC::Collide( const SEG& aSeg, int aClearance ) const { diff --git a/common/geometry/shape_collisions.cpp b/libs/kimath/src/geometry/shape_collisions.cpp similarity index 98% rename from common/geometry/shape_collisions.cpp rename to libs/kimath/src/geometry/shape_collisions.cpp index 3cd1ccbd4c..0e7f66f325 100644 --- a/common/geometry/shape_collisions.cpp +++ b/libs/kimath/src/geometry/shape_collisions.cpp @@ -22,16 +22,22 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include +#include // for assert +#include +#include // for INT_MAX +#include // for abs + +#include // for SEG #include #include #include #include #include #include -#include "../../include/geometry/shape_simple.h" +#include +#include // for BOX2I +#include typedef VECTOR2I::extended_type ecoord; diff --git a/common/geometry/shape_file_io.cpp b/libs/kimath/src/geometry/shape_file_io.cpp similarity index 100% rename from common/geometry/shape_file_io.cpp rename to libs/kimath/src/geometry/shape_file_io.cpp index 2d3a700953..a9e9a4af70 100644 --- a/common/geometry/shape_file_io.cpp +++ b/libs/kimath/src/geometry/shape_file_io.cpp @@ -22,8 +22,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include #include +#include #include #include diff --git a/common/geometry/shape_line_chain.cpp b/libs/kimath/src/geometry/shape_line_chain.cpp similarity index 97% rename from common/geometry/shape_line_chain.cpp rename to libs/kimath/src/geometry/shape_line_chain.cpp index 7bb8d808ea..6fcb308afd 100644 --- a/common/geometry/shape_line_chain.cpp +++ b/libs/kimath/src/geometry/shape_line_chain.cpp @@ -23,11 +23,17 @@ */ #include +#include // for INT_MAX +#include // for hypot +#include // for basic_string +#include +#include // for SEG, OPT_VECTOR2I #include -#include -#include -#include "clipper.hpp" +#include // for BOX2I +#include // for rescale +#include // for VECTOR2, VECTOR2I +class SHAPE; ClipperLib::Path SHAPE_LINE_CHAIN::convertToClipper( bool aRequiredOrientation ) const diff --git a/common/geometry/shape_poly_set.cpp b/libs/kimath/src/geometry/shape_poly_set.cpp similarity index 98% rename from common/geometry/shape_poly_set.cpp rename to libs/kimath/src/geometry/shape_poly_set.cpp index a0d141b205..73c7a2d9aa 100644 --- a/common/geometry/shape_poly_set.cpp +++ b/libs/kimath/src/geometry/shape_poly_set.cpp @@ -26,23 +26,31 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - -#include -#include -#include -#include #include -#include +#include // for assert +#include // for sqrt, cos, hypot, isinf +#include +#include // for operator<<, operator>> +#include // for numeric_limits #include +#include +#include // for char_traits, operator!= +#include // for swap, move +#include +#include -#include -#include - +#include // for Clipper, PolyNode, Clipp... #include +#include +#include // for SEG, OPT_VECTOR2I #include #include #include -#include +#include // for BOX2I +#include // for round_nearest, rescale +#include // for VECTOR2I, VECTOR2D, VECTOR2 +#include + using namespace ClipperLib; diff --git a/common/math/math_util.cpp b/libs/kimath/src/math/util.cpp similarity index 98% rename from common/math/math_util.cpp rename to libs/kimath/src/math/util.cpp index 604b879120..51a09e1d46 100644 --- a/common/math/math_util.cpp +++ b/libs/kimath/src/math/util.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include template<> int rescale( int aNumerator, int aValue, int aDenominator ) diff --git a/common/md5_hash.cpp b/libs/kimath/src/md5_hash.cpp similarity index 100% rename from common/md5_hash.cpp rename to libs/kimath/src/md5_hash.cpp diff --git a/common/geometry/trigo.cpp b/libs/kimath/src/trigo.cpp similarity index 98% rename from common/geometry/trigo.cpp rename to libs/kimath/src/trigo.cpp index e2128a6158..ef1a2f4793 100644 --- a/common/geometry/trigo.cpp +++ b/libs/kimath/src/trigo.cpp @@ -27,12 +27,14 @@ * @brief Trigonometric and geometric basic functions. */ -#include -#include -#include -#include -#include +#include // for numeric_limits +#include // for abs +#include // for swap + #include +#include +#include // for VECTOR2I +#include // Returns true if the point P is on the segment S. // faster than TestSegmentHit() because P should be exactly on S diff --git a/pagelayout_editor/tools/pl_edit_tool.cpp b/pagelayout_editor/tools/pl_edit_tool.cpp index 6265599e33..431ff8d011 100644 --- a/pagelayout_editor/tools/pl_edit_tool.cpp +++ b/pagelayout_editor/tools/pl_edit_tool.cpp @@ -34,6 +34,7 @@ #include #include #include +#include // for KiROUND PL_EDIT_TOOL::PL_EDIT_TOOL() : diff --git a/pagelayout_editor/tools/pl_selection_tool.cpp b/pagelayout_editor/tools/pl_selection_tool.cpp index f9a6acbd38..25e2cec2d2 100644 --- a/pagelayout_editor/tools/pl_selection_tool.cpp +++ b/pagelayout_editor/tools/pl_selection_tool.cpp @@ -36,6 +36,7 @@ #include #include #include "pl_selection_tool.h" +#include // for KiROUND /** * The maximum number of items in the clarify selection context menu. The current diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 33f046aec7..1afeca8606 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -399,6 +399,7 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES ) -I${CMAKE_CURRENT_SOURCE_DIR}/../include -I${CMAKE_CURRENT_SOURCE_DIR}/../scripting -I${CMAKE_CURRENT_SOURCE_DIR}/../common/swig + -I${CMAKE_CURRENT_SOURCE_DIR}/../libs/kimath/include -I${WXPYTHON_SWIG_DIR} ) @@ -620,6 +621,7 @@ target_include_directories( pcbnew_kiface_objects PRIVATE $ $ $ + $ $ $ ) @@ -629,6 +631,7 @@ target_include_directories( pcbnew_kiface_objects PRIVATE add_dependencies( pcbnew_kiface_objects common ) add_dependencies( pcbnew_kiface_objects dxflib_qcad ) add_dependencies( pcbnew_kiface_objects tinyspline_lib ) +add_dependencies( pcbnew_kiface_objects ttl ) add_dependencies( pcbnew_kiface_objects nanosvg ) add_library( pcbnew_kiface MODULE $ ) @@ -663,6 +666,7 @@ set( PCBNEW_KIFACE_LIBRARIES gal dxflib_qcad tinyspline_lib + ttl idf3 nanosvg ${wxWidgets_LIBRARIES} diff --git a/pcbnew/autorouter/ar_matrix.cpp b/pcbnew/autorouter/ar_matrix.cpp index 6622f33141..d808453671 100644 --- a/pcbnew/autorouter/ar_matrix.cpp +++ b/pcbnew/autorouter/ar_matrix.cpp @@ -29,6 +29,7 @@ #include "ar_cell.h" #include +#include // for KiROUND #include #include diff --git a/pcbnew/board_items_to_polygon_shape_transform.cpp b/pcbnew/board_items_to_polygon_shape_transform.cpp index 26082fc5fc..b86f961ce6 100644 --- a/pcbnew/board_items_to_polygon_shape_transform.cpp +++ b/pcbnew/board_items_to_polygon_shape_transform.cpp @@ -40,6 +40,7 @@ #include #include #include +#include // for KiROUND // A helper struct for the callback function // These variables are parameters used in addTextSegmToPoly. diff --git a/pcbnew/board_stackup_manager/panel_board_stackup.cpp b/pcbnew/board_stackup_manager/panel_board_stackup.cpp index d54a5fc991..7e628da0d5 100644 --- a/pcbnew/board_stackup_manager/panel_board_stackup.cpp +++ b/pcbnew/board_stackup_manager/panel_board_stackup.cpp @@ -30,6 +30,7 @@ #include #include #include +#include // for KiROUND #include "panel_board_stackup.h" #include diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp index f4f11d5601..8d72e511a5 100644 --- a/pcbnew/class_dimension.cpp +++ b/pcbnew/class_dimension.cpp @@ -37,6 +37,7 @@ #include #include #include +#include // for KiROUND DIMENSION::DIMENSION( BOARD_ITEM* aParent ) diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index ccde82f9cf..5f708f33a8 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -38,6 +38,7 @@ #include #include #include +#include // for KiROUND DRAWSEGMENT::DRAWSEGMENT( BOARD_ITEM* aParent, KICAD_T idtype ) : diff --git a/pcbnew/class_drawsegment.h b/pcbnew/class_drawsegment.h index 2a4d8c1ef8..0e3b273ba8 100644 --- a/pcbnew/class_drawsegment.h +++ b/pcbnew/class_drawsegment.h @@ -33,6 +33,7 @@ #include #include #include +#include // for KiROUND #include #include diff --git a/pcbnew/class_edge_mod.cpp b/pcbnew/class_edge_mod.cpp index 3f867cd83b..9aac2f3a04 100644 --- a/pcbnew/class_edge_mod.cpp +++ b/pcbnew/class_edge_mod.cpp @@ -42,6 +42,7 @@ #include #include #include +#include // for KiROUND #include #include diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index 496c8f9fd4..995f769c2d 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -34,6 +34,7 @@ #include #include #include +#include // for KiROUND #include #include @@ -41,7 +42,7 @@ #include #include -#include +#include #include #include diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index f16e8bafd6..e8b4a10512 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -39,6 +39,7 @@ #include #include #include +#include // for KiROUND /** * Function ShowClearance diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index c58a56824c..3907440582 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -39,7 +39,8 @@ #include #include #include -#include +#include +#include // for KiROUND ZONE_CONTAINER::ZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent, bool aInModule ) diff --git a/pcbnew/collectors.cpp b/pcbnew/collectors.cpp index 70ea4cea6e..ce624beaee 100644 --- a/pcbnew/collectors.cpp +++ b/pcbnew/collectors.cpp @@ -30,6 +30,7 @@ #include #include #include +#include // for KiROUND /* This module contains out of line member functions for classes given in diff --git a/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.cpp b/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.cpp index 1ae2330da0..3825ca2b2b 100644 --- a/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.cpp +++ b/pcbnew/dialogs/dialog_edit_footprint_for_BoardEditor.cpp @@ -42,6 +42,7 @@ #include "3d_cache/dialogs/3d_cache_dialogs.h" #include #include <3d_viewer/eda_3d_viewer.h> +#include // for KiROUND #include diff --git a/pcbnew/dialogs/dialog_move_exact.cpp b/pcbnew/dialogs/dialog_move_exact.cpp index 686df99746..294d8b12c6 100644 --- a/pcbnew/dialogs/dialog_move_exact.cpp +++ b/pcbnew/dialogs/dialog_move_exact.cpp @@ -23,6 +23,7 @@ */ #include +#include // for KiROUND #include #include diff --git a/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp b/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp index f6a97ee3fa..3f3b9bec2c 100644 --- a/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_basicshapes_properties.cpp @@ -40,6 +40,7 @@ #include #include #include +#include // for KiROUND #include #include diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index dc453d2b55..df77f21d8b 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/pcbnew/dialogs/dialog_plot.cpp @@ -39,6 +39,7 @@ #include #include #include +#include // for KiROUND DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aParent ) : diff --git a/pcbnew/dialogs/dialog_position_relative.cpp b/pcbnew/dialogs/dialog_position_relative.cpp index cd03a9cf69..a5f6c544d1 100644 --- a/pcbnew/dialogs/dialog_position_relative.cpp +++ b/pcbnew/dialogs/dialog_position_relative.cpp @@ -22,6 +22,7 @@ */ #include +#include // for KiROUND #include #include #include diff --git a/pcbnew/dialogs/dialog_set_grid.cpp b/pcbnew/dialogs/dialog_set_grid.cpp index b3108b425c..bf287e6a47 100644 --- a/pcbnew/dialogs/dialog_set_grid.cpp +++ b/pcbnew/dialogs/dialog_set_grid.cpp @@ -30,6 +30,7 @@ #include #include #include +#include // for KiROUND // Max values for grid size static const int MAX_GRID_SIZE = KiROUND( 1000.0 * IU_PER_MM ); diff --git a/pcbnew/dialogs/dialog_text_properties.cpp b/pcbnew/dialogs/dialog_text_properties.cpp index 0471f1996e..00f8403972 100644 --- a/pcbnew/dialogs/dialog_text_properties.cpp +++ b/pcbnew/dialogs/dialog_text_properties.cpp @@ -38,6 +38,7 @@ #include #include #include +#include // for KiROUND DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES( PCB_BASE_EDIT_FRAME* aParent, BOARD_ITEM* aItem ) : diff --git a/pcbnew/dialogs/panel_setup_feature_constraints.cpp b/pcbnew/dialogs/panel_setup_feature_constraints.cpp index 99fe1b7a67..34717467e0 100644 --- a/pcbnew/dialogs/panel_setup_feature_constraints.cpp +++ b/pcbnew/dialogs/panel_setup_feature_constraints.cpp @@ -21,14 +21,18 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - -#include -#include #include - +#include // for BOARD +#include // for IU_PER_MM +#include #include +#include // for PANEL_SETUP_FEATUR... +#include -#include // To be removed later, when the zone fill option will be always allowed +#include // for PAGED_DIALOG +#include // for UNIT_BINDER +#include +#include PANEL_SETUP_FEATURE_CONSTRAINTS::PANEL_SETUP_FEATURE_CONSTRAINTS( PAGED_DIALOG* aParent, diff --git a/pcbnew/dialogs/panel_setup_feature_constraints.h b/pcbnew/dialogs/panel_setup_feature_constraints.h index 912a47fd63..85f5101499 100644 --- a/pcbnew/dialogs/panel_setup_feature_constraints.h +++ b/pcbnew/dialogs/panel_setup_feature_constraints.h @@ -25,13 +25,14 @@ #ifndef PANEL_SETUP_FEATURE_CONSTRAINTS_H #define PANEL_SETUP_FEATURE_CONSTRAINTS_H -#include #include -#include #include -class PCB_EDIT_FRAME; +class BOARD; class BOARD_DESIGN_SETTINGS; +class PAGED_DIALOG; +class PCB_EDIT_FRAME; +class wxCommandEvent; class PANEL_SETUP_FEATURE_CONSTRAINTS : public PANEL_SETUP_FEATURE_CONSTRAINTS_BASE diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index c450e8ceff..618e0f90b5 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -64,6 +64,7 @@ Load() TODO's #include #include #include +#include // for KiROUND #include #include diff --git a/pcbnew/exporters/export_d356.cpp b/pcbnew/exporters/export_d356.cpp index 14de513858..4103eac7f9 100644 --- a/pcbnew/exporters/export_d356.cpp +++ b/pcbnew/exporters/export_d356.cpp @@ -43,6 +43,7 @@ #include #include #include +#include // for KiROUND /* Structure for holding the D-356 record fields. * Useful because 356A (when implemented) must be sorted before outputting it */ diff --git a/pcbnew/exporters/export_gencad.cpp b/pcbnew/exporters/export_gencad.cpp index f8592498d9..6156d2ec83 100644 --- a/pcbnew/exporters/export_gencad.cpp +++ b/pcbnew/exporters/export_gencad.cpp @@ -44,6 +44,7 @@ #include #include #include +#include // for KiROUND static bool CreateHeaderInfoData( FILE* aFile, PCB_EDIT_FRAME* frame ); static void CreateArtworksSection( FILE* aFile ); diff --git a/pcbnew/exporters/gen_drill_report_files.cpp b/pcbnew/exporters/gen_drill_report_files.cpp index 1514048392..792b4b87a7 100644 --- a/pcbnew/exporters/gen_drill_report_files.cpp +++ b/pcbnew/exporters/gen_drill_report_files.cpp @@ -35,6 +35,7 @@ #include #include #include +#include // for KiROUND #include diff --git a/pcbnew/exporters/gendrill_Excellon_writer.cpp b/pcbnew/exporters/gendrill_Excellon_writer.cpp index b060b239c7..1318a1bf26 100644 --- a/pcbnew/exporters/gendrill_Excellon_writer.cpp +++ b/pcbnew/exporters/gendrill_Excellon_writer.cpp @@ -42,6 +42,7 @@ #include #include #include +#include // for KiROUND #include #include diff --git a/pcbnew/gpcb_plugin.cpp b/pcbnew/gpcb_plugin.cpp index a63dbe625a..2f714d48d0 100644 --- a/pcbnew/gpcb_plugin.cpp +++ b/pcbnew/gpcb_plugin.cpp @@ -34,6 +34,7 @@ #include #include #include +#include // for KiROUND #include #include diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index ddc4c73228..699abe5809 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -87,6 +87,7 @@ #include #include #include +#include // for KiROUND typedef LEGACY_PLUGIN::BIU BIU; diff --git a/pcbnew/microwave.cpp b/pcbnew/microwave.cpp index 4aab423747..6071279823 100644 --- a/pcbnew/microwave.cpp +++ b/pcbnew/microwave.cpp @@ -41,6 +41,7 @@ #include #include #include +#include // for KiROUND static std::vector< wxRealPoint > PolyEdges; static double ShapeScaleX, ShapeScaleY; diff --git a/pcbnew/microwave/microwave_inductor.cpp b/pcbnew/microwave/microwave_inductor.cpp index eef7f515d7..413723e57e 100644 --- a/pcbnew/microwave/microwave_inductor.cpp +++ b/pcbnew/microwave/microwave_inductor.cpp @@ -34,6 +34,7 @@ #include #include #include +#include // for KiROUND using namespace MWAVE; diff --git a/pcbnew/pad_print_functions.cpp b/pcbnew/pad_print_functions.cpp index 9402954b1a..b9e5caea1e 100644 --- a/pcbnew/pad_print_functions.cpp +++ b/pcbnew/pad_print_functions.cpp @@ -31,6 +31,7 @@ #include #include #include +#include // for KiROUND #include #include #include diff --git a/pcbnew/pcad2kicadpcb_plugin/pcad2kicad_common.cpp b/pcbnew/pcad2kicadpcb_plugin/pcad2kicad_common.cpp index 551b0f3cef..93409d1663 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcad2kicad_common.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcad2kicad_common.cpp @@ -33,6 +33,7 @@ #include #include +#include // for KiROUND #include diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp index 1cffbec883..b15a97bac2 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp @@ -31,6 +31,7 @@ #include #include +#include // for KiROUND #include #include diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp index 9129735191..ce2450a1f6 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp @@ -31,6 +31,7 @@ #include #include +#include // for KiROUND #include diff --git a/pcbnew/pcb_parser.h b/pcbnew/pcb_parser.h index cad4804433..3af64d421c 100644 --- a/pcbnew/pcb_parser.h +++ b/pcbnew/pcb_parser.h @@ -30,18 +30,18 @@ #ifndef _PCBNEW_PARSER_H_ #define _PCBNEW_PARSER_H_ -#include +#include // IU_PER_MM #include -#include // PCB_LAYER_ID -#include // KiROUND -#include // IU_PER_MM +#include // PCB_LAYER_ID +#include // KiROUND, Clamp +#include #include class BOARD; class BOARD_ITEM; -class BOARD_ITEM_CONTAINER; +class BOARD_ITEM_CONTAINER; class D_PAD; class BOARD_DESIGN_SETTINGS; class DIMENSION; @@ -157,7 +157,7 @@ class PCB_PARSER : public PCB_LEXER bool parseD_PAD_option( D_PAD* aPad ); TRACK* parseTRACK(); VIA* parseVIA(); - ZONE_CONTAINER* parseZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent ); + ZONE_CONTAINER* parseZONE_CONTAINER( BOARD_ITEM_CONTAINER* aParent ); PCB_TARGET* parsePCB_TARGET(); BOARD* parseBOARD(); diff --git a/pcbnew/pcb_plot_params.cpp b/pcbnew/pcb_plot_params.cpp index 0adf8046d0..76f30109c2 100644 --- a/pcbnew/pcb_plot_params.cpp +++ b/pcbnew/pcb_plot_params.cpp @@ -28,6 +28,7 @@ #include #include #include +#include // for KiROUND #define PLOT_LINEWIDTH_MIN ( 0.02 * IU_PER_MM ) // min value for default line thickness diff --git a/pcbnew/pcbnew_printout.cpp b/pcbnew/pcbnew_printout.cpp index a21121e1f0..a318195046 100644 --- a/pcbnew/pcbnew_printout.cpp +++ b/pcbnew/pcbnew_printout.cpp @@ -27,7 +27,7 @@ #include "pcbnew_printout.h" #include - +#include // for KiROUND #include #include #include diff --git a/pcbnew/pcbplot.h b/pcbnew/pcbplot.h index ea43a944fe..668800cd10 100644 --- a/pcbnew/pcbplot.h +++ b/pcbnew/pcbplot.h @@ -33,6 +33,7 @@ #include #include #include +#include // for KiROUND class PLOTTER; class TEXTE_PCB; diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index 908df7af1a..ef31f3ca05 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -38,6 +38,7 @@ #include #include #include +#include // for KiROUND #include #include diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index fd11d6a6ad..d9f9bc44e7 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -21,29 +21,52 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include -#include +#include // for min +#include // for bitset, operator&, __bi... +#include // for abs +#include // for NULL, size_t +#include // for vector, __vector_base<>... + #include -#include +#include +#include +#include // for SEG +#include // for SHAPE_LINE_CHAIN +#include // for SHAPE_POLY_SET, SHAPE_P... +#include // for KiROUND, Clamp +#include // for VECTOR2I +#include #include -#include -#include + +#include // for BOARD_DESIGN_SETTINGS +#include // for LIGHTGRAY, WHITE +#include // for COLORS_DESIGN_SETTINGS +#include // for dyn_cast, PCB_DIMENSION_T +#include // for FILLED, EDA_DRAW_MODE_T +#include // for COLOR4D, operator!= +#include +#include // for GBR_NETLIST_METADATA +#include // for LSET, IsCopperLayer +#include // for PAD_ATTRIB_HOLE_NOT_PLATED +#include +#include // for PCB_PLOT_PARAMS, PCB_PL... #include -#include -#include +#include // for BOARD_ITEM, S_CIRCLE +#include +#include #include +#include +#include // for TEXTE_MODULE +#include +#include // for D_PAD +#include #include #include -#include -#include -#include -#include -#include -#include -#include +#include // for wxASSERT_MSG +#include // for wxPoint, wxSize, wxArra... + /* class BRDITEMS_PLOTTER is a helper class to plot board items * and a group of board items diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index dde1f6b70b..3ab4987e01 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -45,13 +45,13 @@ #include #include #include +#include #include #include "tools/pcb_tool_base.h" #include "pns_kicad_iface.h" -#include "../../include/geometry/shape_simple.h" #include "pns_routing_settings.h" #include "pns_item.h" #include "pns_solid.h" diff --git a/pcbnew/router/pns_line.cpp b/pcbnew/router/pns_line.cpp index 529aeeb381..4cc00f129a 100644 --- a/pcbnew/router/pns_line.cpp +++ b/pcbnew/router/pns_line.cpp @@ -21,6 +21,7 @@ #include +#include #include #include "pns_line.h" @@ -682,7 +683,7 @@ void LINE::dragSegment45( const VECTOR2I& aP, int aIndex, int aSnappingThreshold } else guideB[0] = guideB[1] = SEG( dragged.B, dragged.B + dir_next.ToVector() ); - + } SEG s_current( target, target + drag_dir.ToVector() ); diff --git a/pcbnew/router/pns_line.h b/pcbnew/router/pns_line.h index dabbe1830b..fba3fa536f 100644 --- a/pcbnew/router/pns_line.h +++ b/pcbnew/router/pns_line.h @@ -22,6 +22,7 @@ #ifndef __PNS_LINE_H #define __PNS_LINE_H +#include #include #include diff --git a/pcbnew/router/pns_logger.cpp b/pcbnew/router/pns_logger.cpp index de95fe700e..22991a85fc 100644 --- a/pcbnew/router/pns_logger.cpp +++ b/pcbnew/router/pns_logger.cpp @@ -30,7 +30,7 @@ #include #include #include -#include "../../include/geometry/shape_simple.h" +#include namespace PNS { diff --git a/pcbnew/router/pns_optimizer.cpp b/pcbnew/router/pns_optimizer.cpp index 8d368f7dac..896c2f3810 100644 --- a/pcbnew/router/pns_optimizer.cpp +++ b/pcbnew/router/pns_optimizer.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include "pns_line.h" @@ -29,7 +30,6 @@ #include "pns_solid.h" #include "pns_optimizer.h" -#include "../../include/geometry/shape_simple.h" #include "pns_utils.h" #include "pns_router.h" diff --git a/pcbnew/router/pns_shove.cpp b/pcbnew/router/pns_shove.cpp index ee16cafb0e..bc6e9acf00 100644 --- a/pcbnew/router/pns_shove.cpp +++ b/pcbnew/router/pns_shove.cpp @@ -21,6 +21,7 @@ #include #include +#include #include "pns_line.h" #include "pns_node.h" @@ -1345,7 +1346,7 @@ static VIA* findViaByHandle ( NODE *aNode, const VIA_HANDLE& handle ) for( ITEM* item : jt->LinkList() ) { - if ( item->OfKind( ITEM::VIA_T )) + if ( item->OfKind( ITEM::VIA_T )) { if( item->Net() == handle.net && item->Layers().Overlaps(handle.layers) ) return static_cast( item ); @@ -1373,7 +1374,7 @@ SHOVE::SHOVE_STATUS SHOVE::ShoveDraggingVia( const VIA_HANDLE aOldVia, const VEC // Pop NODEs containing previous shoves which are no longer necessary ITEM_SET headSet; - + VIA headVia ( *viaToDrag ); headVia.SetPos( aWhere ); headSet.Add( headVia ); diff --git a/pcbnew/router/pns_shove.h b/pcbnew/router/pns_shove.h index 44264ea3bb..53c5051fa4 100644 --- a/pcbnew/router/pns_shove.h +++ b/pcbnew/router/pns_shove.h @@ -25,6 +25,8 @@ #include #include +#include + #include "pns_optimizer.h" #include "pns_routing_settings.h" #include "pns_algo_base.h" diff --git a/pcbnew/router/pns_solid.cpp b/pcbnew/router/pns_solid.cpp index c7e6ae6bd3..306d36c948 100644 --- a/pcbnew/router/pns_solid.cpp +++ b/pcbnew/router/pns_solid.cpp @@ -25,9 +25,9 @@ #include #include #include -#include "pns_solid.h" +#include -#include "../../include/geometry/shape_simple.h" +#include "pns_solid.h" #include "pns_utils.h" namespace PNS { diff --git a/pcbnew/router/pns_utils.cpp b/pcbnew/router/pns_utils.cpp index 55d20161f1..1ee7779cbc 100644 --- a/pcbnew/router/pns_utils.cpp +++ b/pcbnew/router/pns_utils.cpp @@ -25,6 +25,7 @@ #include "pns_router.h" #include +#include #include diff --git a/pcbnew/router/pns_utils.h b/pcbnew/router/pns_utils.h index d0244283e9..55d7d333f8 100644 --- a/pcbnew/router/pns_utils.h +++ b/pcbnew/router/pns_utils.h @@ -27,7 +27,7 @@ #include #include #include -#include "../../include/geometry/shape_simple.h" +#include namespace PNS { diff --git a/pcbnew/router/pns_via.cpp b/pcbnew/router/pns_via.cpp index c60d1759ab..cbdb76d04d 100644 --- a/pcbnew/router/pns_via.cpp +++ b/pcbnew/router/pns_via.cpp @@ -25,6 +25,7 @@ #include "pns_router.h" #include +#include namespace PNS { diff --git a/pcbnew/router/pns_via.h b/pcbnew/router/pns_via.h index f0154d0aec..b298901feb 100644 --- a/pcbnew/router/pns_via.h +++ b/pcbnew/router/pns_via.h @@ -24,6 +24,7 @@ #include #include +#include #include "../class_track.h" diff --git a/pcbnew/router/router_preview_item.cpp b/pcbnew/router/router_preview_item.cpp index b4b17abd2e..b70e35a862 100644 --- a/pcbnew/router/router_preview_item.cpp +++ b/pcbnew/router/router_preview_item.cpp @@ -24,12 +24,12 @@ #include #include +#include #include "class_track.h" #include #include "router_preview_item.h" -#include "../../include/geometry/shape_simple.h" #include "pns_line.h" #include "pns_segment.h" #include "pns_via.h" diff --git a/pcbnew/specctra_import_export/specctra_export.cpp b/pcbnew/specctra_import_export/specctra_export.cpp index 4329bf413c..49196899a0 100644 --- a/pcbnew/specctra_import_export/specctra_export.cpp +++ b/pcbnew/specctra_import_export/specctra_export.cpp @@ -36,6 +36,7 @@ #include // EDA_FileSelector() #include // RotatePoint() #include +#include // for KiROUND #include // std::set #include // std::map diff --git a/pcbnew/specctra_import_export/specctra_import.cpp b/pcbnew/specctra_import_export/specctra_import.cpp index a9f13589cd..81bf7b9bed 100644 --- a/pcbnew/specctra_import_export/specctra_import.cpp +++ b/pcbnew/specctra_import_export/specctra_import.cpp @@ -45,6 +45,7 @@ #include #include #include "specctra.h" +#include // for KiROUND using namespace DSN; diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index 7e1ec84db4..54e487b5a0 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -46,6 +46,7 @@ #include "point_editor.h" #include #include +#include // for KiROUND #include #include diff --git a/pcbnew/tools/drc.cpp b/pcbnew/tools/drc.cpp index 83f6f27aeb..e7abb4f9aa 100644 --- a/pcbnew/tools/drc.cpp +++ b/pcbnew/tools/drc.cpp @@ -49,6 +49,7 @@ #include #include #include +#include // for KiROUND #include #include diff --git a/pcbnew/tools/drc_clearance_test_functions.cpp b/pcbnew/tools/drc_clearance_test_functions.cpp index 2e7defe63b..950b6d7436 100644 --- a/pcbnew/tools/drc_clearance_test_functions.cpp +++ b/pcbnew/tools/drc_clearance_test_functions.cpp @@ -35,9 +35,10 @@ #include #include #include -#include +#include #include #include +#include // for KiROUND /** diff --git a/pcbnew/tools/grid_helper.cpp b/pcbnew/tools/grid_helper.cpp index 7799df4faa..4e1fdf6df7 100644 --- a/pcbnew/tools/grid_helper.cpp +++ b/pcbnew/tools/grid_helper.cpp @@ -37,6 +37,7 @@ using namespace std::placeholders; #include #include +#include // for KiROUND #include #include #include diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index 7381003002..9eb3f407f2 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -54,6 +54,7 @@ #include #include #include +#include // for KiROUND using namespace std::placeholders; diff --git a/pcbnew/zone_filler.cpp b/pcbnew/zone_filler.cpp index efdceecf10..6574d55e03 100644 --- a/pcbnew/zone_filler.cpp +++ b/pcbnew/zone_filler.cpp @@ -49,6 +49,7 @@ #include #include #include +#include // for KiROUND #include "zone_filler.h" diff --git a/polygon/CMakeLists.txt b/polygon/CMakeLists.txt deleted file mode 100644 index 881f426812..0000000000 --- a/polygon/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -# .cpp files are compiled with extra ${WSHADOW_FLAGS} -if( COMPILER_SUPPORTS_WSHADOW ) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WSHADOW_FLAGS}") -endif() - -include_directories(BEFORE ${INC_BEFORE}) -include_directories( - ${INC_AFTER} - ) - -set(POLYGON_SRCS - math_for_graphics.cpp - polygon_test_point_inside.cpp - clipper.cpp -) - -add_library(polygon STATIC ${POLYGON_SRCS}) - -target_include_directories( polygon PUBLIC - include -) \ No newline at end of file diff --git a/qa/gal/gal_pixel_alignment/CMakeLists.txt b/qa/gal/gal_pixel_alignment/CMakeLists.txt index 72e9169455..dafe237876 100644 --- a/qa/gal/gal_pixel_alignment/CMakeLists.txt +++ b/qa/gal/gal_pixel_alignment/CMakeLists.txt @@ -65,7 +65,7 @@ include_directories( target_link_libraries( test_gal_pixel_alignment qa_pcbnew_utils - polygon + kimath pnsrouter pcbcommon pcad2kicadpcb @@ -80,4 +80,4 @@ target_link_libraries( test_gal_pixel_alignment ${wxWidgets_LIBRARIES} ) -kicad_add_utils_executable( test_gal_pixel_alignment ) \ No newline at end of file +kicad_add_utils_executable( test_gal_pixel_alignment ) diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt index 554bce40a8..28a7ab1940 100644 --- a/thirdparty/CMakeLists.txt +++ b/thirdparty/CMakeLists.txt @@ -21,11 +21,14 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA # - +add_subdirectory( clipper ) add_subdirectory( dxflib_qcad ) add_subdirectory( libcontext ) add_subdirectory( markdown2html ) add_subdirectory( nanosvg ) +add_subdirectory( other_math ) +add_subdirectory( rtree ) add_subdirectory( tinyspline_lib ) +add_subdirectory( ttl ) add_subdirectory( potrace ) add_subdirectory( nlohmann_json ) diff --git a/thirdparty/clipper/CMakeLists.txt b/thirdparty/clipper/CMakeLists.txt new file mode 100644 index 0000000000..8dc47eefad --- /dev/null +++ b/thirdparty/clipper/CMakeLists.txt @@ -0,0 +1,9 @@ + +add_library( clipper OBJECT + clipper.cpp +) + +target_include_directories( clipper + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} +) diff --git a/thirdparty/clipper/LICENSE.BOOSTv1_0 b/thirdparty/clipper/LICENSE.BOOSTv1_0 new file mode 100644 index 0000000000..36b7cd93cd --- /dev/null +++ b/thirdparty/clipper/LICENSE.BOOSTv1_0 @@ -0,0 +1,23 @@ +Boost Software License - Version 1.0 - August 17th, 2003 + +Permission is hereby granted, free of charge, to any person or organization +obtaining a copy of the software and accompanying documentation covered by +this license (the "Software") to use, reproduce, display, distribute, +execute, and transmit the Software, and to prepare derivative works of the +Software, and to permit third-parties to whom the Software is furnished to +do so, all subject to the following: + +The copyright notices in the Software and this entire statement, including +the above license grant, this restriction and the following disclaimer, +must be included in all copies of the Software, in whole or in part, and +all derivative works of the Software, unless such copies or derivative +works are solely in the form of machine-executable object code generated by +a source language processor. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT +SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/thirdparty/clipper/README.txt b/thirdparty/clipper/README.txt new file mode 100644 index 0000000000..1e7557825e --- /dev/null +++ b/thirdparty/clipper/README.txt @@ -0,0 +1,4 @@ +This directory contains the Clipper library for interacting with polygons. +https://sourceforge.net/projects/polyclipping/ + +It is licensed under the Boost Software License, with the license text in this directory. diff --git a/polygon/clipper.cpp b/thirdparty/clipper/clipper.cpp similarity index 100% rename from polygon/clipper.cpp rename to thirdparty/clipper/clipper.cpp diff --git a/polygon/include/clipper.hpp b/thirdparty/clipper/clipper.hpp similarity index 100% rename from polygon/include/clipper.hpp rename to thirdparty/clipper/clipper.hpp diff --git a/thirdparty/other_math/CMakeLists.txt b/thirdparty/other_math/CMakeLists.txt new file mode 100644 index 0000000000..601f76e15d --- /dev/null +++ b/thirdparty/other_math/CMakeLists.txt @@ -0,0 +1,15 @@ + +add_library( othermath OBJECT + math_for_graphics.cpp +) + +target_include_directories( othermath + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} +) + +# kiround is needed +target_include_directories( othermath + PRIVATE + ${PROJECT_SOURCE_DIR}/libs/kimath/include +) diff --git a/thirdparty/other_math/LICENSE.GPLv2 b/thirdparty/other_math/LICENSE.GPLv2 new file mode 100644 index 0000000000..d159169d10 --- /dev/null +++ b/thirdparty/other_math/LICENSE.GPLv2 @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/thirdparty/other_math/README.txt b/thirdparty/other_math/README.txt new file mode 100644 index 0000000000..923af6fc8f --- /dev/null +++ b/thirdparty/other_math/README.txt @@ -0,0 +1,5 @@ +This directory contains miscellaneous mathematical functions from various libraries. + +math_for_graphics.cpp/h is from FreePCB (https://www.freepcb.com/) and is licensed under GPLv2. + +SutherlandHodgmanClipPoly is licensed under GPLv2. diff --git a/polygon/include/SutherlandHodgmanClipPoly.h b/thirdparty/other_math/SutherlandHodgmanClipPoly.h similarity index 100% rename from polygon/include/SutherlandHodgmanClipPoly.h rename to thirdparty/other_math/SutherlandHodgmanClipPoly.h diff --git a/polygon/math_for_graphics.cpp b/thirdparty/other_math/math_for_graphics.cpp similarity index 99% rename from polygon/math_for_graphics.cpp rename to thirdparty/other_math/math_for_graphics.cpp index d88e43458a..3e7d06c91f 100644 --- a/polygon/math_for_graphics.cpp +++ b/thirdparty/other_math/math_for_graphics.cpp @@ -5,11 +5,12 @@ #include #include #include -#include #include // for abs function on ints #include #include +#include + static bool InRange( double x, double xi, double xf ); /* Function FindSegmentIntersections diff --git a/polygon/include/math_for_graphics.h b/thirdparty/other_math/math_for_graphics.h similarity index 100% rename from polygon/include/math_for_graphics.h rename to thirdparty/other_math/math_for_graphics.h diff --git a/thirdparty/rtree/CMakeLists.txt b/thirdparty/rtree/CMakeLists.txt new file mode 100644 index 0000000000..556b69969a --- /dev/null +++ b/thirdparty/rtree/CMakeLists.txt @@ -0,0 +1,7 @@ +add_library( rtree INTERFACE ) + +target_include_directories( rtree INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ) + +target_sources( rtree INTERFACE + ${CMAKE_CURRENT_SOURCE_DIR}/geometry/rtree.h + ) diff --git a/thirdparty/rtree/LICENSE.GPLv3 b/thirdparty/rtree/LICENSE.GPLv3 new file mode 100644 index 0000000000..f288702d2f --- /dev/null +++ b/thirdparty/rtree/LICENSE.GPLv3 @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/thirdparty/rtree/README.txt b/thirdparty/rtree/README.txt new file mode 100644 index 0000000000..87eccff600 --- /dev/null +++ b/thirdparty/rtree/README.txt @@ -0,0 +1,4 @@ +This directory contains the rtree library. A version of this library can be found at https://github.com/nushoin/RTree. + +Upstream does not explicitly list a license term (other than free for all to use), so this code +will fall under the GPLv3, since that is what KiCad uses. diff --git a/include/geometry/rtree.h b/thirdparty/rtree/geometry/rtree.h similarity index 100% rename from include/geometry/rtree.h rename to thirdparty/rtree/geometry/rtree.h diff --git a/thirdparty/ttl/CMakeLists.txt b/thirdparty/ttl/CMakeLists.txt new file mode 100644 index 0000000000..095b99b41e --- /dev/null +++ b/thirdparty/ttl/CMakeLists.txt @@ -0,0 +1,20 @@ + +set( TTL_SRCS + src/halfedge/hetriang.cpp +) + +add_library( ttl STATIC + ${TTL_SRCS} +) + +target_include_directories( ttl + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR}/include +) + +# It needs VECTOR2D from the math library +# Luckily that is header-only +target_include_directories( ttl + PRIVATE + ${PROJECT_SOURCE_DIR}/libs/kimath/include +) diff --git a/thirdparty/ttl/LICENSE.AGPLv3 b/thirdparty/ttl/LICENSE.AGPLv3 new file mode 100644 index 0000000000..be3f7b28e5 --- /dev/null +++ b/thirdparty/ttl/LICENSE.AGPLv3 @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/thirdparty/ttl/README.txt b/thirdparty/ttl/README.txt new file mode 100644 index 0000000000..f4578324e4 --- /dev/null +++ b/thirdparty/ttl/README.txt @@ -0,0 +1,3 @@ +This directory contains the Triangulation Template Library (TTL) from https://github.com/SINTEF-Geometry/TTL. + +It is licensed under the AGPLv3, with the license text in this directory. diff --git a/include/ttl/halfedge/hedart.h b/thirdparty/ttl/include/ttl/halfedge/hedart.h similarity index 100% rename from include/ttl/halfedge/hedart.h rename to thirdparty/ttl/include/ttl/halfedge/hedart.h diff --git a/include/ttl/halfedge/hetraits.h b/thirdparty/ttl/include/ttl/halfedge/hetraits.h similarity index 100% rename from include/ttl/halfedge/hetraits.h rename to thirdparty/ttl/include/ttl/halfedge/hetraits.h diff --git a/include/ttl/halfedge/hetriang.h b/thirdparty/ttl/include/ttl/halfedge/hetriang.h similarity index 99% rename from include/ttl/halfedge/hetriang.h rename to thirdparty/ttl/include/ttl/halfedge/hetriang.h index 0d30b7ed2c..84ec2cdce6 100644 --- a/include/ttl/halfedge/hetriang.h +++ b/thirdparty/ttl/include/ttl/halfedge/hetriang.h @@ -52,7 +52,6 @@ #include #include #include -#include #include class BOARD_CONNECTED_ITEM; diff --git a/include/ttl/ttl.h b/thirdparty/ttl/include/ttl/ttl.h similarity index 100% rename from include/ttl/ttl.h rename to thirdparty/ttl/include/ttl/ttl.h diff --git a/include/ttl/ttl_util.h b/thirdparty/ttl/include/ttl/ttl_util.h similarity index 100% rename from include/ttl/ttl_util.h rename to thirdparty/ttl/include/ttl/ttl_util.h diff --git a/common/geometry/hetriang.cpp b/thirdparty/ttl/src/halfedge/hetriang.cpp similarity index 100% rename from common/geometry/hetriang.cpp rename to thirdparty/ttl/src/halfedge/hetriang.cpp diff --git a/utils/idftools/CMakeLists.txt b/utils/idftools/CMakeLists.txt index 683065dc0b..c6dbff6dfa 100644 --- a/utils/idftools/CMakeLists.txt +++ b/utils/idftools/CMakeLists.txt @@ -18,15 +18,29 @@ if( MINGW ) endif( MINGW ) add_library( idf3 STATIC ${IDF3_FILES} ) +target_link_libraries( idf3 + kimath + ) add_executable( idfcyl idf_cylinder.cpp ) add_executable( idfrect idf_rect.cpp ) add_executable( dxf2idf dxf2idfmain.cpp dxf2idf.cpp ) add_executable( idf2vrml idf2vrml.cpp ) -target_link_libraries( dxf2idf dxflib_qcad idf3 ${wxWidgets_LIBRARIES} ) +target_link_libraries( dxf2idf + dxflib_qcad + idf3 + kimath + ${OPENGL_LIBRARIES} + ${wxWidgets_LIBRARIES} + ) -target_link_libraries( idf2vrml idf3 common ${OPENGL_LIBRARIES} ${wxWidgets_LIBRARIES} ) +target_link_libraries( idf2vrml + idf3 + kimath + ${OPENGL_LIBRARIES} + ${wxWidgets_LIBRARIES} + ) if( APPLE ) # puts binaries into the *.app bundle while linking diff --git a/utils/kicad-ogltest/CMakeLists.txt b/utils/kicad-ogltest/CMakeLists.txt index 0d8eaa9bb6..679ab54fed 100644 --- a/utils/kicad-ogltest/CMakeLists.txt +++ b/utils/kicad-ogltest/CMakeLists.txt @@ -21,9 +21,10 @@ add_executable( kicad-ogltest WIN32 ${OGLTEST_FILES} ) target_link_libraries( kicad-ogltest + kimath gal common - polygon + ${OPENGL_LIBRARIES} ${wxWidgets_LIBRARIES} ) if( APPLE )