meerk40t 0.9.3001__py2.py3-none-any.whl → 0.9.7020__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- meerk40t/__init__.py +1 -1
- meerk40t/balormk/balor_params.py +167 -167
- meerk40t/balormk/clone_loader.py +457 -457
- meerk40t/balormk/controller.py +1566 -1512
- meerk40t/balormk/cylindermod.py +64 -0
- meerk40t/balormk/device.py +966 -1959
- meerk40t/balormk/driver.py +778 -591
- meerk40t/balormk/galvo_commands.py +1194 -0
- meerk40t/balormk/gui/balorconfig.py +237 -111
- meerk40t/balormk/gui/balorcontroller.py +191 -184
- meerk40t/balormk/gui/baloroperationproperties.py +116 -115
- meerk40t/balormk/gui/corscene.py +845 -0
- meerk40t/balormk/gui/gui.py +179 -147
- meerk40t/balormk/livelightjob.py +466 -382
- meerk40t/balormk/mock_connection.py +131 -109
- meerk40t/balormk/plugin.py +133 -135
- meerk40t/balormk/usb_connection.py +306 -301
- meerk40t/camera/__init__.py +1 -1
- meerk40t/camera/camera.py +514 -397
- meerk40t/camera/gui/camerapanel.py +1241 -1095
- meerk40t/camera/gui/gui.py +58 -58
- meerk40t/camera/plugin.py +441 -399
- meerk40t/ch341/__init__.py +27 -27
- meerk40t/ch341/ch341device.py +628 -628
- meerk40t/ch341/libusb.py +595 -589
- meerk40t/ch341/mock.py +171 -171
- meerk40t/ch341/windriver.py +157 -157
- meerk40t/constants.py +13 -0
- meerk40t/core/__init__.py +1 -1
- meerk40t/core/bindalias.py +550 -539
- meerk40t/core/core.py +47 -47
- meerk40t/core/cutcode/cubiccut.py +73 -73
- meerk40t/core/cutcode/cutcode.py +315 -312
- meerk40t/core/cutcode/cutgroup.py +141 -137
- meerk40t/core/cutcode/cutobject.py +192 -185
- meerk40t/core/cutcode/dwellcut.py +37 -37
- meerk40t/core/cutcode/gotocut.py +29 -29
- meerk40t/core/cutcode/homecut.py +29 -29
- meerk40t/core/cutcode/inputcut.py +34 -34
- meerk40t/core/cutcode/linecut.py +33 -33
- meerk40t/core/cutcode/outputcut.py +34 -34
- meerk40t/core/cutcode/plotcut.py +335 -335
- meerk40t/core/cutcode/quadcut.py +61 -61
- meerk40t/core/cutcode/rastercut.py +168 -148
- meerk40t/core/cutcode/waitcut.py +34 -34
- meerk40t/core/cutplan.py +1843 -1316
- meerk40t/core/drivers.py +330 -329
- meerk40t/core/elements/align.py +801 -669
- meerk40t/core/elements/branches.py +1858 -1507
- meerk40t/core/elements/clipboard.py +229 -219
- meerk40t/core/elements/element_treeops.py +4595 -2837
- meerk40t/core/elements/element_types.py +125 -105
- meerk40t/core/elements/elements.py +4315 -3617
- meerk40t/core/elements/files.py +117 -64
- meerk40t/core/elements/geometry.py +473 -224
- meerk40t/core/elements/grid.py +467 -316
- meerk40t/core/elements/materials.py +158 -94
- meerk40t/core/elements/notes.py +50 -38
- meerk40t/core/elements/offset_clpr.py +934 -912
- meerk40t/core/elements/offset_mk.py +963 -955
- meerk40t/core/elements/penbox.py +339 -267
- meerk40t/core/elements/placements.py +300 -83
- meerk40t/core/elements/render.py +785 -687
- meerk40t/core/elements/shapes.py +2618 -2092
- meerk40t/core/elements/testcases.py +105 -0
- meerk40t/core/elements/trace.py +651 -563
- meerk40t/core/elements/tree_commands.py +415 -409
- meerk40t/core/elements/undo_redo.py +116 -58
- meerk40t/core/elements/wordlist.py +319 -200
- meerk40t/core/exceptions.py +9 -9
- meerk40t/core/laserjob.py +220 -220
- meerk40t/core/logging.py +63 -63
- meerk40t/core/node/blobnode.py +83 -86
- meerk40t/core/node/bootstrap.py +105 -103
- meerk40t/core/node/branch_elems.py +40 -31
- meerk40t/core/node/branch_ops.py +45 -38
- meerk40t/core/node/branch_regmark.py +48 -41
- meerk40t/core/node/cutnode.py +29 -32
- meerk40t/core/node/effect_hatch.py +375 -257
- meerk40t/core/node/effect_warp.py +398 -0
- meerk40t/core/node/effect_wobble.py +441 -309
- meerk40t/core/node/elem_ellipse.py +404 -309
- meerk40t/core/node/elem_image.py +1082 -801
- meerk40t/core/node/elem_line.py +358 -292
- meerk40t/core/node/elem_path.py +259 -201
- meerk40t/core/node/elem_point.py +129 -102
- meerk40t/core/node/elem_polyline.py +310 -246
- meerk40t/core/node/elem_rect.py +376 -286
- meerk40t/core/node/elem_text.py +445 -418
- meerk40t/core/node/filenode.py +59 -40
- meerk40t/core/node/groupnode.py +138 -74
- meerk40t/core/node/image_processed.py +777 -766
- meerk40t/core/node/image_raster.py +156 -113
- meerk40t/core/node/layernode.py +31 -31
- meerk40t/core/node/mixins.py +135 -107
- meerk40t/core/node/node.py +1427 -1304
- meerk40t/core/node/nutils.py +117 -114
- meerk40t/core/node/op_cut.py +463 -335
- meerk40t/core/node/op_dots.py +296 -251
- meerk40t/core/node/op_engrave.py +414 -311
- meerk40t/core/node/op_image.py +755 -369
- meerk40t/core/node/op_raster.py +787 -522
- meerk40t/core/node/place_current.py +37 -40
- meerk40t/core/node/place_point.py +329 -126
- meerk40t/core/node/refnode.py +58 -47
- meerk40t/core/node/rootnode.py +225 -219
- meerk40t/core/node/util_console.py +48 -48
- meerk40t/core/node/util_goto.py +84 -65
- meerk40t/core/node/util_home.py +61 -61
- meerk40t/core/node/util_input.py +102 -102
- meerk40t/core/node/util_output.py +102 -102
- meerk40t/core/node/util_wait.py +65 -65
- meerk40t/core/parameters.py +709 -707
- meerk40t/core/planner.py +875 -785
- meerk40t/core/plotplanner.py +656 -652
- meerk40t/core/space.py +120 -113
- meerk40t/core/spoolers.py +706 -705
- meerk40t/core/svg_io.py +1836 -1549
- meerk40t/core/treeop.py +534 -445
- meerk40t/core/undos.py +278 -124
- meerk40t/core/units.py +784 -680
- meerk40t/core/view.py +393 -322
- meerk40t/core/webhelp.py +62 -62
- meerk40t/core/wordlist.py +513 -504
- meerk40t/cylinder/cylinder.py +247 -0
- meerk40t/cylinder/gui/cylindersettings.py +41 -0
- meerk40t/cylinder/gui/gui.py +24 -0
- meerk40t/device/__init__.py +1 -1
- meerk40t/device/basedevice.py +322 -123
- meerk40t/device/devicechoices.py +50 -0
- meerk40t/device/dummydevice.py +163 -128
- meerk40t/device/gui/defaultactions.py +618 -602
- meerk40t/device/gui/effectspanel.py +114 -0
- meerk40t/device/gui/formatterpanel.py +253 -290
- meerk40t/device/gui/warningpanel.py +337 -260
- meerk40t/device/mixins.py +13 -13
- meerk40t/dxf/__init__.py +1 -1
- meerk40t/dxf/dxf_io.py +766 -554
- meerk40t/dxf/plugin.py +47 -35
- meerk40t/external_plugins.py +79 -79
- meerk40t/external_plugins_build.py +28 -28
- meerk40t/extra/cag.py +112 -116
- meerk40t/extra/coolant.py +403 -0
- meerk40t/extra/encode_detect.py +204 -0
- meerk40t/extra/ezd.py +1165 -1165
- meerk40t/extra/hershey.py +834 -340
- meerk40t/extra/imageactions.py +322 -316
- meerk40t/extra/inkscape.py +628 -622
- meerk40t/extra/lbrn.py +424 -424
- meerk40t/extra/outerworld.py +283 -0
- meerk40t/extra/param_functions.py +1542 -1556
- meerk40t/extra/potrace.py +257 -253
- meerk40t/extra/serial_exchange.py +118 -0
- meerk40t/extra/updater.py +602 -453
- meerk40t/extra/vectrace.py +147 -146
- meerk40t/extra/winsleep.py +83 -83
- meerk40t/extra/xcs_reader.py +597 -0
- meerk40t/fill/fills.py +781 -335
- meerk40t/fill/patternfill.py +1061 -1061
- meerk40t/fill/patterns.py +614 -567
- meerk40t/grbl/control.py +87 -87
- meerk40t/grbl/controller.py +990 -903
- meerk40t/grbl/device.py +1084 -768
- meerk40t/grbl/driver.py +989 -771
- meerk40t/grbl/emulator.py +532 -497
- meerk40t/grbl/gcodejob.py +783 -767
- meerk40t/grbl/gui/grblconfiguration.py +373 -298
- meerk40t/grbl/gui/grblcontroller.py +485 -271
- meerk40t/grbl/gui/grblhardwareconfig.py +269 -153
- meerk40t/grbl/gui/grbloperationconfig.py +105 -0
- meerk40t/grbl/gui/gui.py +147 -116
- meerk40t/grbl/interpreter.py +44 -44
- meerk40t/grbl/loader.py +22 -22
- meerk40t/grbl/mock_connection.py +56 -56
- meerk40t/grbl/plugin.py +294 -264
- meerk40t/grbl/serial_connection.py +93 -88
- meerk40t/grbl/tcp_connection.py +81 -79
- meerk40t/grbl/ws_connection.py +112 -0
- meerk40t/gui/__init__.py +1 -1
- meerk40t/gui/about.py +2042 -296
- meerk40t/gui/alignment.py +1644 -1608
- meerk40t/gui/autoexec.py +199 -0
- meerk40t/gui/basicops.py +791 -670
- meerk40t/gui/bufferview.py +77 -71
- meerk40t/gui/busy.py +232 -133
- meerk40t/gui/choicepropertypanel.py +1662 -1469
- meerk40t/gui/consolepanel.py +706 -542
- meerk40t/gui/devicepanel.py +687 -581
- meerk40t/gui/dialogoptions.py +110 -107
- meerk40t/gui/executejob.py +316 -306
- meerk40t/gui/fonts.py +90 -90
- meerk40t/gui/functionwrapper.py +252 -0
- meerk40t/gui/gui_mixins.py +729 -0
- meerk40t/gui/guicolors.py +205 -182
- meerk40t/gui/help_assets/help_assets.py +218 -201
- meerk40t/gui/helper.py +154 -0
- meerk40t/gui/hersheymanager.py +1440 -846
- meerk40t/gui/icons.py +3422 -2747
- meerk40t/gui/imagesplitter.py +555 -508
- meerk40t/gui/keymap.py +354 -344
- meerk40t/gui/laserpanel.py +897 -806
- meerk40t/gui/laserrender.py +1470 -1232
- meerk40t/gui/lasertoolpanel.py +805 -793
- meerk40t/gui/magnetoptions.py +436 -0
- meerk40t/gui/materialmanager.py +2944 -0
- meerk40t/gui/materialtest.py +1722 -1694
- meerk40t/gui/mkdebug.py +646 -359
- meerk40t/gui/mwindow.py +163 -140
- meerk40t/gui/navigationpanels.py +2605 -2467
- meerk40t/gui/notes.py +143 -142
- meerk40t/gui/opassignment.py +414 -410
- meerk40t/gui/operation_info.py +310 -299
- meerk40t/gui/plugin.py +500 -328
- meerk40t/gui/position.py +714 -669
- meerk40t/gui/preferences.py +901 -650
- meerk40t/gui/propertypanels/attributes.py +1461 -1131
- meerk40t/gui/propertypanels/blobproperty.py +117 -114
- meerk40t/gui/propertypanels/consoleproperty.py +83 -80
- meerk40t/gui/propertypanels/gotoproperty.py +77 -0
- meerk40t/gui/propertypanels/groupproperties.py +223 -217
- meerk40t/gui/propertypanels/hatchproperty.py +489 -469
- meerk40t/gui/propertypanels/imageproperty.py +2244 -1384
- meerk40t/gui/propertypanels/inputproperty.py +59 -58
- meerk40t/gui/propertypanels/opbranchproperties.py +82 -80
- meerk40t/gui/propertypanels/operationpropertymain.py +1890 -1638
- meerk40t/gui/propertypanels/outputproperty.py +59 -58
- meerk40t/gui/propertypanels/pathproperty.py +389 -380
- meerk40t/gui/propertypanels/placementproperty.py +1214 -383
- meerk40t/gui/propertypanels/pointproperty.py +140 -136
- meerk40t/gui/propertypanels/propertywindow.py +313 -181
- meerk40t/gui/propertypanels/rasterwizardpanels.py +996 -912
- meerk40t/gui/propertypanels/regbranchproperties.py +76 -0
- meerk40t/gui/propertypanels/textproperty.py +770 -755
- meerk40t/gui/propertypanels/waitproperty.py +56 -55
- meerk40t/gui/propertypanels/warpproperty.py +121 -0
- meerk40t/gui/propertypanels/wobbleproperty.py +255 -204
- meerk40t/gui/ribbon.py +2471 -2210
- meerk40t/gui/scene/scene.py +1100 -1051
- meerk40t/gui/scene/sceneconst.py +22 -22
- meerk40t/gui/scene/scenepanel.py +439 -349
- meerk40t/gui/scene/scenespacewidget.py +365 -365
- meerk40t/gui/scene/widget.py +518 -505
- meerk40t/gui/scenewidgets/affinemover.py +215 -215
- meerk40t/gui/scenewidgets/attractionwidget.py +315 -309
- meerk40t/gui/scenewidgets/bedwidget.py +120 -97
- meerk40t/gui/scenewidgets/elementswidget.py +137 -107
- meerk40t/gui/scenewidgets/gridwidget.py +785 -745
- meerk40t/gui/scenewidgets/guidewidget.py +765 -765
- meerk40t/gui/scenewidgets/laserpathwidget.py +66 -66
- meerk40t/gui/scenewidgets/machineoriginwidget.py +86 -86
- meerk40t/gui/scenewidgets/nodeselector.py +28 -28
- meerk40t/gui/scenewidgets/rectselectwidget.py +592 -346
- meerk40t/gui/scenewidgets/relocatewidget.py +33 -33
- meerk40t/gui/scenewidgets/reticlewidget.py +83 -83
- meerk40t/gui/scenewidgets/selectionwidget.py +2958 -2756
- meerk40t/gui/simpleui.py +362 -333
- meerk40t/gui/simulation.py +2451 -2094
- meerk40t/gui/snapoptions.py +208 -203
- meerk40t/gui/spoolerpanel.py +1227 -1180
- meerk40t/gui/statusbarwidgets/defaultoperations.py +480 -353
- meerk40t/gui/statusbarwidgets/infowidget.py +520 -483
- meerk40t/gui/statusbarwidgets/opassignwidget.py +356 -355
- meerk40t/gui/statusbarwidgets/selectionwidget.py +172 -171
- meerk40t/gui/statusbarwidgets/shapepropwidget.py +754 -236
- meerk40t/gui/statusbarwidgets/statusbar.py +272 -260
- meerk40t/gui/statusbarwidgets/statusbarwidget.py +268 -270
- meerk40t/gui/statusbarwidgets/strokewidget.py +267 -251
- meerk40t/gui/themes.py +200 -78
- meerk40t/gui/tips.py +590 -0
- meerk40t/gui/toolwidgets/circlebrush.py +35 -35
- meerk40t/gui/toolwidgets/toolcircle.py +248 -242
- meerk40t/gui/toolwidgets/toolcontainer.py +82 -77
- meerk40t/gui/toolwidgets/tooldraw.py +97 -90
- meerk40t/gui/toolwidgets/toolellipse.py +219 -212
- meerk40t/gui/toolwidgets/toolimagecut.py +25 -132
- meerk40t/gui/toolwidgets/toolline.py +39 -144
- meerk40t/gui/toolwidgets/toollinetext.py +79 -236
- meerk40t/gui/toolwidgets/toollinetext_inline.py +296 -0
- meerk40t/gui/toolwidgets/toolmeasure.py +163 -216
- meerk40t/gui/toolwidgets/toolnodeedit.py +2088 -2074
- meerk40t/gui/toolwidgets/toolnodemove.py +92 -94
- meerk40t/gui/toolwidgets/toolparameter.py +754 -668
- meerk40t/gui/toolwidgets/toolplacement.py +108 -108
- meerk40t/gui/toolwidgets/toolpoint.py +68 -59
- meerk40t/gui/toolwidgets/toolpointlistbuilder.py +294 -0
- meerk40t/gui/toolwidgets/toolpointmove.py +183 -0
- meerk40t/gui/toolwidgets/toolpolygon.py +288 -403
- meerk40t/gui/toolwidgets/toolpolyline.py +38 -196
- meerk40t/gui/toolwidgets/toolrect.py +211 -207
- meerk40t/gui/toolwidgets/toolrelocate.py +72 -72
- meerk40t/gui/toolwidgets/toolribbon.py +598 -113
- meerk40t/gui/toolwidgets/tooltabedit.py +546 -0
- meerk40t/gui/toolwidgets/tooltext.py +98 -89
- meerk40t/gui/toolwidgets/toolvector.py +213 -204
- meerk40t/gui/toolwidgets/toolwidget.py +39 -39
- meerk40t/gui/usbconnect.py +98 -91
- meerk40t/gui/utilitywidgets/buttonwidget.py +18 -18
- meerk40t/gui/utilitywidgets/checkboxwidget.py +90 -90
- meerk40t/gui/utilitywidgets/controlwidget.py +14 -14
- meerk40t/gui/utilitywidgets/cyclocycloidwidget.py +343 -340
- meerk40t/gui/utilitywidgets/debugwidgets.py +148 -0
- meerk40t/gui/utilitywidgets/handlewidget.py +27 -27
- meerk40t/gui/utilitywidgets/harmonograph.py +450 -447
- meerk40t/gui/utilitywidgets/openclosewidget.py +40 -40
- meerk40t/gui/utilitywidgets/rotationwidget.py +54 -54
- meerk40t/gui/utilitywidgets/scalewidget.py +75 -75
- meerk40t/gui/utilitywidgets/seekbarwidget.py +183 -183
- meerk40t/gui/utilitywidgets/togglewidget.py +142 -142
- meerk40t/gui/utilitywidgets/toolbarwidget.py +8 -8
- meerk40t/gui/wordlisteditor.py +985 -931
- meerk40t/gui/wxmeerk40t.py +1447 -1169
- meerk40t/gui/wxmmain.py +5644 -4112
- meerk40t/gui/wxmribbon.py +1591 -1076
- meerk40t/gui/wxmscene.py +1631 -1453
- meerk40t/gui/wxmtree.py +2416 -2089
- meerk40t/gui/wxutils.py +1769 -1099
- meerk40t/gui/zmatrix.py +102 -102
- meerk40t/image/__init__.py +1 -1
- meerk40t/image/dither.py +429 -0
- meerk40t/image/imagetools.py +2793 -2269
- meerk40t/internal_plugins.py +150 -130
- meerk40t/kernel/__init__.py +63 -12
- meerk40t/kernel/channel.py +259 -212
- meerk40t/kernel/context.py +538 -538
- meerk40t/kernel/exceptions.py +41 -41
- meerk40t/kernel/functions.py +463 -414
- meerk40t/kernel/jobs.py +100 -100
- meerk40t/kernel/kernel.py +3828 -3571
- meerk40t/kernel/lifecycles.py +71 -71
- meerk40t/kernel/module.py +49 -49
- meerk40t/kernel/service.py +147 -147
- meerk40t/kernel/settings.py +383 -343
- meerk40t/lihuiyu/controller.py +883 -876
- meerk40t/lihuiyu/device.py +1181 -1069
- meerk40t/lihuiyu/driver.py +1466 -1372
- meerk40t/lihuiyu/gui/gui.py +127 -106
- meerk40t/lihuiyu/gui/lhyaccelgui.py +377 -363
- meerk40t/lihuiyu/gui/lhycontrollergui.py +741 -651
- meerk40t/lihuiyu/gui/lhydrivergui.py +470 -446
- meerk40t/lihuiyu/gui/lhyoperationproperties.py +238 -237
- meerk40t/lihuiyu/gui/tcpcontroller.py +226 -190
- meerk40t/lihuiyu/interpreter.py +53 -53
- meerk40t/lihuiyu/laserspeed.py +450 -450
- meerk40t/lihuiyu/loader.py +90 -90
- meerk40t/lihuiyu/parser.py +404 -404
- meerk40t/lihuiyu/plugin.py +101 -102
- meerk40t/lihuiyu/tcp_connection.py +111 -109
- meerk40t/main.py +231 -165
- meerk40t/moshi/builder.py +788 -781
- meerk40t/moshi/controller.py +505 -499
- meerk40t/moshi/device.py +495 -442
- meerk40t/moshi/driver.py +862 -696
- meerk40t/moshi/gui/gui.py +78 -76
- meerk40t/moshi/gui/moshicontrollergui.py +538 -522
- meerk40t/moshi/gui/moshidrivergui.py +87 -75
- meerk40t/moshi/plugin.py +43 -43
- meerk40t/network/console_server.py +140 -57
- meerk40t/network/kernelserver.py +10 -9
- meerk40t/network/tcp_server.py +142 -140
- meerk40t/network/udp_server.py +103 -77
- meerk40t/network/web_server.py +404 -0
- meerk40t/newly/controller.py +1158 -1144
- meerk40t/newly/device.py +874 -732
- meerk40t/newly/driver.py +540 -412
- meerk40t/newly/gui/gui.py +219 -188
- meerk40t/newly/gui/newlyconfig.py +116 -101
- meerk40t/newly/gui/newlycontroller.py +193 -186
- meerk40t/newly/gui/operationproperties.py +51 -51
- meerk40t/newly/mock_connection.py +82 -82
- meerk40t/newly/newly_params.py +56 -56
- meerk40t/newly/plugin.py +1214 -1246
- meerk40t/newly/usb_connection.py +322 -322
- meerk40t/rotary/gui/gui.py +52 -46
- meerk40t/rotary/gui/rotarysettings.py +240 -232
- meerk40t/rotary/rotary.py +202 -98
- meerk40t/ruida/control.py +291 -91
- meerk40t/ruida/controller.py +138 -1088
- meerk40t/ruida/device.py +676 -231
- meerk40t/ruida/driver.py +534 -472
- meerk40t/ruida/emulator.py +1494 -1491
- meerk40t/ruida/exceptions.py +4 -4
- meerk40t/ruida/gui/gui.py +71 -76
- meerk40t/ruida/gui/ruidaconfig.py +239 -72
- meerk40t/ruida/gui/ruidacontroller.py +187 -184
- meerk40t/ruida/gui/ruidaoperationproperties.py +48 -47
- meerk40t/ruida/loader.py +54 -52
- meerk40t/ruida/mock_connection.py +57 -109
- meerk40t/ruida/plugin.py +124 -87
- meerk40t/ruida/rdjob.py +2084 -945
- meerk40t/ruida/serial_connection.py +116 -0
- meerk40t/ruida/tcp_connection.py +146 -0
- meerk40t/ruida/udp_connection.py +73 -0
- meerk40t/svgelements.py +9671 -9669
- meerk40t/tools/driver_to_path.py +584 -579
- meerk40t/tools/geomstr.py +5583 -4680
- meerk40t/tools/jhfparser.py +357 -292
- meerk40t/tools/kerftest.py +904 -890
- meerk40t/tools/livinghinges.py +1168 -1033
- meerk40t/tools/pathtools.py +987 -949
- meerk40t/tools/pmatrix.py +234 -0
- meerk40t/tools/pointfinder.py +942 -942
- meerk40t/tools/polybool.py +941 -940
- meerk40t/tools/rasterplotter.py +1660 -547
- meerk40t/tools/shxparser.py +1047 -901
- meerk40t/tools/ttfparser.py +726 -446
- meerk40t/tools/zinglplotter.py +595 -593
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/LICENSE +21 -21
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/METADATA +150 -139
- meerk40t-0.9.7020.dist-info/RECORD +446 -0
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/WHEEL +1 -1
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/top_level.txt +0 -1
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/zip-safe +1 -1
- meerk40t/balormk/elementlightjob.py +0 -159
- meerk40t-0.9.3001.dist-info/RECORD +0 -437
- test/bootstrap.py +0 -63
- test/test_cli.py +0 -12
- test/test_core_cutcode.py +0 -418
- test/test_core_elements.py +0 -144
- test/test_core_plotplanner.py +0 -397
- test/test_core_viewports.py +0 -312
- test/test_drivers_grbl.py +0 -108
- test/test_drivers_lihuiyu.py +0 -443
- test/test_drivers_newly.py +0 -113
- test/test_element_degenerate_points.py +0 -43
- test/test_elements_classify.py +0 -97
- test/test_elements_penbox.py +0 -22
- test/test_file_svg.py +0 -176
- test/test_fill.py +0 -155
- test/test_geomstr.py +0 -1523
- test/test_geomstr_nodes.py +0 -18
- test/test_imagetools_actualize.py +0 -306
- test/test_imagetools_wizard.py +0 -258
- test/test_kernel.py +0 -200
- test/test_laser_speeds.py +0 -3303
- test/test_length.py +0 -57
- test/test_lifecycle.py +0 -66
- test/test_operations.py +0 -251
- test/test_operations_hatch.py +0 -57
- test/test_ruida.py +0 -19
- test/test_spooler.py +0 -22
- test/test_tools_rasterplotter.py +0 -29
- test/test_wobble.py +0 -133
- test/test_zingl.py +0 -124
- {test → meerk40t/cylinder}/__init__.py +0 -0
- /meerk40t/{core/element_commands.py → cylinder/gui/__init__.py} +0 -0
- {meerk40t-0.9.3001.dist-info → meerk40t-0.9.7020.dist-info}/entry_points.txt +0 -0
meerk40t/tools/zinglplotter.py
CHANGED
@@ -1,593 +1,595 @@
|
|
1
|
-
from math import ceil, cos, floor, sin, sqrt, tan, tau
|
2
|
-
|
3
|
-
from meerk40t.svgelements import Point
|
4
|
-
|
5
|
-
"""
|
6
|
-
The Zingl-Bresenham plotting algorithms are from Alois Zingl's "The Beauty of Bresenham's Algorithm"
|
7
|
-
( http://members.chello.at/easyfilter/bresenham.html ).
|
8
|
-
|
9
|
-
In the case of Zingl's work this isn't explicit from his website, however from personal
|
10
|
-
correspondence "'Free and open source' means you can do anything with it like the MIT licence."
|
11
|
-
|
12
|
-
The Zingl-Bresenham algorithms are provided in a static fashion and generate x and y locations.
|
13
|
-
|
14
|
-
This work is MIT Licensed.
|
15
|
-
"""
|
16
|
-
|
17
|
-
|
18
|
-
class ZinglPlotter:
|
19
|
-
@staticmethod
|
20
|
-
def plot_arc(arc):
|
21
|
-
"""
|
22
|
-
Plots an arc by converting it into a series of cubic Bézier curves and plotting those instead.
|
23
|
-
|
24
|
-
@param arc:
|
25
|
-
@return:
|
26
|
-
"""
|
27
|
-
# TODO: Should actually plot the arc according to the pixel-perfect standard.
|
28
|
-
# TODO: In this case we would plot a Bernstein weighted bezier curve.
|
29
|
-
sweep_limit = tau / 12
|
30
|
-
arc_required = int(ceil(abs(arc.sweep) / sweep_limit))
|
31
|
-
if arc_required == 0:
|
32
|
-
return
|
33
|
-
|
34
|
-
|
35
|
-
theta = arc.get_rotation()
|
36
|
-
rx = arc.rx
|
37
|
-
ry = arc.ry
|
38
|
-
p_start = arc.start
|
39
|
-
current_t = arc.get_start_t()
|
40
|
-
x0 = arc.center[0]
|
41
|
-
y0 = arc.center[1]
|
42
|
-
cos_theta = cos(theta)
|
43
|
-
sin_theta = sin(theta)
|
44
|
-
|
45
|
-
for i in range(0, arc_required):
|
46
|
-
next_t = current_t +
|
47
|
-
|
48
|
-
alpha =
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
sx =
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
sy =
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
This
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
sx =
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
sy =
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
xx
|
175
|
-
yy
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
t = (x0
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
t = (y0
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
sx =
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
sy =
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
#
|
337
|
-
#
|
338
|
-
# if (
|
339
|
-
# return
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
f =
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
i =
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
1
|
+
from math import ceil, cos, floor, sin, sqrt, tan, tau
|
2
|
+
|
3
|
+
from meerk40t.svgelements import Point
|
4
|
+
|
5
|
+
"""
|
6
|
+
The Zingl-Bresenham plotting algorithms are from Alois Zingl's "The Beauty of Bresenham's Algorithm"
|
7
|
+
( http://members.chello.at/easyfilter/bresenham.html ).
|
8
|
+
|
9
|
+
In the case of Zingl's work this isn't explicit from his website, however from personal
|
10
|
+
correspondence "'Free and open source' means you can do anything with it like the MIT licence."
|
11
|
+
|
12
|
+
The Zingl-Bresenham algorithms are provided in a static fashion and generate x and y locations.
|
13
|
+
|
14
|
+
This work is MIT Licensed.
|
15
|
+
"""
|
16
|
+
|
17
|
+
|
18
|
+
class ZinglPlotter:
|
19
|
+
@staticmethod
|
20
|
+
def plot_arc(arc):
|
21
|
+
"""
|
22
|
+
Plots an arc by converting it into a series of cubic Bézier curves and plotting those instead.
|
23
|
+
|
24
|
+
@param arc:
|
25
|
+
@return:
|
26
|
+
"""
|
27
|
+
# TODO: Should actually plot the arc according to the pixel-perfect standard.
|
28
|
+
# TODO: In this case we would plot a Bernstein weighted bezier curve.
|
29
|
+
sweep_limit = tau / 12
|
30
|
+
arc_required = int(ceil(abs(arc.sweep) / sweep_limit))
|
31
|
+
if arc_required == 0:
|
32
|
+
return
|
33
|
+
arc_slice = arc.sweep / float(arc_required)
|
34
|
+
|
35
|
+
theta = arc.get_rotation()
|
36
|
+
rx = arc.rx
|
37
|
+
ry = arc.ry
|
38
|
+
p_start = arc.start
|
39
|
+
current_t = arc.get_start_t()
|
40
|
+
x0 = arc.center[0]
|
41
|
+
y0 = arc.center[1]
|
42
|
+
cos_theta = cos(theta)
|
43
|
+
sin_theta = sin(theta)
|
44
|
+
|
45
|
+
for i in range(0, arc_required):
|
46
|
+
next_t = current_t + arc_slice
|
47
|
+
|
48
|
+
alpha = (
|
49
|
+
sin(arc_slice) * (sqrt(4 + 3 * pow(tan(arc_slice / 2.0), 2)) - 1) / 3.0
|
50
|
+
)
|
51
|
+
|
52
|
+
cos_start_t = cos(current_t)
|
53
|
+
sin_start_t = sin(current_t)
|
54
|
+
|
55
|
+
ePrimen1x = -rx * cos_theta * sin_start_t - ry * sin_theta * cos_start_t
|
56
|
+
ePrimen1y = -rx * sin_theta * sin_start_t + ry * cos_theta * cos_start_t
|
57
|
+
|
58
|
+
cos_end_t = cos(next_t)
|
59
|
+
sin_end_t = sin(next_t)
|
60
|
+
|
61
|
+
p2En2x = x0 + rx * cos_end_t * cos_theta - ry * sin_end_t * sin_theta
|
62
|
+
p2En2y = y0 + rx * cos_end_t * sin_theta + ry * sin_end_t * cos_theta
|
63
|
+
p_end = (p2En2x, p2En2y)
|
64
|
+
if i == arc_required - 1:
|
65
|
+
p_end = arc.end
|
66
|
+
|
67
|
+
ePrimen2x = -rx * cos_theta * sin_end_t - ry * sin_theta * cos_end_t
|
68
|
+
ePrimen2y = -rx * sin_theta * sin_end_t + ry * cos_theta * cos_end_t
|
69
|
+
|
70
|
+
p_c1 = (p_start[0] + alpha * ePrimen1x, p_start[1] + alpha * ePrimen1y)
|
71
|
+
p_c2 = (p_end[0] - alpha * ePrimen2x, p_end[1] - alpha * ePrimen2y)
|
72
|
+
|
73
|
+
yield from ZinglPlotter.plot_cubic_bezier(
|
74
|
+
p_start[0],
|
75
|
+
p_start[1],
|
76
|
+
p_c1[0],
|
77
|
+
p_c1[1],
|
78
|
+
p_c2[0],
|
79
|
+
p_c2[1],
|
80
|
+
p_end[0],
|
81
|
+
p_end[1],
|
82
|
+
)
|
83
|
+
p_start = Point(p_end)
|
84
|
+
current_t = next_t
|
85
|
+
|
86
|
+
@staticmethod
|
87
|
+
def plot_line(x0, y0, x1, y1):
|
88
|
+
"""
|
89
|
+
Zingl-Bresenham line draw algorithm
|
90
|
+
|
91
|
+
yields x, y
|
92
|
+
"""
|
93
|
+
x0 = int(x0)
|
94
|
+
y0 = int(y0)
|
95
|
+
x1 = int(x1)
|
96
|
+
y1 = int(y1)
|
97
|
+
dx = abs(x1 - x0)
|
98
|
+
dy = -abs(y1 - y0)
|
99
|
+
|
100
|
+
if x0 < x1:
|
101
|
+
sx = 1
|
102
|
+
else:
|
103
|
+
sx = -1
|
104
|
+
if y0 < y1:
|
105
|
+
sy = 1
|
106
|
+
else:
|
107
|
+
sy = -1
|
108
|
+
|
109
|
+
err = dx + dy # error value e_xy
|
110
|
+
|
111
|
+
while True: # /* loop */
|
112
|
+
yield x0, y0
|
113
|
+
if x0 == x1 and y0 == y1:
|
114
|
+
break
|
115
|
+
e2 = 2 * err
|
116
|
+
if e2 >= dy: # e_xy+e_y < 0
|
117
|
+
err += dy
|
118
|
+
x0 += sx
|
119
|
+
if e2 <= dx: # e_xy+e_y < 0
|
120
|
+
err += dx
|
121
|
+
y0 += sy
|
122
|
+
|
123
|
+
@staticmethod
|
124
|
+
def plot_quad_bezier_seg(x0, y0, x1, y1, x2, y2):
|
125
|
+
"""plot a limited quadratic Bezier segment
|
126
|
+
|
127
|
+
This algorithm can plot curves that do not inflect.
|
128
|
+
|
129
|
+
This is used as part of the general algorithm, which breaks at the inflection point.
|
130
|
+
|
131
|
+
yields x, y
|
132
|
+
"""
|
133
|
+
sx = x2 - x1
|
134
|
+
sy = y2 - y1
|
135
|
+
xx = x0 - x1
|
136
|
+
yy = y0 - y1
|
137
|
+
xy = 0 # relative values for checks */
|
138
|
+
dx = 0
|
139
|
+
dy = 0
|
140
|
+
err = 0
|
141
|
+
cur = xx * sy - yy * sx # /* curvature */
|
142
|
+
points = None
|
143
|
+
|
144
|
+
assert xx * sx <= 0 and yy * sy <= 0 # /* sign of gradient must not change */
|
145
|
+
|
146
|
+
if sx * sx + sy * sy > xx * xx + yy * yy: # /* begin with shorter part */
|
147
|
+
x2 = x0
|
148
|
+
x0 = sx + x1
|
149
|
+
y2 = y0
|
150
|
+
y0 = sy + y1
|
151
|
+
cur = -cur # /* swap P0 P2 */
|
152
|
+
points = []
|
153
|
+
if cur != 0: # /* no straight line */
|
154
|
+
xx += sx
|
155
|
+
if x0 < x2:
|
156
|
+
sx = 1 # /* x step direction */
|
157
|
+
else:
|
158
|
+
sx = -1 # /* x step direction */
|
159
|
+
xx *= sx
|
160
|
+
yy += sy
|
161
|
+
if y0 < y2:
|
162
|
+
sy = 1
|
163
|
+
else:
|
164
|
+
sy = -1
|
165
|
+
yy *= sy # /* y step direction */
|
166
|
+
xy = 2 * xx * yy
|
167
|
+
xx *= xx
|
168
|
+
yy *= yy # /* differences 2nd degree */
|
169
|
+
if cur * sx * sy < 0: # /* negated curvature? */
|
170
|
+
xx = -xx
|
171
|
+
yy = -yy
|
172
|
+
xy = -xy
|
173
|
+
cur = -cur
|
174
|
+
dx = 4.0 * sy * cur * (x1 - x0) + xx - xy # /* differences 1st degree */
|
175
|
+
dy = 4.0 * sx * cur * (y0 - y1) + yy - xy
|
176
|
+
xx += xx
|
177
|
+
yy += yy
|
178
|
+
err = dx + dy + xy # /* error 1st step */
|
179
|
+
while True:
|
180
|
+
if points is None:
|
181
|
+
yield int(x0), int(y0) # /* plot curve */
|
182
|
+
else:
|
183
|
+
points.append((int(x0), int(y0)))
|
184
|
+
if x0 == x2 and y0 == y2:
|
185
|
+
if points is not None:
|
186
|
+
for plot in reversed(points):
|
187
|
+
yield plot
|
188
|
+
return # /* last pixel -> curve finished */
|
189
|
+
y1 = 2 * err < dx # /* save value for test of y step */
|
190
|
+
if 2 * err > dy:
|
191
|
+
x0 += sx
|
192
|
+
dx -= xy
|
193
|
+
dy += yy
|
194
|
+
err += dy
|
195
|
+
# /* x step */
|
196
|
+
if y1 != 0:
|
197
|
+
y0 += sy
|
198
|
+
dy -= xy
|
199
|
+
dx += xx
|
200
|
+
err += dx
|
201
|
+
# /* y step */
|
202
|
+
if not (dy < 0 < dx): # /* gradient negates -> algorithm fails */
|
203
|
+
break
|
204
|
+
for plot in ZinglPlotter.plot_line(
|
205
|
+
x0, y0, x2, y2
|
206
|
+
): # /* plot remaining part to end */:
|
207
|
+
if points is None:
|
208
|
+
yield plot # /* plot curve */
|
209
|
+
else:
|
210
|
+
points.append(
|
211
|
+
plot
|
212
|
+
) # plotLine(x0,y0, x2,y2) #/* plot remaining part to end */
|
213
|
+
if points is not None:
|
214
|
+
for plot in reversed(points):
|
215
|
+
yield plot
|
216
|
+
|
217
|
+
@staticmethod
|
218
|
+
def plot_quad_bezier(x0, y0, x1, y1, x2, y2):
|
219
|
+
"""
|
220
|
+
Zingl-Bresenham quad bezier draw algorithm.
|
221
|
+
|
222
|
+
Plot any quadratic Bezier curve
|
223
|
+
|
224
|
+
yields x, y
|
225
|
+
"""
|
226
|
+
|
227
|
+
x0 = int(x0)
|
228
|
+
y0 = int(y0)
|
229
|
+
# control points are permitted fractional elements.
|
230
|
+
x2 = int(x2)
|
231
|
+
y2 = int(y2)
|
232
|
+
x = x0 - x1
|
233
|
+
y = y0 - y1
|
234
|
+
t = x0 - 2 * x1 + x2
|
235
|
+
r = 0
|
236
|
+
points = None
|
237
|
+
|
238
|
+
if x * (x2 - x1) > 0: # /* horizontal cut at P4? */
|
239
|
+
if y * (y2 - y1) > 0: # /* vertical cut at P6 too? */
|
240
|
+
if abs((y0 - 2 * y1 + y2) / t * x) > abs(y): # /* which first? */
|
241
|
+
x0 = x2
|
242
|
+
x2 = x + x1
|
243
|
+
y0 = y2
|
244
|
+
y2 = y + y1 # /* swap points */
|
245
|
+
points = []
|
246
|
+
# /* now horizontal cut at P4 comes first */
|
247
|
+
t = (x0 - x1) / t
|
248
|
+
r = (1 - t) * ((1 - t) * y0 + 2.0 * t * y1) + t * t * y2 # /* By(t=P4) */
|
249
|
+
t = (x0 * x2 - x1 * x1) * t / (x0 - x1) # /* gradient dP4/dx=0 */
|
250
|
+
x = floor(t + 0.5)
|
251
|
+
y = floor(r + 0.5)
|
252
|
+
r = (y1 - y0) * (t - x0) / (x1 - x0) + y0 # /* intersect P3 | P0 P1 */
|
253
|
+
for plot in ZinglPlotter.plot_quad_bezier_seg(
|
254
|
+
x0, y0, x, floor(r + 0.5), x, y
|
255
|
+
):
|
256
|
+
if points is None:
|
257
|
+
yield plot
|
258
|
+
else:
|
259
|
+
points.append(plot)
|
260
|
+
r = (y1 - y2) * (t - x2) / (x1 - x2) + y2 # /* intersect P4 | P1 P2 */
|
261
|
+
x0 = x1 = x
|
262
|
+
y0 = y
|
263
|
+
y1 = floor(r + 0.5) # /* P0 = P4, P1 = P8 */
|
264
|
+
if (y0 - y1) * (y2 - y1) > 0: # /* vertical cut at P6? */
|
265
|
+
t = y0 - 2 * y1 + y2
|
266
|
+
t = (y0 - y1) / t
|
267
|
+
r = (1 - t) * ((1 - t) * x0 + 2.0 * t * x1) + t * t * x2 # /* Bx(t=P6) */
|
268
|
+
t = (y0 * y2 - y1 * y1) * t / (y0 - y1) # /* gradient dP6/dy=0 */
|
269
|
+
x = floor(r + 0.5)
|
270
|
+
y = floor(t + 0.5)
|
271
|
+
r = (x1 - x0) * (t - y0) / (y1 - y0) + x0 # /* intersect P6 | P0 P1 */
|
272
|
+
for plot in ZinglPlotter.plot_quad_bezier_seg(
|
273
|
+
x0, y0, floor(r + 0.5), y, x, y
|
274
|
+
):
|
275
|
+
if points is None:
|
276
|
+
yield plot
|
277
|
+
else:
|
278
|
+
points.append(plot)
|
279
|
+
r = (x1 - x2) * (t - y2) / (y1 - y2) + x2 # /* intersect P7 | P1 P2 */
|
280
|
+
x0 = x
|
281
|
+
x1 = floor(r + 0.5)
|
282
|
+
y0 = y1 = y # /* P0 = P6, P1 = P7 */
|
283
|
+
for plot in ZinglPlotter.plot_quad_bezier_seg(
|
284
|
+
x0, y0, x1, y1, x2, y2
|
285
|
+
): # /* remaining part */
|
286
|
+
if points is None:
|
287
|
+
yield plot
|
288
|
+
else:
|
289
|
+
points.append(plot)
|
290
|
+
if points is not None:
|
291
|
+
for plot in reversed(points):
|
292
|
+
yield plot
|
293
|
+
|
294
|
+
@staticmethod
|
295
|
+
def plot_cubic_bezier_seg(x0, y0, x1, y1, x2, y2, x3, y3):
|
296
|
+
"""
|
297
|
+
Plot limited cubic Bezier segment
|
298
|
+
|
299
|
+
This algorithm can plot curves that do not inflect.
|
300
|
+
|
301
|
+
It is used as part of the general algorithm, which breaks at the infection point(s)
|
302
|
+
|
303
|
+
yields x, y
|
304
|
+
"""
|
305
|
+
second_leg = []
|
306
|
+
f = 0
|
307
|
+
fx = 0
|
308
|
+
fy = 0
|
309
|
+
leg = 1
|
310
|
+
if x0 < x3:
|
311
|
+
sx = 1
|
312
|
+
else:
|
313
|
+
sx = -1
|
314
|
+
if y0 < y3:
|
315
|
+
sy = 1 # /* step direction */
|
316
|
+
else:
|
317
|
+
sy = -1 # /* step direction */
|
318
|
+
xc = -abs(x0 + x1 - x2 - x3)
|
319
|
+
xa = xc - 4 * sx * (x1 - x2)
|
320
|
+
xb = sx * (x0 - x1 - x2 + x3)
|
321
|
+
yc = -abs(y0 + y1 - y2 - y3)
|
322
|
+
ya = yc - 4 * sy * (y1 - y2)
|
323
|
+
yb = sy * (y0 - y1 - y2 + y3)
|
324
|
+
ab = 0
|
325
|
+
ac = 0
|
326
|
+
bc = 0
|
327
|
+
cb = 0
|
328
|
+
xx = 0
|
329
|
+
xy = 0
|
330
|
+
yy = 0
|
331
|
+
dx = 0
|
332
|
+
dy = 0
|
333
|
+
ex = 0
|
334
|
+
pxy = 0
|
335
|
+
EP = 0.01
|
336
|
+
# /* check for curve restrains */
|
337
|
+
# /* slope P0-P1 == P2-P3 and (P0-P3 == P1-P2 or no slope change)
|
338
|
+
# if (x1 - x0) * (x2 - x3) < EP and ((x3 - x0) * (x1 - x2) < EP or xb * xb < xa * xc + EP):
|
339
|
+
# return
|
340
|
+
# if (y1 - y0) * (y2 - y3) < EP and ((y3 - y0) * (y1 - y2) < EP or yb * yb < ya * yc + EP):
|
341
|
+
# return
|
342
|
+
|
343
|
+
if xa == 0 and ya == 0: # /* quadratic Bezier */
|
344
|
+
# return plot_quad_bezier_seg(x0, y0, (3 * x1 - x0) >> 1, (3 * y1 - y0) >> 1, x3, y3)
|
345
|
+
sx = floor((3 * x1 - x0 + 1) / 2)
|
346
|
+
sy = floor((3 * y1 - y0 + 1) / 2) # /* new midpoint */
|
347
|
+
|
348
|
+
for plot in ZinglPlotter.plot_quad_bezier_seg(x0, y0, sx, sy, x3, y3):
|
349
|
+
yield plot
|
350
|
+
return
|
351
|
+
x1 = (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0) + 1 # /* line lengths */
|
352
|
+
x2 = (x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3) + 1
|
353
|
+
|
354
|
+
while True: # /* loop over both ends */
|
355
|
+
ab = xa * yb - xb * ya
|
356
|
+
ac = xa * yc - xc * ya
|
357
|
+
bc = xb * yc - xc * yb
|
358
|
+
ex = (
|
359
|
+
ab * (ab + ac - 3 * bc) + ac * ac
|
360
|
+
) # /* P0 part of self-intersection loop? */
|
361
|
+
if ex > 0:
|
362
|
+
f = 1 # /* calc resolution */
|
363
|
+
else:
|
364
|
+
f = floor(sqrt(1 + 1024 / x1)) # /* calc resolution */
|
365
|
+
ab *= f
|
366
|
+
ac *= f
|
367
|
+
bc *= f
|
368
|
+
ex *= f * f # /* increase resolution */
|
369
|
+
xy = 9 * (ab + ac + bc) / 8
|
370
|
+
cb = 8 * (xa - ya) # /* init differences of 1st degree */
|
371
|
+
dx = 27 * (
|
372
|
+
8 * ab * (yb * yb - ya * yc) + ex * (ya + 2 * yb + yc)
|
373
|
+
) / 64 - ya * ya * (xy - ya)
|
374
|
+
dy = 27 * (
|
375
|
+
8 * ab * (xb * xb - xa * xc) - ex * (xa + 2 * xb + xc)
|
376
|
+
) / 64 - xa * xa * (xy + xa)
|
377
|
+
# /* init differences of 2nd degree */
|
378
|
+
xx = (
|
379
|
+
3
|
380
|
+
* (
|
381
|
+
3 * ab * (3 * yb * yb - ya * ya - 2 * ya * yc)
|
382
|
+
- ya * (3 * ac * (ya + yb) + ya * cb)
|
383
|
+
)
|
384
|
+
/ 4
|
385
|
+
)
|
386
|
+
yy = (
|
387
|
+
3
|
388
|
+
* (
|
389
|
+
3 * ab * (3 * xb * xb - xa * xa - 2 * xa * xc)
|
390
|
+
- xa * (3 * ac * (xa + xb) + xa * cb)
|
391
|
+
)
|
392
|
+
/ 4
|
393
|
+
)
|
394
|
+
xy = xa * ya * (6 * ab + 6 * ac - 3 * bc + cb)
|
395
|
+
ac = ya * ya
|
396
|
+
cb = xa * xa
|
397
|
+
xy = (
|
398
|
+
3 * (xy + 9 * f * (cb * yb * yc - xb * xc * ac) - 18 * xb * yb * ab) / 8
|
399
|
+
)
|
400
|
+
|
401
|
+
if ex < 0: # /* negate values if inside self-intersection loop */
|
402
|
+
dx = -dx
|
403
|
+
dy = -dy
|
404
|
+
xx = -xx
|
405
|
+
yy = -yy
|
406
|
+
xy = -xy
|
407
|
+
ac = -ac
|
408
|
+
cb = -cb # /* init differences of 3rd degree */
|
409
|
+
ab = 6 * ya * ac
|
410
|
+
ac = -6 * xa * ac
|
411
|
+
bc = 6 * ya * cb
|
412
|
+
cb = -6 * xa * cb
|
413
|
+
dx += xy
|
414
|
+
ex = dx + dy
|
415
|
+
dy += xy # /* error of 1st step */
|
416
|
+
try:
|
417
|
+
pxy = 0
|
418
|
+
fx = fy = f
|
419
|
+
while x0 != x3 and y0 != y3:
|
420
|
+
if leg == 0:
|
421
|
+
second_leg.append((x0, y0)) # /* plot curve */
|
422
|
+
else:
|
423
|
+
yield x0, y0 # /* plot curve */
|
424
|
+
while True: # /* move sub-steps of one pixel */
|
425
|
+
if pxy == 0:
|
426
|
+
if dx > xy or dy < xy:
|
427
|
+
raise StopIteration # /* confusing */
|
428
|
+
if pxy == 1:
|
429
|
+
if dx > 0 or dy < 0:
|
430
|
+
raise StopIteration # /* values */
|
431
|
+
y1 = 2 * ex - dy # /* save value for test of y step */
|
432
|
+
if 2 * ex >= dx: # /* x sub-step */
|
433
|
+
fx -= 1
|
434
|
+
dx += xx
|
435
|
+
ex += dx
|
436
|
+
xy += ac
|
437
|
+
dy += xy
|
438
|
+
yy += bc
|
439
|
+
xx += ab
|
440
|
+
elif y1 > 0:
|
441
|
+
raise StopIteration
|
442
|
+
if y1 <= 0: # /* y sub-step */
|
443
|
+
fy -= 1
|
444
|
+
dy += yy
|
445
|
+
ex += dy
|
446
|
+
xy += bc
|
447
|
+
dx += xy
|
448
|
+
xx += ac
|
449
|
+
yy += cb
|
450
|
+
if not (fx > 0 and fy > 0): # /* pixel complete? */
|
451
|
+
break
|
452
|
+
if 2 * fx <= f:
|
453
|
+
x0 += sx
|
454
|
+
fx += f # /* x step */
|
455
|
+
if 2 * fy <= f:
|
456
|
+
y0 += sy
|
457
|
+
fy += f # /* y step */
|
458
|
+
if pxy == 0 and dx < 0 and dy > 0:
|
459
|
+
pxy = 1 # /* pixel ahead valid */
|
460
|
+
except StopIteration:
|
461
|
+
pass
|
462
|
+
xx = x0
|
463
|
+
x0 = x3
|
464
|
+
x3 = xx
|
465
|
+
sx = -sx
|
466
|
+
xb = -xb # /* swap legs */
|
467
|
+
yy = y0
|
468
|
+
y0 = y3
|
469
|
+
y3 = yy
|
470
|
+
sy = -sy
|
471
|
+
yb = -yb
|
472
|
+
x1 = x2
|
473
|
+
if not (leg != 0):
|
474
|
+
break
|
475
|
+
leg -= 1 # /* try other end */
|
476
|
+
for plot in ZinglPlotter.plot_line(
|
477
|
+
x3, y3, x0, y0
|
478
|
+
): # /* remaining part in case of cusp or crunode */
|
479
|
+
second_leg.append(plot)
|
480
|
+
for plot in reversed(second_leg):
|
481
|
+
yield plot
|
482
|
+
|
483
|
+
@staticmethod
|
484
|
+
def plot_cubic_bezier(x0, y0, x1, y1, x2, y2, x3, y3):
|
485
|
+
"""
|
486
|
+
Zingl-Bresenham cubic bezier draw algorithm
|
487
|
+
|
488
|
+
Plot any quadratic Bezier curve
|
489
|
+
|
490
|
+
yields x, y
|
491
|
+
"""
|
492
|
+
x0 = int(x0)
|
493
|
+
y0 = int(y0)
|
494
|
+
# control points are permitted fractional elements.
|
495
|
+
x3 = int(x3)
|
496
|
+
y3 = int(y3)
|
497
|
+
n = 0
|
498
|
+
i = 0
|
499
|
+
xc = x0 + x1 - x2 - x3
|
500
|
+
xa = xc - 4 * (x1 - x2)
|
501
|
+
xb = x0 - x1 - x2 + x3
|
502
|
+
xd = xb + 4 * (x1 + x2)
|
503
|
+
yc = y0 + y1 - y2 - y3
|
504
|
+
ya = yc - 4 * (y1 - y2)
|
505
|
+
yb = y0 - y1 - y2 + y3
|
506
|
+
yd = yb + 4 * (y1 + y2)
|
507
|
+
fx0 = x0
|
508
|
+
fx1 = 0
|
509
|
+
fx2 = 0
|
510
|
+
fx3 = 0
|
511
|
+
fy0 = y0
|
512
|
+
fy1 = 0
|
513
|
+
fy2 = 0
|
514
|
+
fy3 = 0
|
515
|
+
t1 = xb * xb - xa * xc
|
516
|
+
t2 = 0
|
517
|
+
t = [0] * 5
|
518
|
+
# /* sub-divide curve at gradient sign changes */
|
519
|
+
if xa == 0: # /* horizontal */
|
520
|
+
if abs(xc) < 2 * abs(xb):
|
521
|
+
t[n] = xc / (2.0 * xb) # /* one change */
|
522
|
+
n += 1
|
523
|
+
elif t1 > 0.0: # /* two changes */
|
524
|
+
t2 = sqrt(t1)
|
525
|
+
t1 = (xb - t2) / xa
|
526
|
+
if abs(t1) < 1.0:
|
527
|
+
t[n] = t1
|
528
|
+
n += 1
|
529
|
+
t1 = (xb + t2) / xa
|
530
|
+
if abs(t1) < 1.0:
|
531
|
+
t[n] = t1
|
532
|
+
n += 1
|
533
|
+
t1 = yb * yb - ya * yc
|
534
|
+
if ya == 0: # /* vertical */
|
535
|
+
if abs(yc) < 2 * abs(yb):
|
536
|
+
t[n] = yc / (2.0 * yb) # /* one change */
|
537
|
+
n += 1
|
538
|
+
elif t1 > 0.0: # /* two changes */
|
539
|
+
t2 = sqrt(t1)
|
540
|
+
t1 = (yb - t2) / ya
|
541
|
+
if abs(t1) < 1.0:
|
542
|
+
t[n] = t1
|
543
|
+
n += 1
|
544
|
+
t1 = (yb + t2) / ya
|
545
|
+
if abs(t1) < 1.0:
|
546
|
+
t[n] = t1
|
547
|
+
n += 1
|
548
|
+
i = 1
|
549
|
+
while i < n: # /* bubble sort of 4 points */
|
550
|
+
t1 = t[i - 1]
|
551
|
+
if t1 > t[i]:
|
552
|
+
t[i - 1] = t[i]
|
553
|
+
t[i] = t1
|
554
|
+
i = 0
|
555
|
+
i += 1
|
556
|
+
t1 = -1.0
|
557
|
+
t[n] = 1.0 # /* begin / end point */
|
558
|
+
for i in range(0, n + 1): # /* plot each segment separately */
|
559
|
+
t2 = t[i] # /* sub-divide at t[i-1], t[i] */
|
560
|
+
fx1 = (
|
561
|
+
t1 * (t1 * xb - 2 * xc) - t2 * (t1 * (t1 * xa - 2 * xb) + xc) + xd
|
562
|
+
) / 8 - fx0
|
563
|
+
fy1 = (
|
564
|
+
t1 * (t1 * yb - 2 * yc) - t2 * (t1 * (t1 * ya - 2 * yb) + yc) + yd
|
565
|
+
) / 8 - fy0
|
566
|
+
fx2 = (
|
567
|
+
t2 * (t2 * xb - 2 * xc) - t1 * (t2 * (t2 * xa - 2 * xb) + xc) + xd
|
568
|
+
) / 8 - fx0
|
569
|
+
fy2 = (
|
570
|
+
t2 * (t2 * yb - 2 * yc) - t1 * (t2 * (t2 * ya - 2 * yb) + yc) + yd
|
571
|
+
) / 8 - fy0
|
572
|
+
fx3 = (t2 * (t2 * (3 * xb - t2 * xa) - 3 * xc) + xd) / 8
|
573
|
+
fx0 -= fx3
|
574
|
+
fy3 = (t2 * (t2 * (3 * yb - t2 * ya) - 3 * yc) + yd) / 8
|
575
|
+
fy0 -= fy3
|
576
|
+
x3 = floor(fx3 + 0.5)
|
577
|
+
y3 = floor(fy3 + 0.5) # /* scale bounds */
|
578
|
+
if fx0 != 0.0:
|
579
|
+
fx0 = (x0 - x3) / fx0
|
580
|
+
fx1 *= fx0
|
581
|
+
fx2 *= fx0
|
582
|
+
if fy0 != 0.0:
|
583
|
+
fy0 = (y0 - y3) / fy0
|
584
|
+
fy1 *= fy0
|
585
|
+
fy2 *= fy0
|
586
|
+
if x0 != x3 or y0 != y3: # /* segment t1 - t2 */
|
587
|
+
# plotCubicBezierSeg(x0,y0, x0+fx1,y0+fy1, x0+fx2,y0+fy2, x3,y3)
|
588
|
+
yield from ZinglPlotter.plot_cubic_bezier_seg(
|
589
|
+
x0, y0, x0 + fx1, y0 + fy1, x0 + fx2, y0 + fy2, x3, y3
|
590
|
+
)
|
591
|
+
x0 = x3
|
592
|
+
y0 = y3
|
593
|
+
fx0 = fx3
|
594
|
+
fy0 = fy3
|
595
|
+
t1 = t2
|