From 2ccf5954d4a8802f4a95986a4e34c2c5120639b9 Mon Sep 17 00:00:00 2001 From: EvilSpirit Date: Tue, 11 Oct 2016 23:46:42 +0700 Subject: [PATCH] Allow creating n-dimensional arrays with translate and rotate groups. Before this commit, a translate group based on another translate group would always use the "union" boolean operation, which does not work at all if one wants an array with a difference operation, and results in degraded performance if one wants an array with an assemble operation. --- CHANGELOG.md | 2 + src/group.cpp | 6 + test/CMakeLists.txt | 1 + test/group/translate_nd/normal.png | Bin 0 -> 4983 bytes test/group/translate_nd/normal.slvs | 8316 +++++++++++++++++++++++++++ test/group/translate_nd/test.cpp | 7 + 6 files changed, 8332 insertions(+) create mode 100644 test/group/translate_nd/normal.png create mode 100644 test/group/translate_nd/normal.slvs create mode 100644 test/group/translate_nd/test.cpp diff --git a/CHANGELOG.md b/CHANGELOG.md index fce70d0..c828b14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ Changelog New sketch features: * Extrude, lathe, translate and rotate groups can now use the "assembly" boolean operation, to increase performance. + * Translate and rotate groups can create n-dimensional arrays using + the "difference" and "assembly" boolean operations. New export/import features: * Three.js: allow configuring projection for exported model, and initially diff --git a/src/group.cpp b/src/group.cpp index b1206e5..f459dd4 100644 --- a/src/group.cpp +++ b/src/group.cpp @@ -471,6 +471,9 @@ void Group::Generate(IdList *entity, } case Type::TRANSLATE: { + // inherit meshCombine from source group + Group *srcg = SK.GetGroup(opA); + meshCombine = srcg->meshCombine; // The translation vector AddParam(param, h.param(0), gp.x); AddParam(param, h.param(1), gp.y); @@ -498,6 +501,9 @@ void Group::Generate(IdList *entity, return; } case Type::ROTATE: { + // inherit meshCombine from source group + Group *srcg = SK.GetGroup(opA); + meshCombine = srcg->meshCombine; // The center of rotation AddParam(param, h.param(0), gc.x); AddParam(param, h.param(1), gc.y); diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 97f374d..081477a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -54,6 +54,7 @@ set(testsuite_SOURCES request/line_segment/test.cpp request/ttf_text/test.cpp group/translate_asy/test.cpp + group/translate_nd/test.cpp ) add_executable(solvespace_testsuite diff --git a/test/group/translate_nd/normal.png b/test/group/translate_nd/normal.png new file mode 100644 index 0000000000000000000000000000000000000000..4f5ee2c74ccb18e3990e448ba91446e4f0d2cfcc GIT binary patch literal 4983 zcmd5=dsx!<9{z%v<|S-d&AiaoN-HXxndH39Y|dk@i>8zYIF~0QGt0ZC*hN>CJnb~G zC^c)=6ctOfloT`Nlz6F*Xd#+0@j_~ah@isxfv!opX3u%{Jm-1fA1=S&=lglz&-=cg z->Gfix$5gI)&T(MyM61j0{}Qi`PQBdeNqva-Uh&Y2RE0my`nDl^E`GKKd4CVq#9FS z%>B)D=stGVakFSG)6ndOFZJpU)tu@vwd{kX5Zwlui!TND%mp~NvovDnP$4SA{1`JX zY^OJQMdd@(wJY?JAOP-Vwx2 zPQ!ri-r3XihZw)bQ>;yFH{4^R-poyeU{8B(KwP%&_#fSFLKOPzggMWk$C!fb?nZS~ znl;l}3^l;QhkDbYHlCi-HxJxhQFc&U4dNuuvz!HxzI&*A)!q^pvT?ZoHd7>H8W0)Tt@u6XT=w zJ+tP&KL8MI!NT7LP8J^B$h80tb6a>%zkG`)!)xwFt(@G-J(t4`0kT%ytcxpl8Nr+Q zQgUt$a#Y8pv~9d2%;R|De44BAFbsEzE~*w=4Q3 z$&v(lFh}S4`3!F@`AEP2a-pp7;Uil8l%D-DsJvH(`pmoq|MN@lcR|`r$Ohng z;1v3OSb|<=#{f$kAw^tOm|s!Qfc{AmY9e}p7VKTYs)~cATDI=2l3`XHzlo7s=8S$U z5arO3%~#Rwha9~So!2grqC*|JA_nGOr)3i=}&SQ1W>|4Oq*#;ae)t#?Eo`f&x}Oa3R)74NNNH4AS`HqJ$-8lkd`^SIo;&mgUnowQYx4$K~W^iSIX{t8=- zgEO$Yuz;h{yXDeC5alt^Bx=`G6HW*+4?k zya}Rs>J)I_AB$bTg>ET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