kopia lustrzana https://github.com/Reenforcements/PES-Embroidery
Got intersection math working
rodzic
a59473d7e5
commit
584610e943
|
@ -2,8 +2,11 @@
|
|||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="0b5af789-e47c-4138-bdb9-8fa765481e1e" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/LOG.md" beforeDir="false" afterPath="$PROJECT_DIR$/LOG.md" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/PECRender/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/PECRender/main.py" 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/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" />
|
||||
|
@ -13,8 +16,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="1542424584074" 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="1542565942147" 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="1542903623411" 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__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>
|
||||
<component name="FUSProjectUsageTrigger">
|
||||
|
@ -33,7 +36,7 @@
|
|||
<usages-collector id="statistics.vcs.git.usages" />
|
||||
<usages-collector id="statistics.file.types.edit">
|
||||
<counts>
|
||||
<entry key="Python" value="15613" />
|
||||
<entry key="Python" value="17980" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.js.language.service.starts" />
|
||||
|
@ -51,7 +54,7 @@
|
|||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.edit">
|
||||
<counts>
|
||||
<entry key="py" value="15613" />
|
||||
<entry key="py" value="17980" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
</session>
|
||||
|
@ -61,8 +64,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="157">
|
||||
<caret line="15" lean-forward="true" selection-start-line="15" selection-end-line="15" />
|
||||
<state relative-caret-position="375">
|
||||
<caret line="25" column="16" lean-forward="true" selection-start-line="25" selection-start-column="16" selection-end-line="25" selection-end-column="16" />
|
||||
<folding>
|
||||
<element signature="e#0#15#0" expanded="true" />
|
||||
</folding>
|
||||
|
@ -73,69 +76,48 @@
|
|||
<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="263">
|
||||
<caret line="148" column="7" selection-start-line="148" selection-start-column="7" selection-end-line="148" selection-end-column="7" />
|
||||
<state relative-caret-position="317">
|
||||
<caret line="165" column="12" lean-forward="true" selection-start-line="165" selection-start-column="12" selection-end-line="165" selection-end-column="12" />
|
||||
<folding>
|
||||
<marker date="1542488383227" expanded="true" signature="91:168" ph="..." />
|
||||
<marker date="1542488383227" expanded="true" signature="345:385" ph="..." />
|
||||
<marker date="1542488383227" expanded="true" signature="1480:3114" ph="..." />
|
||||
<marker date="1542488383227" expanded="true" signature="3292:3370" ph="..." />
|
||||
<marker date="1542488383227" expanded="true" signature="3384:3423" ph="..." />
|
||||
<marker date="1542488383227" expanded="true" signature="3464:3469" ph="..." />
|
||||
<element signature="e#0#23#0" expanded="true" />
|
||||
<marker date="1542903616715" expanded="true" signature="121:198" ph="..." />
|
||||
<marker date="1542903616715" expanded="true" signature="375:415" ph="..." />
|
||||
<marker date="1542903616715" expanded="true" signature="1510:3144" ph="..." />
|
||||
<marker date="1542903616715" expanded="true" signature="3322:3400" ph="..." />
|
||||
<marker date="1542903616715" expanded="true" signature="3414:3453" ph="..." />
|
||||
<marker date="1542903616715" expanded="true" signature="3652:3657" ph="..." />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/PECRender/main.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="330">
|
||||
<caret line="22" column="9" lean-forward="true" selection-start-line="22" selection-start-column="9" selection-end-line="22" selection-end-column="9" />
|
||||
<folding>
|
||||
<element signature="e#0#10#0" expanded="true" />
|
||||
<marker date="1542565941388" expanded="true" signature="272:446" ph="..." />
|
||||
<marker date="1542565941388" expanded="true" signature="6154:6158" ph="..." />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file:///usr/local/lib/python2.7/site-packages/pyglet/graphics/vertexdomain.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="372">
|
||||
<caret line="454" lean-forward="true" selection-start-line="454" selection-end-line="454" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<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="255">
|
||||
<caret line="20" column="25" selection-start-line="20" selection-start-column="25" selection-end-line="20" selection-end-column="25" />
|
||||
<state relative-caret-position="90">
|
||||
<caret line="6" column="14" lean-forward="true" selection-start-line="6" selection-start-column="14" selection-end-line="6" selection-end-column="14" />
|
||||
<folding>
|
||||
<element signature="e#0#19#0" expanded="true" />
|
||||
<marker date="1541813377581" expanded="true" signature="343:344" ph="..." />
|
||||
<marker date="1541813377581" expanded="true" signature="343:348" ph="..." />
|
||||
<marker date="1542903295377" expanded="true" signature="343:344" ph="..." />
|
||||
<marker date="1542903295377" expanded="true" signature="343:348" 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_Emb_mathutils.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="135">
|
||||
<caret line="10" column="37" selection-start-line="10" selection-start-column="37" selection-end-line="10" selection-end-column="37" />
|
||||
<state relative-caret-position="231">
|
||||
<caret line="34" column="8" selection-start-line="34" selection-start-column="8" selection-end-line="34" selection-end-column="8" />
|
||||
<folding>
|
||||
<element signature="e#0#29#0" expanded="true" />
|
||||
<marker date="1541561558614" expanded="true" signature="99:671" ph="..." />
|
||||
<marker date="1541561558614" expanded="true" signature="359:425" ph="..." />
|
||||
<marker date="1541561558614" expanded="true" signature="722:798" ph="..." />
|
||||
<marker date="1541561558614" expanded="true" signature="869:874" ph="..." />
|
||||
<marker date="1541561558614" expanded="true" signature="869:1350" ph="..." />
|
||||
<marker date="1542903637276" expanded="true" signature="112:1608" ph="..." />
|
||||
<marker date="1542903637276" expanded="true" signature="372:434" ph="..." />
|
||||
<marker date="1542903637276" expanded="true" signature="618:1401" ph="..." />
|
||||
<marker date="1542903637276" expanded="true" signature="1659:1735" ph="..." />
|
||||
<marker date="1542903637276" expanded="true" signature="1806:1811" ph="..." />
|
||||
<marker date="1542903637276" expanded="true" signature="1806:2287" ph="..." />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
|
@ -150,6 +132,20 @@
|
|||
</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="450">
|
||||
<caret line="30" lean-forward="true" selection-start-line="30" selection-end-line="30" />
|
||||
<folding>
|
||||
<element signature="e#0#10#0" expanded="true" />
|
||||
<marker date="1542678576291" expanded="true" signature="272:446" ph="..." />
|
||||
<marker date="1542678576291" expanded="true" signature="6331:6335" ph="..." />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
</leaf>
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
|
@ -174,6 +170,14 @@
|
|||
<find>png</find>
|
||||
<find>width</find>
|
||||
<find>getCoordinate</find>
|
||||
<find>sdfsd</find>
|
||||
<find>getStartAndEndPointsOfLineInBox</find>
|
||||
<find>makeStitchLines</find>
|
||||
<find>getBoxDiagonalLength</find>
|
||||
<find>readBytes</find>
|
||||
<find>to_svg</find>
|
||||
<find>InfLine</find>
|
||||
<find>svgpathtools</find>
|
||||
</findStrings>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
|
@ -187,12 +191,12 @@
|
|||
<option value="$PROJECT_DIR$/src/svgImport.py" />
|
||||
<option value="$PROJECT_DIR$/src/svg.py" />
|
||||
<option value="$PROJECT_DIR$/src/PES-Emb-mathutils.py" />
|
||||
<option value="$PROJECT_DIR$/src/PES_Emb_mathutils.py" />
|
||||
<option value="$PROJECT_DIR$/src/svgFunctions.py" />
|
||||
<option value="$PROJECT_DIR$/src/utilities.py" />
|
||||
<option value="$PROJECT_DIR$/src/main.py" />
|
||||
<option value="$PROJECT_DIR$/src/PES.py" />
|
||||
<option value="$PROJECT_DIR$/PECRender/main.py" />
|
||||
<option value="$PROJECT_DIR$/src/svgFunctions.py" />
|
||||
<option value="$PROJECT_DIR$/src/PES.py" />
|
||||
<option value="$PROJECT_DIR$/src/PES_Emb_mathutils.py" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
|
@ -267,7 +271,7 @@
|
|||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="RunManager" selected="Python.PECRender-main">
|
||||
<component name="RunManager" selected="Python.main">
|
||||
<configuration name="PECRender-main" type="PythonConfigurationType" factoryName="Python" temporary="true">
|
||||
<module name="PES-Embroidery" />
|
||||
<option name="INTERPRETER_OPTIONS" value="" />
|
||||
|
@ -428,29 +432,21 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/svgFunctions.py">
|
||||
<entry file="file:///usr/local/lib/python2.7/site-packages/pyglet/graphics/vertexdomain.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="255">
|
||||
<caret line="20" column="25" selection-start-line="20" selection-start-column="25" selection-end-line="20" selection-end-column="25" />
|
||||
<folding>
|
||||
<element signature="e#0#19#0" expanded="true" />
|
||||
<marker date="1541813377581" expanded="true" signature="343:344" ph="..." />
|
||||
<marker date="1541813377581" expanded="true" signature="343:348" ph="..." />
|
||||
</folding>
|
||||
<state relative-caret-position="286">
|
||||
<caret line="454" lean-forward="true" selection-start-line="454" selection-end-line="454" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/PES_Emb_mathutils.py">
|
||||
<entry file="file://$PROJECT_DIR$/PECRender/main.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="135">
|
||||
<caret line="10" column="37" selection-start-line="10" selection-start-column="37" selection-end-line="10" selection-end-column="37" />
|
||||
<state relative-caret-position="450">
|
||||
<caret line="30" lean-forward="true" selection-start-line="30" selection-end-line="30" />
|
||||
<folding>
|
||||
<element signature="e#0#29#0" expanded="true" />
|
||||
<marker date="1541561558614" expanded="true" signature="99:671" ph="..." />
|
||||
<marker date="1541561558614" expanded="true" signature="359:425" ph="..." />
|
||||
<marker date="1541561558614" expanded="true" signature="722:798" ph="..." />
|
||||
<marker date="1541561558614" expanded="true" signature="869:874" ph="..." />
|
||||
<marker date="1541561558614" expanded="true" signature="869:1350" ph="..." />
|
||||
<element signature="e#0#10#0" expanded="true" />
|
||||
<marker date="1542678576291" expanded="true" signature="272:446" ph="..." />
|
||||
<marker date="1542678576291" expanded="true" signature="6331:6335" ph="..." />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
|
@ -462,46 +458,56 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/PES.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="263">
|
||||
<caret line="148" column="7" selection-start-line="148" selection-start-column="7" selection-end-line="148" selection-end-column="7" />
|
||||
<folding>
|
||||
<marker date="1542488383227" expanded="true" signature="91:168" ph="..." />
|
||||
<marker date="1542488383227" expanded="true" signature="345:385" ph="..." />
|
||||
<marker date="1542488383227" expanded="true" signature="1480:3114" ph="..." />
|
||||
<marker date="1542488383227" expanded="true" signature="3292:3370" ph="..." />
|
||||
<marker date="1542488383227" expanded="true" signature="3384:3423" ph="..." />
|
||||
<marker date="1542488383227" expanded="true" signature="3464:3469" 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="157">
|
||||
<caret line="15" lean-forward="true" selection-start-line="15" selection-end-line="15" />
|
||||
<state relative-caret-position="375">
|
||||
<caret line="25" column="16" lean-forward="true" selection-start-line="25" selection-start-column="16" selection-end-line="25" selection-end-column="16" />
|
||||
<folding>
|
||||
<element signature="e#0#15#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file:///usr/local/lib/python2.7/site-packages/pyglet/graphics/vertexdomain.py">
|
||||
<entry file="file://$PROJECT_DIR$/src/svgFunctions.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="372">
|
||||
<caret line="454" lean-forward="true" selection-start-line="454" selection-end-line="454" />
|
||||
<state relative-caret-position="90">
|
||||
<caret line="6" column="14" lean-forward="true" selection-start-line="6" selection-start-column="14" selection-end-line="6" selection-end-column="14" />
|
||||
<folding>
|
||||
<element signature="e#0#19#0" expanded="true" />
|
||||
<marker date="1542903295377" expanded="true" signature="343:344" ph="..." />
|
||||
<marker date="1542903295377" expanded="true" signature="343:348" ph="..." />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/PECRender/main.py">
|
||||
<entry file="file://$PROJECT_DIR$/src/PES.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="330">
|
||||
<caret line="22" column="9" lean-forward="true" selection-start-line="22" selection-start-column="9" selection-end-line="22" selection-end-column="9" />
|
||||
<state relative-caret-position="317">
|
||||
<caret line="165" column="12" lean-forward="true" selection-start-line="165" selection-start-column="12" selection-end-line="165" selection-end-column="12" />
|
||||
<folding>
|
||||
<element signature="e#0#10#0" expanded="true" />
|
||||
<marker date="1542565941388" expanded="true" signature="272:446" ph="..." />
|
||||
<marker date="1542565941388" expanded="true" signature="6154:6158" ph="..." />
|
||||
<element signature="e#0#23#0" expanded="true" />
|
||||
<marker date="1542903616715" expanded="true" signature="121:198" ph="..." />
|
||||
<marker date="1542903616715" expanded="true" signature="375:415" ph="..." />
|
||||
<marker date="1542903616715" expanded="true" signature="1510:3144" ph="..." />
|
||||
<marker date="1542903616715" expanded="true" signature="3322:3400" ph="..." />
|
||||
<marker date="1542903616715" expanded="true" signature="3414:3453" ph="..." />
|
||||
<marker date="1542903616715" expanded="true" signature="3652:3657" 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="231">
|
||||
<caret line="34" column="8" selection-start-line="34" selection-start-column="8" selection-end-line="34" selection-end-column="8" />
|
||||
<folding>
|
||||
<element signature="e#0#29#0" expanded="true" />
|
||||
<marker date="1542903637276" expanded="true" signature="112:1608" ph="..." />
|
||||
<marker date="1542903637276" expanded="true" signature="372:434" ph="..." />
|
||||
<marker date="1542903637276" expanded="true" signature="618:1401" ph="..." />
|
||||
<marker date="1542903637276" expanded="true" signature="1659:1735" ph="..." />
|
||||
<marker date="1542903637276" expanded="true" signature="1806:1811" ph="..." />
|
||||
<marker date="1542903637276" expanded="true" signature="1806:2287" ph="..." />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
|
|
|
@ -77,11 +77,6 @@ class Global:
|
|||
print("Width and height of design: {}, {}".format(width, height))
|
||||
print("Starting stitches at location: {}".format(f.tell()))
|
||||
|
||||
# Get the starting point
|
||||
Global.x = -Global.getCoordinate(f)
|
||||
Global.y = Global.getCoordinate(f)
|
||||
|
||||
|
||||
Global.addLine(Global.x, Global.y, width, 0,
|
||||
(Global.testColors[Global.colorIndex])[0],
|
||||
(Global.testColors[Global.colorIndex])[1],
|
||||
|
@ -94,11 +89,23 @@ class Global:
|
|||
(Global.testColors[Global.colorIndex])[0],
|
||||
(Global.testColors[Global.colorIndex])[1],
|
||||
(Global.testColors[Global.colorIndex])[2])
|
||||
Global.addLine(Global.x, Global.y, Global.x + 0, Global.y + -height,
|
||||
Global.addLine(Global.x, Global.y, Global.x + 0, Global.y + -height,
|
||||
(Global.testColors[Global.colorIndex])[0],
|
||||
(Global.testColors[Global.colorIndex])[1],
|
||||
(Global.testColors[Global.colorIndex])[2])
|
||||
|
||||
# Get the starting point
|
||||
while True:
|
||||
Global.x = Global.getCoordinate(f)
|
||||
Global.y = -Global.getCoordinate(f)
|
||||
|
||||
if Global.x != 0 or Global.y != 0:
|
||||
break
|
||||
print("Starting at coordinates: ({}, {})".format(Global.x, Global.y))
|
||||
|
||||
|
||||
|
||||
|
||||
# I'm pretty sure one coordinate can be the long form
|
||||
# and the second one is short or vice versa. I initially
|
||||
# thought they had to come in pairs but that didn't seem
|
||||
|
|
28
src/PES.py
28
src/PES.py
|
@ -1,4 +1,5 @@
|
|||
from struct import pack
|
||||
from svgpathtools import Line
|
||||
|
||||
def encodeU8(num):
|
||||
return pack("<B", num)
|
||||
|
@ -146,17 +147,24 @@ class CSewSeg:
|
|||
None
|
||||
|
||||
class Stitch:
|
||||
TYPE_JUMP = 0
|
||||
TYPE_
|
||||
def __init__(self, start, end):
|
||||
if type(start) != complex:
|
||||
raise Exception("Stitch - start point not a point object.")
|
||||
TYPE_LONG = 0x8000
|
||||
TYPE_JUMP = 0x9000
|
||||
TYPE_TRIM = 0xA000
|
||||
TYPE_COLOR_CHANGE = 0xFEB0
|
||||
|
||||
if type(end) != complex:
|
||||
raise Exception("Stitch - end point not a point object.")
|
||||
# Initialize a new stitch from the previous location
|
||||
# to the new location.
|
||||
def __init__(self, line):
|
||||
assert(line is Line)
|
||||
|
||||
self.start = start
|
||||
self.end = end
|
||||
self.line = line
|
||||
|
||||
self.previous = line.start
|
||||
self.new = line.end
|
||||
|
||||
def encode(self, b):
|
||||
None
|
||||
None
|
||||
|
||||
# Flips the start and end points of a stitch
|
||||
def reverse(self):
|
||||
self.line = Line(start=self.line.end, end=self.line.start)
|
||||
|
|
BIN
src/PES.pyc
BIN
src/PES.pyc
Plik binarny nie jest wyświetlany.
|
@ -1,5 +1,6 @@
|
|||
from svgpathtools import Line
|
||||
import math
|
||||
import numpy
|
||||
|
||||
# Represents your average y = mx + b line
|
||||
class InfLine:
|
||||
|
@ -18,10 +19,32 @@ class InfLine:
|
|||
self.m = 1 / self.m
|
||||
|
||||
def to_svg_Line(self, center, length):
|
||||
h = length / 2.0
|
||||
ext1 = complex( (center.real + h), self.y_for_x(center.real + h) )
|
||||
ext2 = complex( ext1.real - length, ext1.imag - length)
|
||||
return Line(start=ext1, end=ext2)
|
||||
# center = 2.0+0j
|
||||
# length = 2.0*math.pow(8.0, 0.5)
|
||||
# self.m = 1.0
|
||||
# self.b = -2
|
||||
|
||||
dist = length / 2.0
|
||||
# Find the two values of x that are "dist" down each
|
||||
# side of the line.
|
||||
# I did this on paper, and its just a quadratic equation that
|
||||
# needs to be solved. Nothing a little numpy can't fix.
|
||||
xRoots = numpy.roots([ (1 + math.pow(self.m, 2.0) ),
|
||||
((-2 * center.real * math.pow(self.m, 2.0)) - (2*center.real)),
|
||||
(math.pow(center.real, 2.0)*math.pow(self.m, 2.0)) + (math.pow(center.real, 2.0)) - (math.pow(dist, 2.0)) ])
|
||||
|
||||
assert(len(xRoots) == 2)
|
||||
assert(numpy.isreal(xRoots[0]))
|
||||
assert (numpy.isreal(xRoots[1]))
|
||||
|
||||
return Line(start=(xRoots[0], self.y_for_x(xRoots[0])),
|
||||
end=(xRoots[1], self.y_for_x(xRoots[1])))
|
||||
|
||||
|
||||
# h = length / 2.0
|
||||
# ext1 = complex( (center.real + h), self.y_for_x(center.real + h) )
|
||||
# ext2 = complex( ext1.real - length, ext1.imag - length)
|
||||
# return Line(start=ext1, end=ext2)
|
||||
|
||||
def getBoxDiagonalLength(left, right, top, bottom):
|
||||
return math.sqrt( math.pow(left-right, 2) + math.pow(top-bottom, 2) )
|
||||
|
|
Plik binarny nie jest wyświetlany.
|
@ -35,12 +35,29 @@ def makeStitchLines(shape, threadWidth=0.04, slope=1):
|
|||
intersectionPath.invertSlope()
|
||||
p1, p2 = getStartAndEndPointsOfLineInBox(intersectionPath, left, right, top, bottom)
|
||||
intersectionPath = Line(start=p1, end=p2)
|
||||
#print("Start and end points: {}, {}".format(p1,p2))
|
||||
#intersectionPath = intersectionPath.to_svg_Line(center=center, length=intersectionLineLength)
|
||||
|
||||
# Make sure we cover everything based on the thread width.
|
||||
# Line objects can be enumerated from 0 < t < 1
|
||||
# Depending on the Line's length, we need to increment t
|
||||
# by a value such that we move threadWidth each time.
|
||||
intersectionLineInc = (intersectionPath.length() / threadWidth) + 1
|
||||
totalIntersections = int((intersectionPath.length() / threadWidth)) + 1
|
||||
pathLength = intersectionPath.length()
|
||||
tIncrementAmount = pathLength / float(totalIntersections)
|
||||
# Get the max length of the intersection lines we'll need
|
||||
intersectionLineLength = getBoxDiagonalLength(left, right, top, bottom)
|
||||
|
||||
print("Total intersections: {} along path: {}".format(totalIntersections, intersectionPath))
|
||||
print("(From {} to {})".format(intersectionPath.point(0), intersectionPath.point(1.0)))
|
||||
|
||||
for x in range(0, totalIntersections):
|
||||
# Get a new (infinite) line using the point at the current t value
|
||||
# as the center
|
||||
center = intersectionPath.point((tIncrementAmount * x) / pathLength)
|
||||
i = InfLine(m=slope, center=center)
|
||||
# Convert it to a bezier line
|
||||
l = i.to_svg_Line(center=center, length=intersectionLineLength)
|
||||
print((tIncrementAmount * x) / pathLength, l)
|
||||
|
||||
return stitchLines
|
Plik binarny nie jest wyświetlany.
Ładowanie…
Reference in New Issue