kopia lustrzana https://github.com/Reenforcements/PES-Embroidery
Added debug flag, output file flag, general updates
rodzic
3126b25985
commit
2ce3225f7a
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PySciProjectComponent">
|
||||
<option name="PY_SCI_VIEW_SUGGESTED" value="true" />
|
||||
</component>
|
||||
</project>
|
|
@ -3,8 +3,9 @@
|
|||
<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$/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/learning/complexPath.svg" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/learning/simplePath.svg" beforeDir="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>
|
||||
|
@ -16,49 +17,52 @@
|
|||
</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="1541559002277" 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$main.coverage" NAME="main Coverage Results" MODIFIED="1542406581596" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/src" />
|
||||
</component>
|
||||
<component name="FUSProjectUsageTrigger">
|
||||
<session id="-1920598427">
|
||||
<usages-collector id="statistics.lifecycle.project">
|
||||
<counts>
|
||||
<entry key="project.closed" value="5" />
|
||||
<entry key="project.open.time.2" value="1" />
|
||||
<entry key="project.opened" value="1" />
|
||||
<entry key="project.open.time.5" value="1" />
|
||||
<entry key="project.open.time.6" value="4" />
|
||||
<entry key="project.opened" value="6" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.vcs.git.usages" />
|
||||
<usages-collector id="statistics.file.types.edit">
|
||||
<counts>
|
||||
<entry key="Python" value="4031" />
|
||||
<entry key="Python" value="6102" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.js.language.service.starts" />
|
||||
<usages-collector id="statistics.file.types.open">
|
||||
<counts>
|
||||
<entry key="Python" value="10" />
|
||||
<entry key="Python" value="11" />
|
||||
<entry key="UML" value="1" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.open">
|
||||
<counts>
|
||||
<entry key="JavaScript-modules-diagram//Users/imaustyn/Documents/MiamiUniversity/ECE 487/Project/PES-Embroidery" value="1" />
|
||||
<entry key="py" value="10" />
|
||||
<entry key="py" value="11" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
<usages-collector id="statistics.file.extensions.edit">
|
||||
<counts>
|
||||
<entry key="py" value="4031" />
|
||||
<entry key="py" value="6102" />
|
||||
</counts>
|
||||
</usages-collector>
|
||||
</session>
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<leaf>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/main.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="300">
|
||||
<caret line="20" column="16" lean-forward="true" selection-start-line="20" selection-start-column="16" selection-end-line="20" selection-end-column="16" />
|
||||
<state relative-caret-position="405">
|
||||
<caret line="27" column="43" lean-forward="true" selection-start-line="27" selection-start-column="43" selection-end-line="27" selection-end-column="43" />
|
||||
<folding>
|
||||
<element signature="e#0#15#0" expanded="true" />
|
||||
</folding>
|
||||
|
@ -66,11 +70,23 @@
|
|||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/utilities.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="165">
|
||||
<caret line="11" lean-forward="true" selection-start-line="11" selection-end-line="11" />
|
||||
<folding>
|
||||
<marker date="1542406580742" expanded="true" signature="66:395" ph="..." />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<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="330">
|
||||
<caret line="22" column="22" lean-forward="true" selection-start-line="22" selection-start-column="22" selection-end-line="22" selection-end-column="22" />
|
||||
<state relative-caret-position="90">
|
||||
<caret line="6" column="55" lean-forward="true" selection-start-line="6" selection-start-column="55" selection-end-line="6" selection-end-column="55" />
|
||||
<folding>
|
||||
<marker date="1541543300298" expanded="true" signature="156:195" ph="..." />
|
||||
<marker date="1541543300298" expanded="true" signature="209:214" ph="..." />
|
||||
|
@ -82,29 +98,29 @@
|
|||
<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="420">
|
||||
<caret line="28" lean-forward="true" selection-start-line="28" selection-end-line="28" />
|
||||
<state relative-caret-position="300">
|
||||
<caret line="20" column="25" lean-forward="true" 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="1541556976665" expanded="true" signature="330:331" ph="..." />
|
||||
<marker date="1541556976665" expanded="true" signature="330:335" ph="..." />
|
||||
<marker date="1541813377581" expanded="true" signature="343:344" ph="..." />
|
||||
<marker date="1541813377581" expanded="true" signature="343:348" ph="..." />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<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="240">
|
||||
<caret line="16" column="26" lean-forward="true" selection-start-line="16" selection-start-column="26" selection-end-line="16" selection-end-column="26" />
|
||||
<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" />
|
||||
<folding>
|
||||
<element signature="e#0#29#0" expanded="true" />
|
||||
<marker date="1541559146180" expanded="true" signature="57:347" ph="..." />
|
||||
<marker date="1541559146180" expanded="true" signature="398:474" ph="..." />
|
||||
<marker date="1541559146180" expanded="true" signature="542:547" ph="..." />
|
||||
<marker date="1541559146180" expanded="true" signature="542:801" ph="..." />
|
||||
<marker date="1541559146180" expanded="true" signature="960:970" ph="..." />
|
||||
<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="..." />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
|
@ -129,11 +145,12 @@
|
|||
<option value="$PROJECT_DIR$/src/learning/svgImport.py" />
|
||||
<option value="$PROJECT_DIR$/src/svgImport.py" />
|
||||
<option value="$PROJECT_DIR$/src/svg.py" />
|
||||
<option value="$PROJECT_DIR$/src/main.py" />
|
||||
<option value="$PROJECT_DIR$/src/PES.py" />
|
||||
<option value="$PROJECT_DIR$/src/PES-Emb-mathutils.py" />
|
||||
<option value="$PROJECT_DIR$/src/svgFunctions.py" />
|
||||
<option value="$PROJECT_DIR$/src/PES_Emb_mathutils.py" />
|
||||
<option value="$PROJECT_DIR$/src/svgFunctions.py" />
|
||||
<option value="$PROJECT_DIR$/src/main.py" />
|
||||
<option value="$PROJECT_DIR$/src/utilities.py" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
|
@ -156,7 +173,6 @@
|
|||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="Scope" />
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<expand>
|
||||
|
@ -169,12 +185,6 @@
|
|||
<item name="PES-Embroidery" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="PES-Embroidery" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="PES-Embroidery" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="src" type="462c0819:PsiDirectoryNode" />
|
||||
<item name="learning" type="462c0819:PsiDirectoryNode" />
|
||||
</path>
|
||||
<path>
|
||||
<item name="PES-Embroidery" type="b2602c69:ProjectViewProjectNode" />
|
||||
<item name="External Libraries" type="cb654da1:ExternalLibrariesNode" />
|
||||
|
@ -183,6 +193,7 @@
|
|||
<select />
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="Scope" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
|
@ -224,7 +235,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 ./learning/simplePath.svg" />
|
||||
<option name="PARAMETERS" value="-i ../Tests/simplePath.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" />
|
||||
|
@ -281,15 +292,9 @@
|
|||
<frame x="0" y="23" width="1680" height="1027" extended-state="0" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info id="Favorites" side_tool="true" />
|
||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.24969475" />
|
||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.26495728" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Docker" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="Database Changes" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="Version Control" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="Python Console" />
|
||||
<window_info anchor="bottom" id="Terminal" />
|
||||
<window_info anchor="bottom" id="Event Log" side_tool="true" />
|
||||
<window_info id="Favorites" order="2" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Find" order="1" />
|
||||
<window_info active="true" anchor="bottom" id="Run" order="2" visible="true" weight="0.32941177" />
|
||||
|
@ -297,11 +302,17 @@
|
|||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
<window_info anchor="bottom" id="TODO" order="6" />
|
||||
<window_info anchor="right" id="SciView" />
|
||||
<window_info anchor="right" id="Database" />
|
||||
<window_info anchor="bottom" id="Docker" order="7" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="Version Control" order="8" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="Database Changes" order="9" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="Event Log" order="10" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Terminal" order="11" />
|
||||
<window_info anchor="bottom" id="Python Console" order="12" />
|
||||
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
|
||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||
<window_info anchor="right" id="SciView" order="3" />
|
||||
<window_info anchor="right" id="Database" order="4" />
|
||||
</layout>
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
|
@ -319,50 +330,38 @@
|
|||
<nodes />
|
||||
<notes />
|
||||
<edges />
|
||||
<settings layout="Hierarchic Group" zoom="1.0" x="614.5" y="286.5" />
|
||||
<settings layout="Hierarchic Group" zoom="1.0" x="615.0" y="287.0" />
|
||||
<SelectedNodes />
|
||||
<Categories>
|
||||
<Category>All</Category>
|
||||
</Categories>
|
||||
<SCOPE>All</SCOPE>
|
||||
<VISIBILITY>Details</VISIBILITY>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/svgImport.py">
|
||||
<entry file="file://$PROJECT_DIR$/src/svgImport.py" />
|
||||
<entry file="file://$PROJECT_DIR$/src/svg.py" />
|
||||
<entry file="file://$PROJECT_DIR$/src/PES-Emb-mathutils.py" />
|
||||
<entry file="file://$PROJECT_DIR$/src/PES_Emb_mathutils.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="165">
|
||||
<caret line="11" column="3" lean-forward="true" selection-start-line="11" selection-start-column="3" selection-end-line="11" selection-end-column="3" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/svg.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="15">
|
||||
<caret line="1" lean-forward="true" selection-start-line="1" selection-end-line="1" />
|
||||
</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="75">
|
||||
<caret line="5" column="8" selection-start-line="5" selection-start-column="8" selection-end-line="5" selection-end-column="8" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/main.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="300">
|
||||
<caret line="20" column="16" lean-forward="true" selection-start-line="20" selection-start-column="16" selection-end-line="20" selection-end-column="16" />
|
||||
<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" />
|
||||
<folding>
|
||||
<element signature="e#0#15#0" expanded="true" />
|
||||
<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="..." />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<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="22" lean-forward="true" selection-start-line="22" selection-start-column="22" selection-end-line="22" selection-end-column="22" />
|
||||
<state relative-caret-position="90">
|
||||
<caret line="6" column="55" lean-forward="true" selection-start-line="6" selection-start-column="55" selection-end-line="6" selection-end-column="55" />
|
||||
<folding>
|
||||
<marker date="1541543300298" expanded="true" signature="156:195" ph="..." />
|
||||
<marker date="1541543300298" expanded="true" signature="209:214" ph="..." />
|
||||
|
@ -372,27 +371,32 @@
|
|||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/svgFunctions.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="420">
|
||||
<caret line="28" lean-forward="true" selection-start-line="28" selection-end-line="28" />
|
||||
<state relative-caret-position="300">
|
||||
<caret line="20" column="25" lean-forward="true" 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="1541556976665" expanded="true" signature="330:331" ph="..." />
|
||||
<marker date="1541556976665" expanded="true" signature="330:335" ph="..." />
|
||||
<marker date="1541813377581" expanded="true" signature="343:344" ph="..." />
|
||||
<marker date="1541813377581" expanded="true" signature="343:348" ph="..." />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/PES_Emb_mathutils.py">
|
||||
<entry file="file://$PROJECT_DIR$/src/utilities.py">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="240">
|
||||
<caret line="16" column="26" lean-forward="true" selection-start-line="16" selection-start-column="26" selection-end-line="16" selection-end-column="26" />
|
||||
<state relative-caret-position="165">
|
||||
<caret line="11" lean-forward="true" selection-start-line="11" selection-end-line="11" />
|
||||
<folding>
|
||||
<element signature="e#0#29#0" expanded="true" />
|
||||
<marker date="1541559146180" expanded="true" signature="57:347" ph="..." />
|
||||
<marker date="1541559146180" expanded="true" signature="398:474" ph="..." />
|
||||
<marker date="1541559146180" expanded="true" signature="542:547" ph="..." />
|
||||
<marker date="1541559146180" expanded="true" signature="542:801" ph="..." />
|
||||
<marker date="1541559146180" expanded="true" signature="960:970" ph="..." />
|
||||
<marker date="1542406580742" expanded="true" signature="66:395" 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="405">
|
||||
<caret line="27" column="43" lean-forward="true" selection-start-line="27" selection-start-column="43" selection-end-line="27" selection-end-column="43" />
|
||||
<folding>
|
||||
<element signature="e#0#15#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
|
|
Przed Szerokość: | Wysokość: | Rozmiar: 1.2 KiB Po Szerokość: | Wysokość: | Rozmiar: 1.2 KiB |
Przed Szerokość: | Wysokość: | Rozmiar: 956 B Po Szerokość: | Wysokość: | Rozmiar: 956 B |
|
@ -1,31 +1,46 @@
|
|||
from svgpathtools import Line
|
||||
import math
|
||||
|
||||
# Represents your average y = mx + b line
|
||||
class InfLine:
|
||||
def __init__(self, m, b):
|
||||
def __init__(self, m, center):
|
||||
self.m = m
|
||||
self.b = b
|
||||
self.b = center.imag - (center.real * m)
|
||||
|
||||
def x_for_y(self, y):
|
||||
return (y - self.b) / m;
|
||||
return (y - self.b) / self.m;
|
||||
|
||||
def y_for_x(self, x):
|
||||
return (self.m * x) + self.b
|
||||
|
||||
def invertSlope(self):
|
||||
if self.m is not 0:
|
||||
self.m = 1 / self.m
|
||||
|
||||
def to_svg_Line(self, center, length):
|
||||
h = length / 2.0
|
||||
ext1 = complex( )
|
||||
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) )
|
||||
|
||||
def getStartAndEndPointsOfLineInBox(m, b, left, right, top, bottom):
|
||||
def getStartAndEndPointsOfLineInBox(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 the top and bottom
|
||||
# or the left and right sides.
|
||||
p1 = complex((top - b) / m, top);
|
||||
p2 = complex(left, m*left + b)
|
||||
# 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))
|
||||
|
||||
p3 = complex(top, infLine.x_for_y(top))
|
||||
p4 = complex(bottom, infLine.x_for_y(bottom))
|
||||
|
||||
if p1.imag <= top and p1.imag >= bottom:
|
||||
return p3, p4
|
||||
else:
|
||||
return p1, p2
|
||||
|
||||
|
||||
|
||||
|
|
Plik binarny nie jest wyświetlany.
12
src/main.py
12
src/main.py
|
@ -1,11 +1,15 @@
|
|||
import argparse
|
||||
import sys
|
||||
from svgFunctions import *
|
||||
import pyembroidery
|
||||
from utilities import *
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser(description="Converts an SVG file into a PES embroidery file.")
|
||||
|
||||
parser.add_argument("-i", dest="inputFile", type=str, action='store', required=True)
|
||||
parser.add_argument("-o", dest="outputFile", type=str, action='store', default="output.PES", required=False)
|
||||
parser.add_argument("-d", dest="debug", action='store_true')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
|
@ -19,3 +23,11 @@ if paths is None or attributes is None:
|
|||
for shape in paths:
|
||||
stitchLines = makeStitchLines(shape)
|
||||
print(shape)
|
||||
|
||||
if args.debug:
|
||||
pes = pyembroidery.read(args.outputFile)
|
||||
if pes is not None:
|
||||
print("Generating debug image.")
|
||||
pyembroidery.write_png(pes, replaceFilenameAndExtensionFromPath(args.inputFile, "debugPicture", "png"))
|
||||
else:
|
||||
print("Couldn't find output file.")
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import svgpathtools
|
||||
from PES_Emb_mathutils import *
|
||||
from PES import Stitch
|
||||
import numpy
|
||||
|
||||
def loadVectorGraphic(filename):
|
||||
svg = None
|
||||
|
@ -20,27 +21,26 @@ def makeStitchLines(shape, threadWidth=0.04, slope=1):
|
|||
height = top - bottom
|
||||
center = complex( (left + right) / 2, (top + bottom) / 2)
|
||||
|
||||
|
||||
# Intersect a line with the given angle over and over
|
||||
# to find where stitches should start/end.
|
||||
# If the shape isn't convex, the line might intersect
|
||||
# more than once but should always intersect an even
|
||||
# number of times (as long as the shape is closed.)
|
||||
|
||||
# Pick the origin based on whether or not the slope is positive
|
||||
if slope > 0:
|
||||
origin = complex(left, top)
|
||||
else:
|
||||
origin = complex(right, top)
|
||||
|
||||
# Place the intersection line at various points along
|
||||
# a straight path that has the opposite slope.
|
||||
if slope is not 0:
|
||||
pSlope = 1 / slope
|
||||
else:
|
||||
pSlope = 0
|
||||
|
||||
# The path should cross through the center of the bounding-
|
||||
# box square.
|
||||
intersectionPath = InfLine(m=slope, center=center)
|
||||
intersectionPath.invertSlope()
|
||||
p1, p2 = getStartAndEndPointsOfLineInBox(intersectionPath, left, right, top, bottom)
|
||||
intersectionPath = Line(start=p1, end=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
|
||||
|
||||
return stitchLines
|
Plik binarny nie jest wyświetlany.
|
@ -0,0 +1,11 @@
|
|||
|
||||
from re import search
|
||||
|
||||
def getFilenameAndExtensionFromPath(path):
|
||||
return search("(\w+)\.(\w{3})", path).groups()
|
||||
|
||||
def replaceFilenameAndExtensionFromPath(path, filename, extension):
|
||||
# Get the path without the filename
|
||||
oldFilename, oldPath = getFilenameAndExtensionFromPath(path)
|
||||
path = path[0:-(len(oldFilename) + len(oldPath) + 1)]
|
||||
return path + filename + "." + extension
|
Plik binarny nie jest wyświetlany.
Ładowanie…
Reference in New Issue