Refactor all math into a new kimath library
* Split up the thirdparty code into the thirdparty folder (#3637) * Create a new kimath static library containing all the math functions This is part of cleaning the build system for #1906.
This commit is contained in:
parent
270aaec443
commit
13b6028e1b
|
@ -34,6 +34,7 @@
|
|||
#include <3d_math.h>
|
||||
#include "3d_fastmath.h"
|
||||
#include <geometry/geometry_utils.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
/**
|
||||
* Trace mask used to enable or disable the trace output of this class.
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <class_board.h>
|
||||
#include <class_module.h>
|
||||
#include <3d_math.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
#include <base_units.h>
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ add_dependencies( 3d-viewer pcbcommon )
|
|||
|
||||
target_link_libraries( 3d-viewer
|
||||
gal
|
||||
polygon
|
||||
kimath
|
||||
${Boost_}
|
||||
${wxWidgets_LIBRARIES}
|
||||
${OPENGL_LIBRARIES}
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -26,13 +26,9 @@
|
|||
#include "bitmap2component.h"
|
||||
#include <bitmap_io.h>
|
||||
#include <bitmaps.h>
|
||||
#include <build_version.h>
|
||||
#include <confirm.h>
|
||||
#include <fctsys.h>
|
||||
#include <gestfich.h>
|
||||
#include <kiface_i.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
#include <kiway.h>
|
||||
#include <macros.h>
|
||||
#include <pgm_base.h>
|
||||
#include <potracelib.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -29,13 +29,15 @@
|
|||
* @brief BASE_SCREEN object implementation.
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <macros.h>
|
||||
#include <common.h>
|
||||
#include <base_struct.h>
|
||||
|
||||
#include <base_screen.h>
|
||||
#include <id.h>
|
||||
#include <base_struct.h>
|
||||
#include <base_units.h>
|
||||
#include <common.h>
|
||||
#include <fctsys.h>
|
||||
#include <id.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
#include <macros.h>
|
||||
#include <trace_helpers.h>
|
||||
|
||||
|
||||
|
|
|
@ -34,11 +34,13 @@
|
|||
* depending on the application.
|
||||
*/
|
||||
|
||||
#include <macros.h>
|
||||
#include <base_struct.h>
|
||||
#include <title_block.h>
|
||||
#include <common.h>
|
||||
#include <base_units.h>
|
||||
#include <common.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
#include <macros.h>
|
||||
#include <title_block.h>
|
||||
|
||||
#include "libeval/numeric_evaluator.h"
|
||||
|
||||
|
||||
|
|
|
@ -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 <bitmap_base.h>
|
||||
#include <eda_rect.h> // for EDA_RECT
|
||||
#include <gal/color4d.h> // for COLOR4D
|
||||
#include <gr_basic.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
#include <memory> // for make_unique, unique_ptr
|
||||
#include <plotter.h>
|
||||
#include <richio.h>
|
||||
#include <wx/bitmap.h> // for wxBitmap
|
||||
#include <wx/mstream.h>
|
||||
|
||||
|
||||
|
|
|
@ -23,19 +23,15 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <gr_basic.h>
|
||||
#include <pgm_base.h>
|
||||
#include <common.h>
|
||||
#include <kicad_string.h>
|
||||
#include <gestfich.h>
|
||||
#include <eda_base_frame.h>
|
||||
#include <config_params.h>
|
||||
|
||||
#include <wx/apptrait.h>
|
||||
#include <wx/stdpaths.h>
|
||||
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <colors.h> // for ColorByName, EDA_COLOR_T, UNSPECIFIE...
|
||||
#include <common.h> // for LOCALE_IO
|
||||
#include <config_params.h> // for PARAM_CFG_INT_WITH_SCALE, PARAM_CFG_...
|
||||
#include <gal/color4d.h> // for COLOR4D
|
||||
#include <math/util.h> // for KiROUND
|
||||
#include <wx/config.h> // for wxConfigBase
|
||||
#include <wx/debug.h> // for wxASSERT
|
||||
#include <wx/wx.h> // for wxString, operator!=, operator==
|
||||
|
||||
|
||||
void wxConfigLoadParams( wxConfigBase* aCfg,
|
||||
|
|
|
@ -21,31 +21,31 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <common.h>
|
||||
#include <project.h>
|
||||
#include <confirm.h>
|
||||
#include <gr_basic.h>
|
||||
#include <base_struct.h>
|
||||
#include <title_block.h>
|
||||
#include <eda_draw_frame.h>
|
||||
#include <ws_data_model.h>
|
||||
#include <base_screen.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <base_struct.h>
|
||||
#include <common.h>
|
||||
#include <confirm.h>
|
||||
#include <dialog_page_settings.h>
|
||||
#include <eda_draw_frame.h>
|
||||
#include <fctsys.h>
|
||||
#include <gr_basic.h>
|
||||
#include <kiface_i.h>
|
||||
#include <math/util.h> // for KiROUND, Clamp
|
||||
#include <project.h>
|
||||
#include <title_block.h>
|
||||
#include <tool/actions.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <ws_data_model.h>
|
||||
#include <ws_painter.h>
|
||||
#include <wx/valgen.h>
|
||||
#include <wx/tokenzr.h>
|
||||
|
||||
#ifdef EESCHEMA
|
||||
#include <sch_screen.h>
|
||||
#include <general.h>
|
||||
#include <sch_screen.h>
|
||||
#endif
|
||||
|
||||
#include <ws_painter.h>
|
||||
#include <dialog_page_settings.h>
|
||||
#include <tool/actions.h>
|
||||
#include <kiface_i.h>
|
||||
|
||||
#define MAX_PAGE_EXAMPLE_SIZE 200
|
||||
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#ifndef _DIALOG_PAGES_SETTINGS_H_
|
||||
#define _DIALOG_PAGES_SETTINGS_H_
|
||||
|
||||
#include <page_info.h>
|
||||
#include <title_block.h>
|
||||
#include <widgets/unit_binder.h>
|
||||
#include <dialog_page_settings_base.h>
|
||||
|
||||
|
|
|
@ -27,15 +27,32 @@
|
|||
* @brief Implementation of base KiCad text object.
|
||||
*/
|
||||
|
||||
#include <eda_text.h>
|
||||
#include <gr_text.h>
|
||||
#include <eda_rect.h>
|
||||
#include <macros.h>
|
||||
#include <trigo.h> // RotatePoint
|
||||
#include <algorithm> // for max
|
||||
#include <stddef.h> // for NULL
|
||||
#include <type_traits> // for swap
|
||||
#include <vector> // for vector
|
||||
|
||||
#include <basic_gal.h>
|
||||
#include <base_struct.h> // for EDA_ITEM
|
||||
#include <base_units.h>
|
||||
#include <convert_to_biu.h>
|
||||
#include <basic_gal.h> // for BASIC_GAL, basic_gal
|
||||
#include <common.h> // for wxStringSplit
|
||||
#include <convert_to_biu.h> // for Mils2iu
|
||||
#include <core/typeinfo.h> // for KICAD_T, SCH_LABEL_T, SCH_TEXT_T, SCH_G...
|
||||
#include <eda_rect.h> // for EDA_RECT
|
||||
#include <eda_text.h> // for EDA_TEXT, TEXT_EFFECTS, GR_TEXT_VJUSTIF...
|
||||
#include <gal/color4d.h> // for COLOR4D, COLOR4D::BLACK
|
||||
#include <gal/stroke_font.h> // for STROKE_FONT
|
||||
#include <gr_text.h> // for GRText
|
||||
#include <kicad_string.h> // for UnescapeString
|
||||
#include <math/util.h> // for KiROUND
|
||||
#include <math/vector2d.h> // for VECTOR2D
|
||||
#include <trigo.h> // for RotatePoint
|
||||
|
||||
#include <wx/debug.h> // for wxASSERT
|
||||
#include <wx/wx.h> // 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:
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <gal/cairo/cairo_compositor.h>
|
||||
#include <gal/definitions.h>
|
||||
#include <geometry/shape_poly_set.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
#include <bitmap_base.h>
|
||||
|
||||
#include <limits>
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include <gal/graphics_abstraction_layer.h>
|
||||
#include <gal/definitions.h>
|
||||
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
#include <cmath>
|
||||
|
||||
using namespace KIGFX;
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <geometry/shape_poly_set.h>
|
||||
#include <bitmap_base.h>
|
||||
#include <bezier_curves.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
#include <macros.h>
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include <gal/stroke_font.h>
|
||||
#include <gal/graphics_abstraction_layer.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
#include <wx/string.h>
|
||||
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <wx/graphics.h>
|
||||
#include <wx/tokenzr.h>
|
||||
#include <geometry/geometry_utils.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
static const bool FILLED = true;
|
||||
static const bool NOT_FILLED = false;
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <macros.h>
|
||||
#include <base_screen.h>
|
||||
#include <gr_text.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
#include <basic_gal.h>
|
||||
|
||||
|
|
|
@ -22,11 +22,17 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
|
||||
#include <bitset> // for bitset, __bitset<>::ref...
|
||||
#include <cassert>
|
||||
#include <cstdarg>
|
||||
#include <iostream> // for string, endl, basic_ost...
|
||||
#include <stddef.h> // for size_t
|
||||
|
||||
#include <layers_id_colors_and_visibility.h>
|
||||
#include <math/util.h> // for Clamp
|
||||
#include <layers_id_colors_and_visibility.h> // for LSET, PCB_LAYER_ID, LSEQ
|
||||
#include <macros.h> // for arrayDim
|
||||
#include <wx/debug.h> // for wxASSERT, wxASSERT_MSG
|
||||
#include <wx/wx.h> // for wxT, wxChar
|
||||
|
||||
|
||||
LSET::LSET( const PCB_LAYER_ID* aArray, unsigned aCount ) :
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include <fctsys.h>
|
||||
#include <gr_text.h>
|
||||
#include <eda_rect.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
#include <view/view.h>
|
||||
#include <ws_painter.h>
|
||||
#include <title_block.h>
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <macros.h>
|
||||
#include <kicad_string.h>
|
||||
#include <convert_basic_shapes_to_polygon.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
#include <build_version.h>
|
||||
|
||||
|
|
|
@ -203,6 +203,8 @@
|
|||
#include <macros.h>
|
||||
#include <kicad_string.h>
|
||||
#include <convert_basic_shapes_to_polygon.h>
|
||||
#include <math/util.h> // 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
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <kicad_string.h>
|
||||
#include <wx/zstream.h>
|
||||
#include <wx/mstream.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <macros.h>
|
||||
#include <kicad_string.h>
|
||||
#include <convert_basic_shapes_to_polygon.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
/* Forward declaration of the font width metrics
|
||||
(yes extern! this is the way to forward declare variables */
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include <geometry/shape_line_chain.h>
|
||||
#include <geometry/geometry_utils.h>
|
||||
#include <bezier_curves.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
PLOTTER::PLOTTER( )
|
||||
{
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include <preview_items/arc_geom_manager.h>
|
||||
|
||||
#include <common.h> // KiROUND
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
using namespace KIGFX::PREVIEW;
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "tool/edit_points.h"
|
||||
|
||||
#include <geometry/seg.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
#include <common.h>
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include <gal/graphics_abstraction_layer.h>
|
||||
#include <gal/color4d.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
#include "tool/edit_points.h"
|
||||
|
||||
bool EDIT_POINT::WithinPoint( const VECTOR2I& aPoint, unsigned int aSize ) const
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
#include <view/zoom_controller.h>
|
||||
#include <gal/graphics_abstraction_layer.h>
|
||||
#include <tool/tool_dispatcher.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
|
||||
using namespace KIGFX;
|
||||
|
||||
|
|
|
@ -89,6 +89,7 @@ target_link_libraries( cvpcb_kiface
|
|||
3d-viewer
|
||||
gal
|
||||
common
|
||||
kimath
|
||||
${wxWidgets_LIBRARIES}
|
||||
${GDI_PLUS_LIBRARIES}
|
||||
)
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <pgm_base.h>
|
||||
#include <kiface_i.h>
|
||||
#include <dialog_text_entry.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
#include <general.h>
|
||||
#include <widgets/wx_grid.h>
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <base_units.h>
|
||||
#include <msgpanel.h>
|
||||
#include <bitmaps.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
#include <general.h>
|
||||
#include <lib_arc.h>
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#include <base_units.h>
|
||||
#include <msgpanel.h>
|
||||
#include <bitmaps.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
#include <general.h>
|
||||
#include <lib_circle.h>
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#define LIB_CIRCLE_H
|
||||
|
||||
#include <lib_item.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
|
||||
class LIB_CIRCLE : public LIB_ITEM
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <sch_edit_frame.h>
|
||||
#include <base_units.h>
|
||||
#include <msgpanel.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
#include <general.h>
|
||||
#include <lib_edit_frame.h>
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
|
||||
|
||||
#include <sch_item.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
|
||||
class NETLIST_OBJECT_LIST;
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#include <connection_graph.h>
|
||||
#include <geometry/shape_line_chain.h>
|
||||
#include <bezier_curves.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
#include "sch_painter.h"
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <plotter.h>
|
||||
#include <kicad_string.h>
|
||||
#include <msgpanel.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
#include <sch_sheet.h>
|
||||
#include <sch_sheet_path.h>
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <msgpanel.h>
|
||||
#include <gal/stroke_font.h>
|
||||
#include <bitmaps.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
#include <sch_text.h>
|
||||
#include <netlist_object.h>
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include <invoke_sch_dialog.h>
|
||||
#include <project.h>
|
||||
#include <dialogs/dialog_display_info_HTML_base.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
|
||||
EE_INSPECTION_TOOL::EE_INSPECTION_TOOL()
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include <painter.h>
|
||||
#include <eeschema_id.h> // For MAX_SELECT_ITEM_IDS
|
||||
#include <menus_helpers.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
|
||||
SELECTION_CONDITION EE_CONDITIONS::Empty = [] (const SELECTION& aSelection )
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include <sch_legacy_plugin.h>
|
||||
#include <lib_text.h>
|
||||
#include "lib_edit_tool.h"
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
|
||||
LIB_EDIT_TOOL::LIB_EDIT_TOOL() :
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include <dialogs/dialog_edit_sheet_pin.h>
|
||||
#include <dialogs/dialog_edit_one_field.h>
|
||||
#include "sch_drawing_tools.h"
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
|
||||
char g_lastBusEntryShape = '/';
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
#include <invoke_sch_dialog.h>
|
||||
#include <dialogs/dialog_paste_special.h>
|
||||
#include <netlist_exporters/netlist_exporter_pspice.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
|
||||
int SCH_EDITOR_CONTROL::New( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <transform.h>
|
||||
#include <common.h>
|
||||
#include <eda_rect.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
|
||||
bool TRANSFORM::operator==( const TRANSFORM& aTransform ) const
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <convert_to_biu.h>
|
||||
#include <convert_basic_shapes_to_polygon.h>
|
||||
#include <gr_basic.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
#include <gerbview.h>
|
||||
#include <gerber_file_image.h>
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
#include <fctsys.h>
|
||||
#include <common.h>
|
||||
#include <confirm.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <gerber_file_image_list.h>
|
||||
#include <kicad_string.h>
|
||||
#include <geometry/shape_arc.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( GERBER_FILE_IMAGE* aGerberImageFile ) :
|
||||
EDA_ITEM( (EDA_ITEM*)NULL, GERBER_DRAW_ITEM_T )
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include <gal/gal_print.h>
|
||||
#include <view/view.h>
|
||||
#include <gerbview_painter.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
|
||||
GERBVIEW_PRINTOUT::GERBVIEW_PRINTOUT( GBR_LAYOUT* aLayout, const BOARD_PRINTOUT_SETTINGS& aParams,
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include <fctsys.h>
|
||||
#include <common.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
#include <gerber_file_image.h>
|
||||
#include <base_units.h>
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include <common.h>
|
||||
#include <macros.h>
|
||||
#include <base_units.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
|
||||
#include <gerbview.h>
|
||||
#include <gerber_file_image.h>
|
||||
|
|
|
@ -34,9 +34,10 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include <math/vector2d.h>
|
||||
#include <common.h>
|
||||
#include <convert_to_biu.h>
|
||||
#include <math/util.h> // for KiROUND
|
||||
#include <math/vector2d.h>
|
||||
|
||||
//TODO: Abstract Base Units to a single class
|
||||
|
||||
|
|
|
@ -69,33 +69,6 @@ typedef uint32_t timestamp_t;
|
|||
#define TEXT_ANGLE_HORIZ 0
|
||||
#define TEXT_ANGLE_VERT 900
|
||||
|
||||
//-----<KiROUND KIT>------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* 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 <typename fp_type, typename ret_type = int>
|
||||
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<ret_type>::max() < ret ||
|
||||
std::numeric_limits<ret_type>::lowest() > ret )
|
||||
{
|
||||
wxLogDebug
|
||||
( "Overflow KiROUND converting value %f to %s", double( v ), typeid(ret_type).name() );
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ret_type( max_ret( ret ) );
|
||||
}
|
||||
|
||||
//-----</KiROUND KIT>-----------------------------------------------------------
|
||||
|
||||
|
||||
enum class EDA_UNITS
|
||||
{
|
||||
INCHES = 0,
|
||||
|
|
|
@ -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:
|
||||
* <p>
|
||||
* result is: lower <= value <= upper
|
||||
*/
|
||||
template <typename T> 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<MemberType>; } typedef std::vector<MemberType> TypeName;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#ifndef SELECTION_H
|
||||
#define SELECTION_H
|
||||
|
||||
#include <core/optional.h>
|
||||
#include <deque>
|
||||
#include <eda_rect.h>
|
||||
#include <base_struct.h>
|
||||
|
|
|
@ -22,5 +22,5 @@
|
|||
#
|
||||
|
||||
# Build file for generic re-useable libraries
|
||||
|
||||
add_subdirectory( sexpr )
|
||||
add_subdirectory( kimath )
|
||||
add_subdirectory( sexpr )
|
||||
|
|
|
@ -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}
|
||||
$<TARGET_OBJECTS:clipper>
|
||||
$<TARGET_OBJECTS:othermath>
|
||||
)
|
||||
|
||||
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
|
||||
$<TARGET_PROPERTY:clipper,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:othermath,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:rtree,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
|
||||
# core/optional.h is needed for OPT types
|
||||
target_include_directories( kimath PRIVATE
|
||||
${PROJECT_SOURCE_DIR}/include
|
||||
${wxWidgets_LIBRARIES}
|
||||
${Boost_INCLUDE_DIR}
|
||||
)
|
|
@ -29,13 +29,8 @@
|
|||
* @file convert_basic_shapes_to_polygon.h
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <trigo.h>
|
||||
#include <macros.h>
|
||||
|
||||
#include <geometry/shape_poly_set.h>
|
||||
#include <wx/gdicmn.h> // for wxPoint
|
||||
|
||||
// The chamfer positions of chamfered rect shape.
|
||||
// the position is relative to a pad with orientation = 0
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include <geometry/seg.h>
|
||||
#include <geometry/shape_line_chain.h>
|
||||
#include <math/vector2d.h>
|
||||
|
||||
// believe or not, X11 headers have a F****ING macro called Opposite...
|
||||
#undef Opposite
|
|
@ -30,6 +30,9 @@
|
|||
#ifndef GEOMETRY_UTILS_H
|
||||
#define GEOMETRY_UTILS_H
|
||||
|
||||
#include <math.h> // for copysign
|
||||
#include <stdlib.h> // for abs
|
||||
|
||||
#include <math/vector2d.h>
|
||||
|
||||
class EDA_RECT;
|
|
@ -25,14 +25,18 @@
|
|||
#ifndef __POLY_GRID_PARTITION_H
|
||||
#define __POLY_GRID_PARTITION_H
|
||||
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include <geometry/seg.h>
|
||||
#include <geometry/shape_line_chain.h>
|
||||
#include <geometry/shape_rect.h>
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <unordered_map>
|
||||
#include <set>
|
||||
#include <math/util.h>
|
||||
#include <math/vector2d.h>
|
||||
|
||||
/**
|
||||
* 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;
|
|
@ -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 <wx/gdicmn.h> // for wxPoint definition
|
||||
#else
|
||||
// define here wxPoint if we want to compile outside wxWidgets
|
|
@ -47,11 +47,14 @@
|
|||
#define __POLYGON_TRIANGULATION_H
|
||||
|
||||
#include <algorithm>
|
||||
#include <deque>
|
||||
#include <cmath>
|
||||
#include <vector>
|
||||
#include <math/box2.h>
|
||||
|
||||
#include "clipper.hpp"
|
||||
#include <clipper.hpp>
|
||||
#include <geometry/shape_line_chain.h>
|
||||
#include <geometry/shape_poly_set.h>
|
||||
#include <math/box2.h>
|
||||
#include <math/vector2d.h>
|
||||
|
||||
class PolygonTriangulation
|
||||
{
|
|
@ -25,11 +25,14 @@
|
|||
#ifndef __SEG_H
|
||||
#define __SEG_H
|
||||
|
||||
#include <cstdio>
|
||||
#include <climits>
|
||||
#include <math.h> // for sqrt
|
||||
#include <stdlib.h> // for abs
|
||||
#include <ostream> // for operator<<, ostream, basic_os...
|
||||
#include <type_traits> // for swap
|
||||
|
||||
#include <math/vector2d.h>
|
||||
#include <core/optional.h>
|
||||
#include <math/util.h> // for rescale
|
||||
#include <math/vector2d.h>
|
||||
|
||||
typedef OPT<VECTOR2I> OPT_VECTOR2I;
|
||||
|
|
@ -25,13 +25,15 @@
|
|||
#ifndef __SHAPE_H
|
||||
#define __SHAPE_H
|
||||
|
||||
#include <string>
|
||||
#include <assert.h> // for assert
|
||||
#include <sstream>
|
||||
#include <stddef.h> // for NULL
|
||||
|
||||
#include <geometry/seg.h>
|
||||
|
||||
#include <math/vector2d.h>
|
||||
#include <math/box2.h>
|
||||
|
||||
#include <geometry/seg.h>
|
||||
|
||||
/**
|
||||
* Enum SHAPE_TYPE
|
|
@ -25,8 +25,10 @@
|
|||
#ifndef __SHAPE_ARC_H
|
||||
#define __SHAPE_ARC_H
|
||||
|
||||
#include <geometry/shape.h>
|
||||
#include <geometry/seg.h>
|
||||
#include <geometry/shape.h>
|
||||
#include <math/box2.h> // for BOX2I
|
||||
#include <math/vector2d.h> // for VECTOR2I
|
||||
|
||||
class SHAPE_LINE_CHAIN;
|
||||
|
|
@ -25,7 +25,9 @@
|
|||
#ifndef __SHAPE_CIRCLE_H
|
||||
#define __SHAPE_CIRCLE_H
|
||||
|
||||
#include "shape.h"
|
||||
#include <geometry/shape.h>
|
||||
#include <math/box2.h>
|
||||
#include <math/vector2d.h>
|
||||
|
||||
class SHAPE_CIRCLE : public SHAPE
|
||||
{
|
|
@ -27,7 +27,7 @@
|
|||
#define __SHAPE_FILE_IO_H
|
||||
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <string> // for string
|
||||
|
||||
class SHAPE;
|
||||
|
|
@ -27,9 +27,10 @@
|
|||
#define __SHAPE_INDEX_H
|
||||
|
||||
#include <vector>
|
||||
#include <geometry/shape.h>
|
||||
#include <geometry/rtree.h>
|
||||
|
||||
#include <geometry/rtree.h>
|
||||
#include <geometry/shape.h>
|
||||
#include <math/box2.h>
|
||||
|
||||
/**
|
||||
* shapeFunctor template function
|
|
@ -25,6 +25,12 @@
|
|||
#ifndef __SHAPE_INDEX_LIST_H
|
||||
#define __SHAPE_INDEX_LIST_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <geometry/shape.h>
|
||||
#include <math/box2.h>
|
||||
#include <math/vector2d.h>
|
||||
|
||||
template <class T>
|
||||
const SHAPE* defaultShapeFunctor( const T aItem )
|
||||
{
|
|
@ -26,17 +26,20 @@
|
|||
#ifndef __SHAPE_LINE_CHAIN
|
||||
#define __SHAPE_LINE_CHAIN
|
||||
|
||||
|
||||
#include <algorithm> // for max
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/gdicmn.h> // for wxPoint
|
||||
|
||||
#include <core/optional.h>
|
||||
|
||||
#include <math/vector2d.h>
|
||||
#include <geometry/shape.h>
|
||||
#include <geometry/seg.h>
|
||||
|
||||
#include <clipper.hpp>
|
||||
#include <geometry/seg.h>
|
||||
#include <geometry/shape.h>
|
||||
#include <math/box2.h> // for BOX2I
|
||||
#include <math/vector2d.h>
|
||||
|
||||
|
||||
/**
|
||||
* Class SHAPE_LINE_CHAIN
|
|
@ -26,12 +26,21 @@
|
|||
#ifndef __SHAPE_POLY_SET_H
|
||||
#define __SHAPE_POLY_SET_H
|
||||
|
||||
#include <vector>
|
||||
#include <cstdio>
|
||||
#include <deque> // for deque
|
||||
#include <iosfwd> // for string, stringstream
|
||||
#include <memory>
|
||||
#include <set> // for set
|
||||
#include <stdexcept> // for out_of_range
|
||||
#include <stdlib.h> // for abs
|
||||
#include <vector>
|
||||
|
||||
#include <clipper.hpp> // for ClipType, PolyTree (ptr only)
|
||||
#include <geometry/seg.h> // for SEG
|
||||
#include <geometry/shape.h>
|
||||
#include <geometry/shape_line_chain.h>
|
||||
|
||||
#include <math/box2.h> // for BOX2I
|
||||
#include <math/vector2d.h> // for VECTOR2I
|
||||
#include <md5_hash.h>
|
||||
|
||||
|
|
@ -25,10 +25,11 @@
|
|||
#ifndef __SHAPE_RECT_H
|
||||
#define __SHAPE_RECT_H
|
||||
|
||||
#include <geometry/seg.h>
|
||||
#include <geometry/shape.h>
|
||||
#include <geometry/shape_line_chain.h>
|
||||
#include <geometry/shape_circle.h>
|
||||
#include <geometry/seg.h>
|
||||
#include <math/box2.h>
|
||||
#include <math/vector2d.h>
|
||||
|
||||
class SHAPE_RECT : public SHAPE
|
||||
{
|
|
@ -25,8 +25,10 @@
|
|||
#ifndef __SHAPE_SEGMENT_H
|
||||
#define __SHAPE_SEGMENT_H
|
||||
|
||||
#include <geometry/shape.h>
|
||||
#include <geometry/seg.h>
|
||||
#include <geometry/shape.h>
|
||||
#include <math/box2.h>
|
||||
#include <math/vector2d.h>
|
||||
|
||||
class SHAPE_SEGMENT : public SHAPE {
|
||||
|
|
@ -24,11 +24,11 @@
|
|||
#ifndef __SHAPE_SIMPLE_H
|
||||
#define __SHAPE_SIMPLE_H
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <geometry/shape.h>
|
||||
#include <geometry/seg.h>
|
||||
#include <geometry/shape.h>
|
||||
#include <geometry/shape_line_chain.h>
|
||||
#include <math/box2.h>
|
||||
#include <math/vector2d.h>
|
||||
|
||||
/**
|
||||
* Class SHAPE_SIMPLE
|
|
@ -30,6 +30,7 @@
|
|||
#include <math/vector2d.h>
|
||||
#include <limits>
|
||||
|
||||
// Needed for the OPT definition
|
||||
#include <core/optional.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 <cstdint>
|
||||
#include <limits>
|
||||
#include <typeinfo>
|
||||
#include <wx/debug.h>
|
||||
#include <wx/log.h>
|
||||
|
||||
/**
|
||||
* 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:
|
||||
* <p>
|
||||
* result is: lower <= value <= upper
|
||||
*/
|
||||
template <typename T> 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 <typename fp_type, typename ret_type = int>
|
||||
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<ret_type>::max() < ret ||
|
||||
std::numeric_limits<ret_type>::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
|
|
@ -32,10 +32,10 @@
|
|||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include <math/math_util.h>
|
||||
#include <math/util.h>
|
||||
|
||||
#ifdef WX_COMPATIBILITY
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#endif
|
||||
|
||||
/**
|
|
@ -26,6 +26,10 @@
|
|||
/************************************/
|
||||
|
||||
#include <bezier_curves.h>
|
||||
#include <math/vector2d.h> // for VECTOR2D, operator*, VECTOR2
|
||||
#include <wx/debug.h> // for wxASSERT
|
||||
#include <wx/gdicmn.h> // for wxPoint
|
||||
|
||||
|
||||
BEZIER_POLY::BEZIER_POLY( const std::vector<wxPoint>& aControlPoints )
|
||||
{
|
|
@ -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 <vector>
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <trigo.h>
|
||||
#include <macros.h>
|
||||
#include <common.h>
|
||||
#include <algorithm> // for max, min
|
||||
#include <math.h> // for atan2
|
||||
#include <type_traits> // for swap
|
||||
|
||||
#include <convert_basic_shapes_to_polygon.h>
|
||||
#include <geometry/geometry_utils.h>
|
||||
#include <geometry/shape_line_chain.h> // for SHAPE_LINE_CHAIN
|
||||
#include <geometry/shape_poly_set.h> // for SHAPE_POLY_SET, SHAPE_POLY_SE...
|
||||
#include <math/util.h>
|
||||
#include <math/vector2d.h> // for VECTOR2I
|
||||
#include <trigo.h>
|
||||
|
||||
|
||||
void TransformCircleToPolygon( SHAPE_LINE_CHAIN& aBuffer,
|
|
@ -55,12 +55,14 @@
|
|||
* Points in the result will be listed in counter-clockwise order.
|
||||
*/
|
||||
|
||||
#include <geometry/shape_poly_set.h>
|
||||
#include <geometry/convex_hull.h>
|
||||
#include <geometry/shape_line_chain.h> // for SHAPE_LINE_CHAIN
|
||||
#include <geometry/shape_poly_set.h>
|
||||
#include <math/vector2d.h> // for VECTOR2I
|
||||
#include <trigo.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <wx/wx.h>
|
||||
#include <trigo.h>
|
||||
|
||||
|
||||
typedef long long coord2_t; // must be big enough to hold 2*max(|coordinate|)^2
|
|
@ -27,8 +27,12 @@
|
|||
* @brief a few functions useful in geometry calculations.
|
||||
*/
|
||||
|
||||
#include <stdint.h> // for int64_t
|
||||
#include <algorithm> // for max, min
|
||||
|
||||
#include <eda_rect.h>
|
||||
#include <geometry/geometry_utils.h>
|
||||
#include <math/util.h> // for round_nearest
|
||||
|
||||
// To approximate a circle by segments, a minimal seg count is mandatory
|
||||
#define MIN_SEGCOUNT_FOR_CIRCLE 6
|
|
@ -26,10 +26,7 @@
|
|||
* @file polygon_test_point_inside.cpp
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
#include <vector>
|
||||
|
||||
#include "polygon_test_point_inside.h"
|
||||
#include <geometry/polygon_test_point_inside.h>
|
||||
|
||||
/* 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)
|
|
@ -22,7 +22,10 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <algorithm> // for min
|
||||
#include <geometry/seg.h>
|
||||
#include <math/util.h> // for rescale
|
||||
#include <math/vector2d.h> // for VECTOR2I, VECTOR2
|
||||
|
||||
template <typename T>
|
||||
int sgn( T aVal )
|
|
@ -22,12 +22,18 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <assert.h> // for assert
|
||||
#include <math.h> // for cos, sin, M_PI, atan2, ceil
|
||||
#include <type_traits> // for swap
|
||||
#include <vector>
|
||||
|
||||
#include <geometry/geometry_utils.h>
|
||||
#include <geometry/seg.h> // for SEG
|
||||
#include <geometry/shape_arc.h>
|
||||
#include <geometry/shape_line_chain.h>
|
||||
#include <math/box2.h> // for BOX2I
|
||||
#include <math/vector2d.h> // for VECTOR2I, VECTOR2D, VECTOR2
|
||||
|
||||
|
||||
bool SHAPE_ARC::Collide( const SEG& aSeg, int aClearance ) const
|
||||
{
|
|
@ -22,16 +22,22 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
#include <math/vector2d.h>
|
||||
|
||||
#include <assert.h> // for assert
|
||||
#include <cmath>
|
||||
#include <limits.h> // for INT_MAX
|
||||
#include <stdlib.h> // for abs
|
||||
|
||||
#include <geometry/seg.h> // for SEG
|
||||
#include <geometry/shape.h>
|
||||
#include <geometry/shape_arc.h>
|
||||
#include <geometry/shape_line_chain.h>
|
||||
#include <geometry/shape_circle.h>
|
||||
#include <geometry/shape_rect.h>
|
||||
#include <geometry/shape_segment.h>
|
||||
#include "../../include/geometry/shape_simple.h"
|
||||
#include <geometry/shape_simple.h>
|
||||
#include <math/box2.h> // for BOX2I
|
||||
#include <math/vector2d.h>
|
||||
|
||||
typedef VECTOR2I::extended_type ecoord;
|
||||
|
|
@ -22,8 +22,8 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <string>
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
|
||||
#include <geometry/shape.h>
|
||||
#include <geometry/shape_file_io.h>
|
|
@ -23,11 +23,17 @@
|
|||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <limits.h> // for INT_MAX
|
||||
#include <math.h> // for hypot
|
||||
#include <string> // for basic_string
|
||||
|
||||
#include <clipper.hpp>
|
||||
#include <geometry/seg.h> // for SEG, OPT_VECTOR2I
|
||||
#include <geometry/shape_line_chain.h>
|
||||
#include <geometry/shape_circle.h>
|
||||
#include <trigo.h>
|
||||
#include "clipper.hpp"
|
||||
#include <math/box2.h> // for BOX2I
|
||||
#include <math/util.h> // for rescale
|
||||
#include <math/vector2d.h> // for VECTOR2, VECTOR2I
|
||||
class SHAPE;
|
||||
|
||||
|
||||
ClipperLib::Path SHAPE_LINE_CHAIN::convertToClipper( bool aRequiredOrientation ) const
|
|
@ -26,23 +26,31 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include <cstdio>
|
||||
#include <set>
|
||||
#include <list>
|
||||
#include <algorithm>
|
||||
#include <unordered_set>
|
||||
#include <assert.h> // for assert
|
||||
#include <cmath> // for sqrt, cos, hypot, isinf
|
||||
#include <cstdio>
|
||||
#include <istream> // for operator<<, operator>>
|
||||
#include <limits> // for numeric_limits
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string> // for char_traits, operator!=
|
||||
#include <type_traits> // for swap, move
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include <md5_hash.h>
|
||||
#include <map>
|
||||
|
||||
#include <clipper.hpp> // for Clipper, PolyNode, Clipp...
|
||||
#include <geometry/geometry_utils.h>
|
||||
#include <geometry/polygon_triangulation.h>
|
||||
#include <geometry/seg.h> // for SEG, OPT_VECTOR2I
|
||||
#include <geometry/shape.h>
|
||||
#include <geometry/shape_line_chain.h>
|
||||
#include <geometry/shape_poly_set.h>
|
||||
#include <geometry/polygon_triangulation.h>
|
||||
#include <math/box2.h> // for BOX2I
|
||||
#include <math/util.h> // for round_nearest, rescale
|
||||
#include <math/vector2d.h> // for VECTOR2I, VECTOR2D, VECTOR2
|
||||
#include <md5_hash.h>
|
||||
|
||||
|
||||
using namespace ClipperLib;
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <climits>
|
||||
#include <math/math_util.h>
|
||||
#include <math/util.h>
|
||||
|
||||
template<>
|
||||
int rescale( int aNumerator, int aValue, int aDenominator )
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue