Skip to content

Commit 15a2a1f

Browse files
author
Бакиев Дамир
committed
Arc
1 parent 4728f0e commit 15a2a1f

77 files changed

Lines changed: 1147 additions & 816 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123.patch

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ index b93ef99c..dbd91dfc 100644
274274
// #include <QtWidgets>
275275

276276
-
277-
// static auto PointConverter = QMetaType::registerConverter(&Point::toString); NOTE
277+
// static auto PointConverter = QMetaType::registerConverter(&cPoint::toString); NOTE
278278

279279
inline constexpr auto G_CODE_PROPERTIES = md5::hash32("GCodeProperties");
280280
@@ -916,6 +914,10 @@ const QDockWidget* MainWindow::dockWidget() const { return dockWidget_; }
@@ -928,7 +928,7 @@ index c4a7542b..fe59b1fe 100644
928928
+ mergePaths(rawPaths, mergDist);
929929

930930
for(Path& path: rawPaths) {
931-
Point& pf = path.front();
931+
cPoint& pf = path.front();
932932
@@ -215,7 +214,7 @@ void Creator::createGc(Params* gcp) {
933933
try {
934934
checkMillingFl = true;
@@ -970,15 +970,15 @@ index c4a7542b..fe59b1fe 100644
970970
- continue;
971971
- if(i >= paths.size())
972972
- break;
973-
- Point pib = paths[i].back();
974-
- Point pjf = paths[j].front();
973+
- cPoint pib = paths[i].back();
974+
- cPoint pjf = paths[j].front();
975975
- if(pib == pjf) {
976976
- paths[i] += paths[j] | skipFront;
977977
- paths -= j--;
978978
- continue;
979979
- }
980-
- Point pif = paths[i].front();
981-
- Point pjb = paths[j].back();
980+
- cPoint pif = paths[i].front();
981+
- cPoint pjb = paths[j].back();
982982
- if(pif == pjb) {
983983
- paths[j].insert(paths[j].end(), paths[i].begin() + 1, paths[i].end());
984984
- paths -= i--;
@@ -1005,15 +1005,15 @@ index c4a7542b..fe59b1fe 100644
10051005
- continue;
10061006
- if(i >= paths.size())
10071007
- break;
1008-
- Point pib = paths[i].back();
1009-
- Point pjf = paths[j].front();
1008+
- cPoint pib = paths[i].back();
1009+
- cPoint pjf = paths[j].front();
10101010
- if(distTo(pib, pjf) < maxDist) {
10111011
- paths[i] += paths[j] | skipFront;
10121012
- paths -= j--;
10131013
- continue;
10141014
- }
1015-
- Point pif = paths[i].front();
1016-
- Point pjb = paths[j].back();
1015+
- cPoint pif = paths[i].front();
1016+
- cPoint pjb = paths[j].back();
10171017
- if(distTo(pif, pjb) < maxDist) {
10181018
- paths[j].insert(paths[j].end(), paths[i].begin() + 1, paths[i].end());
10191019
- paths -= i--;
@@ -1051,7 +1051,7 @@ index c4a7542b..fe59b1fe 100644
10511051
-Paths& Creator::sortB(Paths& src) {
10521052
- qDebug(__FUNCTION__);
10531053
-
1054-
- Point startPt{~(App::home().pos() + App::zero().pos())};
1054+
- cPoint startPt{~(App::home().pos() + App::zero().pos())};
10551055
- for(size_t firstIdx{}; firstIdx < src.size(); ++firstIdx) {
10561056
- size_t swapIdx = firstIdx;
10571057
- double destLen = std::numeric_limits<double>::max();
@@ -1072,7 +1072,7 @@ index c4a7542b..fe59b1fe 100644
10721072
-Paths& Creator::sortBeginEnd(Paths& src) {
10731073
- qDebug(__FUNCTION__);
10741074
-
1075-
- Point startPt{~(App::home().pos() + App::zero().pos())};
1075+
- cPoint startPt{~(App::home().pos() + App::zero().pos())};
10761076
- for(size_t firstIdx{}; firstIdx < src.size(); ++firstIdx) {
10771077
-
10781078
- size_t swapIdx = firstIdx;
@@ -1107,7 +1107,7 @@ index c4a7542b..fe59b1fe 100644
11071107
-Pathss& Creator::sortB(Pathss& src) {
11081108
- qDebug(__FUNCTION__);
11091109
-
1110-
- Point startPt{~(App::home().pos() + App::zero().pos())};
1110+
- cPoint startPt{~(App::home().pos() + App::zero().pos())};
11111111
- for(size_t i{}; i < src.size(); ++i)
11121112
- if(src[i].empty())
11131113
- src.erase(src.begin() + i--);
@@ -1131,7 +1131,7 @@ index c4a7542b..fe59b1fe 100644
11311131
-Pathss& Creator::sortBeginEnd(Pathss& src) {
11321132
- qDebug(__FUNCTION__);
11331133
-
1134-
- Point startPt{~(App::home().pos() + App::zero().pos())};
1134+
- cPoint startPt{~(App::home().pos() + App::zero().pos())};
11351135
- for(size_t firstIdx{}; firstIdx < src.size(); ++firstIdx) {
11361136
- size_t swapIdx = firstIdx;
11371137
- double destLen = std::numeric_limits<double>::max();
@@ -1191,7 +1191,7 @@ index b0b2f8de..e655f912 100644
11911191
namespace rviews = std::ranges::views;
11921192
@@ -68,12 +59,6 @@ public:
11931193

1194-
Path boundOfPaths(const Paths& paths, /*Point::Type*/ int32_t k) const;
1194+
Path boundOfPaths(const Paths& paths, /*cPoint::Type*/ int32_t k) const;
11951195

11961196
- /*static*/ Paths& sortB(Paths& src);
11971197
- /*static*/ Paths& sortBeginEnd(Paths& src);
@@ -1804,7 +1804,7 @@ index 609f3e68..eb5d167a 100644
18041804

18051805
Paths& normalize(Paths& paths) {
18061806
PolyTree polyTree;
1807-
@@ -677,3 +679,375 @@ Path arc(Point p1, Point p2, Point center, int interpolation) {
1807+
@@ -677,3 +679,375 @@ Path arc(cPoint p1, cPoint p2, cPoint center, int interpolation) {
18081808
double stop = atan2(p2.y - center.y, p2.x - center.x);
18091809
return arc(center, radius, start, stop, interpolation);
18101810
}
@@ -1932,8 +1932,8 @@ index 609f3e68..eb5d167a 100644
19321932
+ list.emplace_front(idx.first);
19331933
+ for(size_t i = paths.size() - 1, index = idx.first; i; --i) {
19341934
+ double minDist = std::numeric_limits<double>::max();
1935-
+ Point point;
1936-
+ for(Point pt: paths[i - 1]) {
1935+
+ cPoint point;
1936+
+ for(cPoint pt: paths[i - 1]) {
19371937
+ double dist = distTo(pt, paths[i][index]);
19381938
+ if(minDist >= dist) {
19391939
+ minDist = dist;
@@ -1968,9 +1968,9 @@ index 609f3e68..eb5d167a 100644
19681968
+ std::pair<size_t, size_t> idx;
19691969
+ double d = std::numeric_limits<double>::max();
19701970
+ // for(size_t id {}; id < returnPss.back().back().size(); ++id) {
1971-
+ // const Point& ptd = returnPss.back().back()[id];
1971+
+ // const cPoint& ptd = returnPss.back().back()[id];
19721972
+ // for(size_t is {}; is < path.size(); ++is) {
1973-
+ // const Point& pts = path[is];
1973+
+ // const cPoint& pts = path[is];
19741974
+ // const double l = distTo(ptdpts);
19751975
+ // if(d >= l) {
19761976
+ // d = l;
@@ -2058,7 +2058,7 @@ index 609f3e68..eb5d167a 100644
20582058
+
20592059
+#endif
20602060
+
2061-
+Path boundOfPaths(const Paths& paths, /*Point::Type*/ int32_t k) {
2061+
+Path boundOfPaths(const Paths& paths, /*cPoint::Type*/ int32_t k) {
20622062
+ Rect rect(GetBounds(paths));
20632063
+ rect.bottom += k;
20642064
+ rect.left -= k;
@@ -2068,9 +2068,9 @@ index 609f3e68..eb5d167a 100644
20682068
+ return rect.AsPath();
20692069
+}
20702070
+
2071-
+Paths& sortB(Paths& src, Point startPt) {
2071+
+Paths& sortB(Paths& src, cPoint startPt) {
20722072
+ qDebug(__FUNCTION__);
2073-
+ // Point startPt{~(App::home().pos() + App::zero().pos())};
2073+
+ // cPoint startPt{~(App::home().pos() + App::zero().pos())};
20742074
+ for(size_t firstIdx{}; firstIdx < src.size(); ++firstIdx) {
20752075
+ size_t swapIdx = firstIdx;
20762076
+ double destLen = std::numeric_limits<double>::max();
@@ -2088,10 +2088,10 @@ index 609f3e68..eb5d167a 100644
20882088
+ return src;
20892089
+}
20902090
+
2091-
+Pathss& sortBeginEnd(Pathss& src, Point startPt) {
2091+
+Pathss& sortBeginEnd(Pathss& src, cPoint startPt) {
20922092
+ qDebug(__FUNCTION__);
20932093
+
2094-
+ // Point startPt{~(App::home().pos() + App::zero().pos())};
2094+
+ // cPoint startPt{~(App::home().pos() + App::zero().pos())};
20952095
+ for(size_t firstIdx{}; firstIdx < src.size(); ++firstIdx) {
20962096
+ size_t swapIdx = firstIdx;
20972097
+ double destLen = std::numeric_limits<double>::max();
@@ -2122,10 +2122,10 @@ index 609f3e68..eb5d167a 100644
21222122
+ return src;
21232123
+}
21242124
+
2125-
+Paths& sortBeginEnd(Paths& src, Point startPt) {
2125+
+Paths& sortBeginEnd(Paths& src, cPoint startPt) {
21262126
+ qDebug(__FUNCTION__);
21272127
+
2128-
+ // Point startPt{~(App::home().pos() + App::zero().pos())};
2128+
+ // cPoint startPt{~(App::home().pos() + App::zero().pos())};
21292129
+ for(size_t firstIdx{}; firstIdx < src.size(); ++firstIdx) {
21302130
+
21312131
+ size_t swapIdx = firstIdx;
@@ -2157,10 +2157,10 @@ index 609f3e68..eb5d167a 100644
21572157
+ return src;
21582158
+}
21592159
+
2160-
+Pathss& sortB(Pathss& src, Point startPt) {
2160+
+Pathss& sortB(Pathss& src, cPoint startPt) {
21612161
+ qDebug(__FUNCTION__);
21622162
+
2163-
+ // Point startPt{~(App::home().pos() + App::zero().pos())};
2163+
+ // cPoint startPt{~(App::home().pos() + App::zero().pos())};
21642164
+ for(size_t i{}; i < src.size(); ++i)
21652165
+ if(src[i].empty())
21662166
+ src.erase(src.begin() + i--);
@@ -2260,7 +2260,7 @@ index 58ef9499..37ec8415 100644
22602260
enum {
22612261
IconSize = 24
22622262
};
2263-
@@ -154,6 +85,10 @@ Paths& TranslatePaths(Paths& path, const Point& pos);
2263+
@@ -154,6 +85,10 @@ Paths& TranslatePaths(Paths& path, const cPoint& pos);
22642264

22652265
void mergeSegments(Paths& paths, double glue = 0.0);
22662266

@@ -2273,19 +2273,19 @@ index 58ef9499..37ec8415 100644
22732273
QIcon drawIcon(const Paths& paths, QColor color = Qt::black);
22742274
@@ -427,3 +362,14 @@ inline auto rwPolyTree(PolyTree& polyTree) {
22752275

2276-
Path arc(const Point& center, double radius, double start, double stop, int interpolation);
2277-
Path arc(Point p1, Point p2, Point center, int interpolation);
2276+
Path arc(const cPoint& center, double radius, double start, double stop, int interpolation);
2277+
Path arc(cPoint p1, cPoint p2, cPoint center, int interpolation);
22782278
+
22792279
+void markPolyTreeDByNesting(PolyTree& polynode);
22802280
+void sortPolyTreeByNesting(PolyTree& polynode);
22812281
+Pathss stacking(Paths& paths);
22822282
+
2283-
+Path boundOfPaths(const Paths& paths, /*Point::Type*/ int32_t k);
2283+
+Path boundOfPaths(const Paths& paths, /*cPoint::Type*/ int32_t k);
22842284
+
2285-
+Paths& sortB(Paths& src, Point startPt);
2286-
+Paths& sortBeginEnd(Paths& src, Point startPt);
2287-
+Pathss& sortB(Pathss& src, Point startPt);
2288-
+Pathss& sortBeginEnd(Pathss& src, Point startPt);
2285+
+Paths& sortB(Paths& src, cPoint startPt);
2286+
+Paths& sortBeginEnd(Paths& src, cPoint startPt);
2287+
+Pathss& sortB(Pathss& src, cPoint startPt);
2288+
+Pathss& sortBeginEnd(Pathss& src, cPoint startPt);
22892289
diff --git a/static_libs/common/CMakeLists.txt b/static_libs/common/CMakeLists.txt
22902290
index 2dede4d9..638b3e05 100644
22912291
--- a/static_libs/common/CMakeLists.txt

CMakeLists.txt

Lines changed: 30 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
Use, modification & distribution is subject to Boost Software License Ver 1.
99
http://www.boost.org/LICENSE_1_0.txt
1010
]]
11-
cmake_minimum_required(VERSION 3.30.0 FATAL_ERROR)
11+
cmake_minimum_required(VERSION 4.00 FATAL_ERROR)
1212

1313
# set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CMAKE_COMMAND} -E time")
1414
# set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CMAKE_COMMAND} -E time")
@@ -38,22 +38,6 @@ add_definitions(
3838
-DQT_USE_FAST_OPERATOR_PLUS
3939
-DQT_DISABLE_DEPRECATED_BEFORE=0x070000)
4040

41-
link_libraries(stdc++exp)
42-
43-
set(FreeCAD ${CMAKE_CURRENT_LIST_DIR}/third_party/FreeCAD)
44-
45-
if(NOT EXISTS ${FreeCAD})
46-
execute_process(COMMAND ${CMAKE_CURRENT_LIST_DIR}/libarea.sh
47-
${CMAKE_CURRENT_LIST_DIR}/third_party)
48-
endif()
49-
50-
file(GLOB_RECURSE SRC ${FreeCAD}/src/Mod/CAM/libarea/*.cpp)
51-
list(FILTER SRC EXCLUDE REGEX "[Pp]y.+|.+Dxf.+")
52-
add_library(FreeCAD_Area STATIC ${SRC})
53-
target_include_directories(
54-
FreeCAD_Area PUBLIC ${FreeCAD}/src/Mod/CAM/libarea
55-
${FreeCAD}/src/Mod/CAM/libarea/kurve)
56-
5741
# FIND BOOST
5842
find_package(Boost)
5943
if(Boost_FOUND)
@@ -112,31 +96,15 @@ endif()
11296

11397
# add_library(Qt INTERFACE) target_precompile_headers(Qt INTERFACE qt_pch.h)
11498

115-
include_directories(
116-
ggeasy
117-
plugins/file
118-
plugins/gcode
119-
plugins/shape
120-
static_libs/clipper
121-
static_libs/common
122-
static_libs/filetree
123-
static_libs/gi
124-
static_libs/graphicsview
125-
static_libs/tooldatabase
126-
third_party/clipper2/CPP/Clipper2Lib/include #
127-
third_party/pfr-src/include
128-
third_party/ctre-src/single-header)
99+
include_directories(ggeasy)
129100

130101
# add_library(std MODULE) target_sources(std PUBLIC FILE_SET all_my_modules TYPE
131102
# CXX_MODULES FILES static_libs / common / std.cppm)
132103

133-
set(CLIPPER2_UTILS OFF)
134-
set(CLIPPER2_EXAMPLES OFF)
135-
set(CLIPPER2_TESTS OFF)
136-
set(CLIPPER2_USINGZ "ONLY")
137-
add_definitions(-DUSINGZ=1)
104+
# set(CLIPPER2_UTILS OFF) set(CLIPPER2_EXAMPLES OFF) set(CLIPPER2_TESTS OFF)
105+
# set(CLIPPER2_USINGZ "ONLY") add_definitions(-DUSINGZ=1)
138106

139-
add_subdirectory(third_party/clipper2/CPP)
107+
# add_subdirectory(third_party/clipper2/CPP)
140108

141109
# set(CTRE_MODULE ON) add_subdirectory(third_party/ctre)
142110

@@ -146,8 +114,7 @@ set(COMMON_COMPILE_OPTIONS
146114
-march=native
147115
# * xc ++ - system - header iostream
148116
-Wall
149-
# * Wconversion
150-
-Werror
117+
# * Wconversion -Werror
151118
-Wextra
152119
-Wimplicit-fallthrough
153120
-Wpedantic)
@@ -156,6 +123,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
156123
add_compile_options(${COMMON_COMPILE_OPTIONS})
157124
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
158125
add_compile_options(${COMMON_COMPILE_OPTIONS})
126+
link_libraries(stdc++exp)
159127
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
160128

161129
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
@@ -177,6 +145,29 @@ find_package(
177145

178146
include(${CMAKE_SOURCE_DIR}/PATHS.cmake)
179147

148+
# FreeCAD ######################################################################
149+
set(FreeCAD ${CMAKE_CURRENT_LIST_DIR}/third_party/FreeCAD/src/Mod/CAM/libarea)
150+
151+
if(NOT EXISTS ${FreeCAD})
152+
execute_process(COMMAND ${CMAKE_CURRENT_LIST_DIR}/libarea.sh
153+
${CMAKE_CURRENT_LIST_DIR}/third_party)
154+
endif()
155+
156+
file(GLOB_RECURSE SOURCES ${FreeCAD}/*.cpp)
157+
list(FILTER SOURCES EXCLUDE REGEX "[Pp]y.+|.+Dxf.+")
158+
159+
file(GLOB_RECURSE HEADERS ${FreeCAD}/*.h*)
160+
list(FILTER HEADERS EXCLUDE REGEX "[Pp]y.+|.+Dxf.+")
161+
162+
add_library(FreeCAD_Area STATIC)
163+
target_sources(
164+
FreeCAD_Area
165+
PRIVATE ${SOURCES}
166+
PUBLIC ${HEADERS})
167+
168+
target_include_directories(FreeCAD_Area PUBLIC ${FreeCAD} ${FreeCAD}/kurve)
169+
# ##############################################################################
170+
180171
set(CMAKE_AUTOMOC ON)
181172
set(CMAKE_AUTORCC ON)
182173
set(CMAKE_AUTOUIC ON)

GTE_Win/clipper/clipper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ bool PointIsVertex(const IntPoint& Pt, OutPt* pp) {
425425
}
426426
//------------------------------------------------------------------------------
427427

428-
// See "The Point in Polygon Problem for Arbitrary Polygons" by Hormann & Agathos
428+
// See "The cPoint in Polygon Problem for Arbitrary Polygons" by Hormann & Agathos
429429
// http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.88.5498&rep=rep1&type=pdf
430430
int PointInPolygon(const IntPoint& pt, const Path& path) {
431431
// returns 0 if false, +1 if true, -1 if pt ON polygon boundary

PATHS.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.30.0 FATAL_ERROR)
1+
cmake_minimum_required(VERSION 4.00 FATAL_ERROR)
22

33
set(DIR_NAME
44
"Qt6.${QT_VERSION_MINOR}_${CMAKE_CXX_COMPILER_ID}_${CMAKE_BUILD_TYPE}")

0 commit comments

Comments
 (0)