More debug lines and better intersections

pull/4/head
Reenforcements 2018-11-23 13:14:26 -05:00
rodzic ec27f221a5
commit e5173dd065
16 zmienionych plików z 1048 dodań i 198 usunięć

Wyświetl plik

@ -3,8 +3,13 @@
<component name="ChangeListManager">
<list default="true" id="0b5af789-e47c-4138-bdb9-8fa765481e1e" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/LOG.md" beforeDir="false" afterPath="$PROJECT_DIR$/LOG.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/Tests/complexPath.svg" beforeDir="false" afterPath="$PROJECT_DIR$/Tests/complexPath.svg" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/PES.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/PES.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/PES_Emb_mathutils.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/PES_Emb_mathutils.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/PES_render_utils.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/PES_render_utils.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/main.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/svgFunctions.py" beforeDir="false" afterPath="$PROJECT_DIR$/src/svgFunctions.py" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
@ -14,8 +19,8 @@
</component>
<component name="CoverageDataManager">
<SUITE FILE_PATH="coverage/PES_Embroidery$svgImport.coverage" NAME="svgImport Coverage Results" MODIFIED="1541478220694" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/src/learning" />
<SUITE FILE_PATH="coverage/PES_Embroidery$main.coverage" NAME="main Coverage Results" MODIFIED="1542919599191" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/src" />
<SUITE FILE_PATH="coverage/PES_Embroidery$PECRender_main.coverage" NAME="PECRender-main Coverage Results" MODIFIED="1542678577371" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/PECRender" />
<SUITE FILE_PATH="coverage/PES_Embroidery$main.coverage" NAME="main Coverage Results" MODIFIED="1542996815158" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/src" />
<SUITE FILE_PATH="coverage/PES_Embroidery$PECRender_main.coverage" NAME="PECRender-main Coverage Results" MODIFIED="1542987287831" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/PECRender" />
<SUITE FILE_PATH="coverage/PES_Embroidery$getColors.coverage" NAME="getColors Coverage Results" MODIFIED="1542917684965" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/Colors" />
<SUITE FILE_PATH="coverage/PES_Embroidery$main__1_.coverage" NAME="PECRender-main Coverage Results" MODIFIED="1542509072203" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/PECRender" />
</component>
@ -23,19 +28,19 @@
<session id="-1920598427">
<usages-collector id="statistics.lifecycle.project">
<counts>
<entry key="project.closed" value="7" />
<entry key="project.closed" value="8" />
<entry key="project.open.time.2" value="1" />
<entry key="project.open.time.5" value="1" />
<entry key="project.open.time.6" value="4" />
<entry key="project.open.time.7" value="1" />
<entry key="project.open.time.8" value="1" />
<entry key="project.opened" value="8" />
<entry key="project.open.time.8" value="2" />
<entry key="project.opened" value="9" />
</counts>
</usages-collector>
<usages-collector id="statistics.vcs.git.usages" />
<usages-collector id="statistics.file.types.edit">
<counts>
<entry key="Python" value="23405" />
<entry key="Python" value="25103" />
</counts>
</usages-collector>
<usages-collector id="statistics.js.language.service.starts" />
@ -53,7 +58,7 @@
</usages-collector>
<usages-collector id="statistics.file.extensions.edit">
<counts>
<entry key="py" value="23405" />
<entry key="py" value="25103" />
</counts>
</usages-collector>
</session>
@ -63,8 +68,8 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/main.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="403">
<caret line="41" lean-forward="true" selection-start-line="41" selection-end-line="41" />
<state relative-caret-position="46">
<caret line="25" column="17" lean-forward="true" selection-start-line="25" selection-start-column="17" selection-end-line="25" selection-end-column="17" />
<folding>
<element signature="e#0#15#0" expanded="true" />
</folding>
@ -72,22 +77,15 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/PES.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="730">
<caret line="271" column="12" lean-forward="true" selection-start-line="271" selection-start-column="12" selection-end-line="271" selection-end-column="12" />
<state relative-caret-position="181">
<caret line="235" lean-forward="true" selection-start-line="235" selection-end-line="235" />
<folding>
<element signature="e#0#23#0" expanded="true" />
<marker date="1542919944286" expanded="true" signature="133:210" ph="..." />
<marker date="1542919944286" expanded="true" signature="387:427" ph="..." />
<marker date="1542919944286" expanded="true" signature="3372:3919" ph="..." />
<marker date="1542919944286" expanded="true" signature="4944:6662" ph="..." />
<marker date="1542919944286" expanded="true" signature="6840:6918" ph="..." />
<marker date="1542919944286" expanded="true" signature="6932:6971" ph="..." />
<marker date="1542919944286" expanded="true" signature="7158:7163" ph="..." />
<marker date="1542919944286" expanded="true" signature="7447:7453" ph="..." />
<marker date="1542919944286" expanded="true" signature="7639:7644" ph="..." />
<marker date="1542986842340" expanded="true" signature="133:210" ph="..." />
<marker date="1542986842340" expanded="true" signature="387:427" ph="..." />
</folding>
</state>
</provider>
@ -96,26 +94,15 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/svgFunctions.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1502">
<caret line="105" column="33" lean-forward="true" selection-start-line="105" selection-start-column="33" selection-end-line="105" selection-end-column="33" />
<state relative-caret-position="327">
<caret line="160" column="21" lean-forward="true" selection-start-line="160" selection-start-column="21" selection-end-line="160" selection-end-column="21" />
<folding>
<element signature="e#0#19#0" expanded="true" />
<marker date="1542919038136" expanded="true" signature="421:759" ph="..." />
<marker date="1542919038136" expanded="true" signature="832:833" ph="..." />
<marker date="1542919038136" expanded="true" signature="832:896" ph="..." />
<marker date="1542919038136" expanded="true" signature="4293:4298" ph="..." />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/Colors/getColors.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="437">
<caret line="42" column="37" lean-forward="true" selection-start-line="42" selection-start-column="37" selection-end-line="42" selection-end-column="37" />
<folding>
<element signature="e#0#9#0" expanded="true" />
<marker date="1542996346507" expanded="true" signature="421:759" ph="..." />
<marker date="1542996346507" expanded="true" signature="842:843" ph="..." />
<marker date="1542996346507" expanded="true" signature="842:906" ph="..." />
<marker date="1542996346507" expanded="true" signature="5671:5737" ph="..." />
<marker date="1542996346507" expanded="true" signature="6985:6990" ph="..." />
</folding>
</state>
</provider>
@ -124,16 +111,17 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/PES_Emb_mathutils.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="443">
<caret line="74" column="8" lean-forward="true" selection-start-line="74" selection-start-column="8" selection-end-line="74" selection-end-column="8" />
<state relative-caret-position="397">
<caret line="71" lean-forward="true" selection-start-line="71" selection-end-line="71" />
<folding>
<element signature="e#0#29#0" expanded="true" />
<marker date="1542908071934" expanded="true" signature="112:1695" ph="..." />
<marker date="1542908071934" expanded="true" signature="401:624" ph="..." />
<marker date="1542908071934" expanded="true" signature="694:1488" ph="..." />
<marker date="1542908071934" expanded="true" signature="1746:1822" ph="..." />
<marker date="1542908071934" expanded="true" signature="1893:1898" ph="..." />
<marker date="1542908071934" expanded="true" signature="1893:2374" ph="..." />
<marker date="1542995051340" expanded="true" signature="112:1695" ph="..." />
<marker date="1542995051340" expanded="true" signature="401:624" ph="..." />
<marker date="1542995051340" expanded="true" signature="694:1488" ph="..." />
<marker date="1542995051340" expanded="true" signature="1746:1822" ph="..." />
<marker date="1542995051340" expanded="true" signature="1888:1893" ph="..." />
<marker date="1542995051340" expanded="true" signature="1888:2539" ph="..." />
<marker date="1542995051340" expanded="true" signature="2449:2539" ph="..." />
</folding>
</state>
</provider>
@ -148,31 +136,17 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/PECRender/main.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="68">
<caret line="43" column="22" selection-start-line="43" selection-start-column="22" selection-end-line="43" selection-end-column="22" />
<folding>
<element signature="e#0#10#0" expanded="true" />
<marker date="1542908086234" expanded="true" signature="272:446" ph="..." />
<marker date="1542908086234" expanded="true" signature="6331:6335" ph="..." />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/PES_render_utils.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="362">
<caret line="26" column="13" lean-forward="true" selection-start-line="26" selection-start-column="13" selection-end-line="26" selection-end-column="13" />
<state relative-caret-position="225">
<caret line="15" lean-forward="true" selection-start-line="15" selection-end-line="15" />
<folding>
<element signature="e#0#13#0" expanded="true" />
<marker date="1542906615593" expanded="true" signature="129:130" ph="..." />
<marker date="1542906615593" expanded="true" signature="129:135" ph="..." />
<marker date="1542906615593" expanded="true" signature="1186:1387" ph="..." />
<marker date="1542906615593" expanded="true" signature="1414:1509" ph="..." />
<marker date="1542996800150" expanded="true" signature="129:130" ph="..." />
<marker date="1542996800150" expanded="true" signature="129:135" ph="..." />
<marker date="1542996800150" expanded="true" signature="1233:1441" ph="..." />
<marker date="1542996800150" expanded="true" signature="1468:1563" ph="..." />
</folding>
</state>
</provider>
@ -189,9 +163,6 @@
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>0xfe</find>
<find>End stitches</find>
<find>Beep</find>
<find>color</find>
<find>color change</find>
<find>Color change</find>
@ -199,18 +170,14 @@
<find>width</find>
<find>getCoordinate</find>
<find>sdfsd</find>
<find>getStartAndEndPointsOfLineInBox</find>
<find>getBoxDiagonalLength</find>
<find>InfLine</find>
<find>to_svg</find>
<find>to_svg_Line</find>
<find>svgpathtools</find>
<find>invert</find>
<find>invertSlope</find>
<find>intersectionPath</find>
<find>readBytes</find>
<find>Blue</find>
<find>Stitch</find>
<find>Teal</find>
<find>imag</find>
<find>attributesattributes</find>
@ -219,6 +186,13 @@
<find>makeStitchLines</find>
<find>loadVectorGraphic</find>
<find>getClosestColor</find>
<find>getStartAndEndPointsOfLineInBox</find>
<find>x_for_y</find>
<find>invertSlope</find>
<find>InfLine</find>
<find>[</find>
<find>addPoint</find>
<find>Stitch</find>
</findStrings>
</component>
<component name="Git.Settings">
@ -233,13 +207,13 @@
<option value="$PROJECT_DIR$/src/svg.py" />
<option value="$PROJECT_DIR$/src/PES-Emb-mathutils.py" />
<option value="$PROJECT_DIR$/src/utilities.py" />
<option value="$PROJECT_DIR$/src/PES_render_utils.py" />
<option value="$PROJECT_DIR$/src/PES_Emb_mathutils.py" />
<option value="$PROJECT_DIR$/PECRender/main.py" />
<option value="$PROJECT_DIR$/Colors/getColors.py" />
<option value="$PROJECT_DIR$/src/svgFunctions.py" />
<option value="$PROJECT_DIR$/src/main.py" />
<option value="$PROJECT_DIR$/src/PES.py" />
<option value="$PROJECT_DIR$/src/main.py" />
<option value="$PROJECT_DIR$/src/PES_Emb_mathutils.py" />
<option value="$PROJECT_DIR$/src/svgFunctions.py" />
<option value="$PROJECT_DIR$/src/PES_render_utils.py" />
</list>
</option>
</component>
@ -249,7 +223,7 @@
<detection-done>true</detection-done>
<sorting>DEFINITION_ORDER</sorting>
</component>
<component name="ProjectFrameBounds">
<component name="ProjectFrameBounds" extendedState="6">
<option name="y" value="23" />
<option name="width" value="1680" />
<option name="height" value="1027" />
@ -262,7 +236,6 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<expand>
@ -293,6 +266,7 @@
<select />
</subPane>
</pane>
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
@ -378,7 +352,7 @@
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/src/main.py" />
<option name="PARAMETERS" value="-i ../Tests/simplePath.svg -o ../TestOutput/simple.PES -d" />
<option name="PARAMETERS" value="-i ../Tests/zigzag.svg -o ../TestOutput/simple.PES -d" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
@ -416,8 +390,8 @@
</list>
<recent_temporary>
<list>
<item itemvalue="Python.getColors" />
<item itemvalue="Python.PECRender-main" />
<item itemvalue="Python.getColors" />
<item itemvalue="Python.svgImport" />
</list>
</recent_temporary>
@ -436,10 +410,10 @@
<servers />
</component>
<component name="ToolWindowManager">
<frame x="0" y="23" width="1680" height="1027" extended-state="0" />
<frame x="0" y="23" width="1680" height="1027" extended-state="6" />
<editor active="true" />
<layout>
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.15873016" />
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.16056167" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Favorites" order="2" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
@ -548,16 +522,19 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/PES_render_utils.py">
<entry file="file:///usr/local/lib/python2.7/site-packages/svgpathtools/path.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="362">
<caret line="26" column="13" lean-forward="true" selection-start-line="26" selection-start-column="13" selection-end-line="26" selection-end-column="13" />
<state relative-caret-position="199">
<caret line="1120" column="8" selection-start-line="1120" selection-start-column="8" selection-end-line="1120" selection-end-column="8" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Colors/getColors.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="490">
<caret line="82" column="30" lean-forward="true" selection-start-line="82" selection-start-column="30" selection-end-line="82" selection-end-column="30" />
<folding>
<element signature="e#0#13#0" expanded="true" />
<marker date="1542906615593" expanded="true" signature="129:130" ph="..." />
<marker date="1542906615593" expanded="true" signature="129:135" ph="..." />
<marker date="1542906615593" expanded="true" signature="1186:1387" ph="..." />
<marker date="1542906615593" expanded="true" signature="1414:1509" ph="..." />
<element signature="e#0#9#0" expanded="true" />
</folding>
</state>
</provider>
@ -568,16 +545,61 @@
<caret line="43" column="22" selection-start-line="43" selection-start-column="22" selection-end-line="43" selection-end-column="22" />
<folding>
<element signature="e#0#10#0" expanded="true" />
<marker date="1542908086234" expanded="true" signature="272:446" ph="..." />
<marker date="1542908086234" expanded="true" signature="6331:6335" ph="..." />
</folding>
</state>
</provider>
</entry>
<entry file="file:///usr/local/lib/python2.7/site-packages/svgpathtools/path.py">
<entry file="file://$PROJECT_DIR$/src/main.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="199">
<caret line="1120" column="8" selection-start-line="1120" selection-start-column="8" selection-end-line="1120" selection-end-column="8" />
<state relative-caret-position="46">
<caret line="25" column="17" lean-forward="true" selection-start-line="25" selection-start-column="17" selection-end-line="25" selection-end-column="17" />
<folding>
<element signature="e#0#15#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/svgFunctions.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="327">
<caret line="160" column="21" lean-forward="true" selection-start-line="160" selection-start-column="21" selection-end-line="160" selection-end-column="21" />
<folding>
<element signature="e#0#19#0" expanded="true" />
<marker date="1542996346507" expanded="true" signature="421:759" ph="..." />
<marker date="1542996346507" expanded="true" signature="842:843" ph="..." />
<marker date="1542996346507" expanded="true" signature="842:906" ph="..." />
<marker date="1542996346507" expanded="true" signature="5671:5737" ph="..." />
<marker date="1542996346507" expanded="true" signature="6985:6990" ph="..." />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/PES.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="181">
<caret line="235" lean-forward="true" selection-start-line="235" selection-end-line="235" />
<folding>
<element signature="e#0#23#0" expanded="true" />
<marker date="1542986842340" expanded="true" signature="133:210" ph="..." />
<marker date="1542986842340" expanded="true" signature="387:427" ph="..." />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/PES_Emb_mathutils.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="397">
<caret line="71" lean-forward="true" selection-start-line="71" selection-end-line="71" />
<folding>
<element signature="e#0#29#0" expanded="true" />
<marker date="1542995051340" expanded="true" signature="112:1695" ph="..." />
<marker date="1542995051340" expanded="true" signature="401:624" ph="..." />
<marker date="1542995051340" expanded="true" signature="694:1488" ph="..." />
<marker date="1542995051340" expanded="true" signature="1746:1822" ph="..." />
<marker date="1542995051340" expanded="true" signature="1888:1893" ph="..." />
<marker date="1542995051340" expanded="true" signature="1888:2539" ph="..." />
<marker date="1542995051340" expanded="true" signature="2449:2539" ph="..." />
</folding>
</state>
</provider>
</entry>
@ -588,71 +610,16 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/PES_Emb_mathutils.py">
<entry file="file://$PROJECT_DIR$/src/PES_render_utils.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="443">
<caret line="74" column="8" lean-forward="true" selection-start-line="74" selection-start-column="8" selection-end-line="74" selection-end-column="8" />
<state relative-caret-position="225">
<caret line="15" lean-forward="true" selection-start-line="15" selection-end-line="15" />
<folding>
<element signature="e#0#29#0" expanded="true" />
<marker date="1542908071934" expanded="true" signature="112:1695" ph="..." />
<marker date="1542908071934" expanded="true" signature="401:624" ph="..." />
<marker date="1542908071934" expanded="true" signature="694:1488" ph="..." />
<marker date="1542908071934" expanded="true" signature="1746:1822" ph="..." />
<marker date="1542908071934" expanded="true" signature="1893:1898" ph="..." />
<marker date="1542908071934" expanded="true" signature="1893:2374" ph="..." />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/Colors/getColors.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="437">
<caret line="42" column="37" lean-forward="true" selection-start-line="42" selection-start-column="37" selection-end-line="42" selection-end-column="37" />
<folding>
<element signature="e#0#9#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/svgFunctions.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="1502">
<caret line="105" column="33" lean-forward="true" selection-start-line="105" selection-start-column="33" selection-end-line="105" selection-end-column="33" />
<folding>
<element signature="e#0#19#0" expanded="true" />
<marker date="1542919038136" expanded="true" signature="421:759" ph="..." />
<marker date="1542919038136" expanded="true" signature="832:833" ph="..." />
<marker date="1542919038136" expanded="true" signature="832:896" ph="..." />
<marker date="1542919038136" expanded="true" signature="4293:4298" ph="..." />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="403">
<caret line="41" lean-forward="true" selection-start-line="41" selection-end-line="41" />
<folding>
<element signature="e#0#15#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/PES.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="730">
<caret line="271" column="12" lean-forward="true" selection-start-line="271" selection-start-column="12" selection-end-line="271" selection-end-column="12" />
<folding>
<element signature="e#0#23#0" expanded="true" />
<marker date="1542919944286" expanded="true" signature="133:210" ph="..." />
<marker date="1542919944286" expanded="true" signature="387:427" ph="..." />
<marker date="1542919944286" expanded="true" signature="3372:3919" ph="..." />
<marker date="1542919944286" expanded="true" signature="4944:6662" ph="..." />
<marker date="1542919944286" expanded="true" signature="6840:6918" ph="..." />
<marker date="1542919944286" expanded="true" signature="6932:6971" ph="..." />
<marker date="1542919944286" expanded="true" signature="7158:7163" ph="..." />
<marker date="1542919944286" expanded="true" signature="7447:7453" ph="..." />
<marker date="1542919944286" expanded="true" signature="7639:7644" ph="..." />
<element signature="e#0#13#0" expanded="true" />
<marker date="1542996800150" expanded="true" signature="129:130" ph="..." />
<marker date="1542996800150" expanded="true" signature="129:135" ph="..." />
<marker date="1542996800150" expanded="true" signature="1233:1441" ph="..." />
<marker date="1542996800150" expanded="true" signature="1468:1563" ph="..." />
</folding>
</state>
</provider>

6
LOG.md
Wyświetl plik

@ -1,3 +1,9 @@
# 11/23
Very good progress. I figured out that paths don't work properly unless you draw them a certain way. I'm not exactly sure what that way is yet. I think you just have to draw shapes counter clockwise.
# 11/18
Y axis was flipped apparently.

Wyświetl plik

@ -5,11 +5,35 @@
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="svg2"
viewBox="0 0 744.09448819 1052.3622047"
height="297mm"
width="210mm">
width="210mm"
inkscape:version="0.91 r13725"
sodipodi:docname="complexPath.svg">
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1311"
inkscape:window-height="791"
id="namedview7"
showgrid="false"
inkscape:zoom="0.78623573"
inkscape:cx="459.2861"
inkscape:cy="601.98685"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="layer1" />
<defs
id="defs4" />
<metadata
@ -20,7 +44,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
@ -29,6 +53,6 @@
<path
id="path3336"
d="m 192.34017,404.05477 c 0,0 -8.07021,-172.16463 83.39225,-137.19369 91.46245,34.97094 -96.84261,-108.94793 2.69007,-83.39224 99.53267,25.55569 125.08836,80.70217 125.08836,80.70217 0,0 72.63195,103.56778 -2.69007,141.2288 -75.32203,37.66101 -156.0242,147.95398 -190.99514,98.18764 -34.97094,-49.76634 -17.48547,-99.53268 -17.48547,-99.53268 z"
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
style="fill:#0059ff;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1" />
</g>
</svg>

Przed

Szerokość:  |  Wysokość:  |  Rozmiar: 1.2 KiB

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 2.0 KiB

61
Tests/curves.svg 100644
Wyświetl plik

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="210mm"
height="297mm"
viewBox="0 0 744.09448819 1052.3622047"
id="svg2"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="curves.svg">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.7348765"
inkscape:cx="364.28571"
inkscape:cy="542.85714"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:window-width="1680"
inkscape:window-height="1005"
inkscape:window-x="0"
inkscape:window-y="1"
inkscape:window-maximized="1" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<path
style="fill:#00b100;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1"
d="m 269.18342,466.15335 c 0,0 -29.97332,72.05123 53.02971,69.74559 83.00302,-2.30564 85.88507,-77.23892 85.88507,-77.23892 0,0 3.45846,-92.802 -47.84202,-81.85021 -51.30048,10.95179 -91.07276,89.34354 -91.07276,89.34354 z"
id="path4203"
inkscape:connector-curvature="0" />
</g>
</svg>

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 2.0 KiB

60
Tests/letterC.svg 100644
Wyświetl plik

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="svg2"
viewBox="0 0 744.09448819 1052.3622047"
height="297mm"
width="210mm"
inkscape:version="0.91 r13725"
sodipodi:docname="letterC.svg">
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1182"
inkscape:window-height="781"
id="namedview7"
showgrid="false"
inkscape:zoom="1.3249493"
inkscape:cx="294.116"
inkscape:cy="713.4659"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="layer1" />
<defs
id="defs4" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
transform="translate(24.986001,-280.65881)">
<path
style="fill:#ff0000;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1"
d="m 255.02472,736.01702 36.98255,1.5095 c 0,0 -17.35916,-47.549 33.96356,-49.05849 51.32272,-1.50949 44.53001,71.70086 44.53001,71.70086 0,0 12.83068,31.69933 -45.28475,33.20882 -58.11543,1.50949 -36.98255,-31.69933 -36.98255,-31.69933 l -42.26577,0 c 0,0 9.8117,61.13442 80.75781,57.36069 70.94611,-3.77373 78.49357,-73.9651 78.49357,-73.9651 0,0 -9.81169,-78.49357 -76.22933,-78.49357 -66.41764,0 -73.9651,69.43662 -73.9651,69.43662 z"
id="path4137"
inkscape:connector-curvature="0" />
</g>
</svg>

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 2.2 KiB

634
Tests/trace1.svg 100644

File diff suppressed because one or more lines are too long

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 56 KiB

34
Tests/zigzag.svg 100644
Wyświetl plik

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
version="1.1"
id="svg2"
viewBox="0 0 744.09448819 1052.3622047"
height="297mm"
width="210mm">
<defs
id="defs4" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1">
<path
id="path3336"
d="m 205.71429,426.64792 17.14285,-77.14286 42.85715,51.42857 -42.85715,65.71429 L 380,438.07649 l -82.85714,-77.14286 85.71428,-25.71428 62.85715,85.71428 -97.14286,68.57143 -82.85714,14.28572 97.14285,97.14285 40,-60 -20,-34.28571 85.71429,-31.42857 2.85714,85.71428 -54.28571,25.71429 -42.85715,60 -85.71428,-8.57143 17.14286,-77.14286 -77.14286,5.71429 L 140,580.93363 l -8.57143,-65.71428 68.57143,-40 -42.85714,-25.71429 z"
style="fill:#ff0000;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1" />
</g>
</svg>

Po

Szerokość:  |  Wysokość:  |  Rozmiar: 1.3 KiB

Wyświetl plik

@ -263,10 +263,13 @@ class Stitch:
self.line = Line(start=self.line.end, end=self.line.start)
class ColorChange:
TYPE_COLOR_CHANGE = 0xFEB0
TYPE_COLOR_CHANGE_left = 0xFE
TYPE_COLOR_CHANGE_right = 0xB0
def __init__(self):
None
def __init__(self, colorIndex):
self.colorIndex = colorIndex
def encode(self, b):
None
b.append(ColorChange.TYPE_COLOR_CHANGE_left)
b.append(ColorChange.TYPE_COLOR_CHANGE_right)
b.append(self.colorIndex & 0xFF)

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -51,23 +51,27 @@ class InfLine:
def getBoxDiagonalLength(left, right, top, bottom):
return math.sqrt( math.pow(left-right, 2) + math.pow(top-bottom, 2) )
def getStartAndEndPointsOfLineInBox(infLine, left, right, top, bottom):
def getIntersectionPathFromBox(infLine, left, right, top, bottom):
# Intersect the line with all the sides of the box and
# take the two points inside the box.
# This will always be on the top and bottom
# or on the left and right sides.
p1 = complex(left, infLine.y_for_x(left))
p2 = complex(right, infLine.y_for_x(right))
l1 = Line(start=p1,end=p2)
p3 = complex(top, infLine.x_for_y(top))
p4 = complex(bottom, infLine.x_for_y(bottom))
p3 = complex(infLine.x_for_y(top), top)
p4 = complex(infLine.x_for_y(bottom), bottom)
l2 = Line(start=p3, end=p4)
if p1.imag <= top and p1.imag >= bottom:
return p3, p4
if l1.length() < l2.length():
return l2
else:
return p1, p2
return l1
def getDistanceBetweenPoints(p1, p2):
return math.sqrt( math.pow(p1.real - p2.real, 2) + math.pow(p1.imag - p2.imag, 2) )
# Creates a line with the given y intercept (b) that covers
# the given bounding box.

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -15,6 +15,7 @@ class GenericRenderer:
self.pointBatch = pyglet.graphics.Batch()
pyglet.gl.glLineWidth(2)
pyglet.gl.glPointSize(4)
self.addLine(Line(start=(0+0j), end=(1000+1000j)), 255, 0, 0)
@ -22,7 +23,7 @@ class GenericRenderer:
def addLine(self, line, r, g, b):
self.lineBatch.add(2, pyglet.gl.GL_LINES, None,
('v2f', (line.start.real, line.start.imag, line.end.real, line.end.imag)),
('v2f', (line.start.real, 1000 - line.start.imag, line.end.real, 1000 - line.end.imag)),
('c3B', (r,g,b, r,g,b))
)
def addPath(self, path, r, g, b):
@ -34,7 +35,7 @@ class GenericRenderer:
def addPoint(self, point, r, g, b):
self.pointBatch.add(1, pyglet.gl.GL_POINTS, None,
('v2f', (point.real, point.imag)),
('v2f', (point.real, 1000 - point.imag)),
('c3B', (r, g, b))
)

Plik binarny nie jest wyświetlany.

Wyświetl plik

@ -27,18 +27,18 @@ if paths is None:
sys.exit(0)
# Enumerate the shapes in the SVG to find where stitches should go.
basicStitches = []
basicLines = []
for i, shape in enumerate(paths):
fillColor = getColorOfPathAtIndex(attributes,i)
print("Doing shape {} with fill color {}".format(shape, fillColor))
print("Closest color: {}".format( PES.getClosestColor(fillColor) ))
stitchLines = makeStitchLines(shape,fillColor)
s = makeStitchLines(shape, fillColor, debug=args.debug)
# Append the stitches as their own array so we can separate by colors
basicStitches.append(stitchLines)
basicLines.append(s)
# Make the stitches into a continuous set of commands
PECCommands = createStitchRoutine(basicStitches)
PECCommands = createStitchRoutine(basicLines)
pes = PES(PECCommands=PECCommands)
pes.encode()

Wyświetl plik

@ -33,18 +33,27 @@ def getColorOfPathAtIndex(attributes, index):
return color
def makeStitchLines(shape, fillColor=(0,0,0), threadWidth=0.04, slope=1):
def makeStitchLines(shape, fillColor=(0,0,0), threadWidth=2, slope=1, debug=False):
"""
:type shape: svgpathtools.CubicBezier
"""
stitchLines = []
# Draw the shape
GenericRenderer.globalRenderer.addPath(shape, 50, 120, 255)
# Get the bounds of the shape
left, right, bottom, top = shape.bbox()
width = right - left
height = top - bottom
center = complex( (left + right) / 2, (top + bottom) / 2)
# Draw the bounding box
GenericRenderer.globalRenderer.addLine(Line( start=complex(left,top) ,end=complex(right,top) ), 0, 255, 255)
GenericRenderer.globalRenderer.addLine(Line(start=complex(right, top), end=complex(right, bottom)), 0, 255, 255)
GenericRenderer.globalRenderer.addLine(Line(start=complex(right, bottom), end=complex(left, bottom)), 0, 255, 255)
GenericRenderer.globalRenderer.addLine(Line(start=complex(left, bottom), end=complex(left, top)), 0, 255, 255)
GenericRenderer.globalRenderer.addPoint(center, 0, 255, 255)
# Intersect a line with the given angle over and over
# to find where stitches should start/end.
@ -57,9 +66,17 @@ def makeStitchLines(shape, fillColor=(0,0,0), threadWidth=0.04, slope=1):
# The path should cross through the center of the bounding-
# box square.
intersectionPath = InfLine(m=slope, center=center)
GenericRenderer.globalRenderer.addLine(
Line(start=complex(1000, intersectionPath.y_for_x(1000)),
end=complex(-1000, intersectionPath.y_for_x(-1000)) ), 0, 255, 0)
intersectionPath.invertSlope()
p1, p2 = getStartAndEndPointsOfLineInBox(intersectionPath, left, right, top, bottom)
intersectionPath = Line(start=p1, end=p2)
GenericRenderer.globalRenderer.addLine(
Line(start=complex(1000, intersectionPath.y_for_x(1000)),
end=complex(-1000, intersectionPath.y_for_x(-1000))), 0, 255, 0)
intersectionPath = getIntersectionPathFromBox(intersectionPath, left, right, top, bottom)
GenericRenderer.globalRenderer.addLine(intersectionPath, 255, 255, 0)
#print("Start and end points: {}, {}".format(p1,p2))
#intersectionPath = intersectionPath.to_svg_Line(center=center, length=intersectionLineLength)
@ -77,7 +94,20 @@ def makeStitchLines(shape, fillColor=(0,0,0), threadWidth=0.04, slope=1):
print("Performing up to {} intersections along path: {}".format(totalIntersections, intersectionPath))
print("(From {} to {})".format(intersectionPath.point(0), intersectionPath.point(1.0)))
GenericRenderer.globalRenderer.addPath(shape, 50, 120, 255)
# for s in shape:
# for x in range(0, totalIntersections):
# center = intersectionPath.point((tIncrementAmount * x) / pathLength)
# GenericRenderer.globalRenderer.addPoint(center, 255, 255, 0)
# i = InfLine(m=slope, center=center)
# # Convert it to a bezier line
# l = i.to_svg_Line(center=center, length=3000)
# intersections = shape.intersect(l)
# for i in intersections:
# GenericRenderer.globalRenderer.addPoint(i[0][1].point(i[0][0]), 255, 0, 255)
# GenericRenderer.globalRenderer.addPoint(i[0][1].point(i[0][2]), 255, 0, 255)
#
# print(intersections)
# return []
for x in range(0, totalIntersections):
# Get a new (infinite) line using the point at the current t value
@ -87,36 +117,62 @@ def makeStitchLines(shape, fillColor=(0,0,0), threadWidth=0.04, slope=1):
i = InfLine(m=slope, center=center)
# Convert it to a bezier line
l = i.to_svg_Line(center=center, length=intersectionLineLength)
GenericRenderer.globalRenderer.addLine(l, 255, 255, 255)
#GenericRenderer.globalRenderer.addLine(l, 255, 255, 255)
# Intersect with the shape
intersections = shape.intersect(l)
if len(intersections) % 2 is not 0:
s = "Number of intersections should always be even (its {} ). Make sure all shapes are closed shapes.".format(len(intersections))
raise Exception(s)
if debug:
print(s)
else:
raise Exception(s)
intersectionPoints = []
# Get the intersection points and order them by location
# on the intersection line.
for i in range(0, len( intersections )):
p1 = l.point(intersections[i][1][0])
intersectionPoints.append(p1)
def dist1(p):
return getDistanceBetweenPoints(p, l.start)
intersectionPoints.sort(key=dist1)
if debug:
print("{} intersection points for this iteration.".format(len(intersectionPoints)))
for i in intersectionPoints:
GenericRenderer.globalRenderer.addPoint(i, 255, 0, 255)
genericColors = [(255, 0, 0), (0, 255, 0), (0, 0, 255), (0, 255, 255), (255, 255, 0), (255, 0, 255)]
# Iterate through the intersections to find where to put stitches
for i in range(0, len( intersections )/2):
start = l.point(intersections[i][1][0])
end = l.point(intersections[i+1][1][0])
# Create a stitch for the given start and end points
l = Line(start=start, end=end)
s = Stitch(line=l)
for i in range(0, len( intersectionPoints )/2):
start = intersectionPoints[i*2]
end = intersectionPoints[(i*2)+1]
stitchLines.append(s)
# Create a stitch for the given start and end points
stitchLine = Line(start=start, end=end)
stitchLines.append(stitchLine)
# Draw debug lines
GenericRenderer.globalRenderer.addLine(l, fillColor[0], fillColor[1], fillColor[2])
if debug:
GenericRenderer.globalRenderer.addLine(stitchLine, genericColors[i%6][0], genericColors[i%6][1], genericColors[i%6][2])
else:
GenericRenderer.globalRenderer.addLine(stitchLine, fillColor[0], fillColor[1], fillColor[2])
return stitchLines
# Take all the stitches we created and actually make
# a continuous set of commands for the machine to follow.
def createStitchRoutine(basicStitches):
for shapeStitches in basicStitches:
for stitch in shapeStitches:
def createStitchRoutine(basicLines):
for shapeLines in basicLines:
for line in shapeLines:
# Remove lines that are super short
if stitch.length() < 5.0:
if line.length() < 5.0:
continue

Plik binarny nie jest wyświetlany.