1
0
Fork 0

PythagorasTree impementation, not working

New pythagoras Tree implementation, not fully working yet
This commit is contained in:
Jan Christian Grünhage 2015-02-10 17:51:44 +01:00
parent 7d63d2e29a
commit dfd1841e2f
19 changed files with 781 additions and 97 deletions

124
.idea/uiDesigner.xml Normal file
View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

View File

@ -40,18 +40,54 @@
<entry file="file://$PROJECT_DIR$/src/DrawingTools.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="306">
<caret line="8" column="42" selection-start-line="8" selection-start-column="42" selection-end-line="8" selection-end-column="42" />
<caret line="7" column="0" selection-start-line="7" selection-start-column="0" selection-end-line="7" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="PythagorasTree.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/PythagorasTree.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.13016845" vertical-offset="357" max-vertical-offset="1496">
<caret line="26" column="0" selection-start-line="26" selection-start-column="0" selection-end-line="26" selection-end-column="0" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="TurtleState.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/TurtleState.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="374">
<caret line="13" column="35" selection-start-line="13" selection-start-column="35" selection-end-line="13" selection-end-column="35" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="Main.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="805" max-vertical-offset="3536">
<caret line="59" column="124" selection-start-line="59" selection-start-column="124" selection-end-line="59" selection-end-column="124" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="PythagorasTreeQueue.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/PythagorasTreeQueue.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="323">
<caret line="0" column="29" selection-start-line="0" selection-start-column="29" selection-end-line="0" selection-end-column="29" />
<folding />
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="374">
<caret line="12" column="12" selection-start-line="12" selection-start-column="12" selection-end-line="12" selection-end-column="12" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
@ -59,14 +95,13 @@
<file leaf-file-name="PythagorasTriangle.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/PythagorasTriangle.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="15" max-vertical-offset="1445">
<caret line="15" column="40" selection-start-line="15" selection-start-column="40" selection-end-line="15" selection-end-column="40" />
<state vertical-scroll-proportion="0.0" vertical-offset="914" max-vertical-offset="1445">
<caret line="72" column="0" selection-start-line="72" selection-start-column="0" selection-end-line="72" selection-end-column="0" />
<folding>
<element signature="e#1884#1885#0" expanded="true" />
<element signature="e#1921#1922#0" expanded="true" />
<element signature="e#1957#1958#0" expanded="true" />
<element signature="e#1989#1990#0" expanded="true" />
<element signature="e#2031#2032#0" expanded="true" />
<element signature="e#2069#2070#0" expanded="true" />
<element signature="e#2106#2107#0" expanded="true" />
<element signature="e#2139#2140#0" expanded="true" />
@ -75,24 +110,18 @@
</provider>
</entry>
</file>
<file leaf-file-name="PythagorasTree.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/PythagorasTree.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.69878185" vertical-offset="134" max-vertical-offset="1360">
<caret line="45" column="0" selection-start-line="45" selection-start-column="0" selection-end-line="45" selection-end-column="0" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="PythagorasTriangleList.java" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/PythagorasTriangleList.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="493">
<caret line="9" column="70" selection-start-line="9" selection-start-column="70" selection-end-line="9" selection-end-column="70" />
<folding />
<state vertical-scroll-proportion="0.0" vertical-offset="64" max-vertical-offset="595">
<caret line="28" column="0" selection-start-line="28" selection-start-column="0" selection-end-line="28" selection-end-column="0" />
<folding>
<element signature="e#558#559#0" expanded="true" />
<element signature="e#616#617#0" expanded="true" />
<element signature="e#771#772#0" expanded="true" />
<element signature="e#834#835#0" expanded="true" />
<element signature="e#949#950#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
@ -105,11 +134,13 @@
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/src/DrawingTools.java" />
<option value="$PROJECT_DIR$/src/Numbers.java" />
<option value="$PROJECT_DIR$/src/PythagorasTriangle.java" />
<option value="$PROJECT_DIR$/src/PythagorasTriangleList.java" />
<option value="$PROJECT_DIR$/src/Main.java" />
<option value="$PROJECT_DIR$/src/DrawingTools.java" />
<option value="$PROJECT_DIR$/src/PythagorasTreeQueue.java" />
<option value="$PROJECT_DIR$/src/TurtleState.java" />
<option value="$PROJECT_DIR$/src/PythagorasTree.java" />
</list>
</option>
@ -118,10 +149,10 @@
<detection-done>true</detection-done>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="2152" />
<option name="x" value="-8" />
<option name="y" value="-8" />
<option name="width" value="1936" />
<option name="height" value="1040" />
<option name="width" value="1456" />
<option name="height" value="939" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
@ -196,13 +227,16 @@
<property name="aspect.path.notification.shown" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="LayoutCode.rearrangeEntriesJava" value="false" />
<property name="recentsLimit" value="5" />
<property name="restartRequiresConfirmation" value="true" />
<property name="dynamic.classpath" value="false" />
</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="C:\Users\Christian\OneDrive\Schule - Universität - Arbeit - etc\Dev\Fractals\Fractals" />
</key>
</component>
<component name="RunManager">
<component name="RunManager" selected="Application.Standard">
<configuration default="true" type="JUnit" factoryName="JUnit">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
@ -441,7 +475,32 @@
<envs />
<method />
</configuration>
<list size="0" />
<configuration default="false" name="Standard" type="Application" factoryName="Application">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<option name="MAIN_CLASS_NAME" value="Main" />
<option name="VM_PARAMETERS" value="" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" value="" />
<option name="ENABLE_SWING_INSPECTOR" value="false" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<module name="Fractals" />
<envs />
<RunnerSettings RunnerId="Debug">
<option name="DEBUG_PORT" value="" />
<option name="TRANSPORT" value="0" />
<option name="LOCAL" value="true" />
</RunnerSettings>
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Debug" />
<ConfigurationWrapper RunnerId="Run" />
<method />
</configuration>
<list size="1">
<item index="0" class="java.lang.String" itemvalue="Application.Standard" />
</list>
</component>
<component name="ShelveChangesManager" show_recycled="false" />
<component name="SvnConfiguration">
@ -453,72 +512,45 @@
<created>1423576956527</created>
<option name="number" value="Default" />
<updated>1423576956527</updated>
<workItem from="1423576961426" duration="2819000" />
<workItem from="1423576961426" duration="8044000" />
</task>
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="2819000" />
<option name="totallyTimeSpent" value="8044000" />
</component>
<component name="ToolWindowManager">
<frame x="2152" y="-8" width="1936" height="1040" extended-state="6" />
<frame x="-8" y="-8" width="1456" height="939" extended-state="6" />
<editor active="true" />
<layout>
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="12" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="13" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32975295" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="IDEtalk" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Palette&#9;" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="true" content_ui="tabs" />
<window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" />
<window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.16385542" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.1875" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="IDEtalk Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="7" side_tool="false" content_ui="combo" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
</layout>
<layout-to-restore>
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
<window_info id="IDEtalk" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="true" content_ui="tabs" />
<window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="7" side_tool="false" content_ui="combo" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="12" side_tool="false" content_ui="tabs" />
<window_info id="Palette&#9;" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.1875" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="IDEtalk Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="IDEtalk Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="true" content_ui="tabs" />
</layout-to-restore>
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.39957035" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="7" side_tool="false" content_ui="combo" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="12" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="Vcs.Log.UiProperties">
<option name="RECENTLY_FILTERED_USER_GROUPS">
@ -537,18 +569,16 @@
</option>
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
<breakpoint-manager>
<option name="time" value="1" />
</breakpoint-manager>
<watches-manager />
</component>
<component name="antWorkspaceConfiguration">
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/DrawingTools.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="306">
<caret line="8" column="42" selection-start-line="8" selection-start-column="42" selection-end-line="8" selection-end-column="42" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Numbers.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="561">
@ -557,16 +587,47 @@
</state>
</provider>
</entry>
<entry file="jar://$PROJECT_DIR$/aplu5.jar!/ch/aplu/turtle/Pen.class">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-7.08" vertical-offset="316" max-vertical-offset="2363">
<caret line="43" column="16" selection-start-line="43" selection-start-column="16" selection-end-line="43" selection-end-column="16" />
<folding>
<element signature="e#1083#1084#0" expanded="true" />
<element signature="e#1117#1118#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="jar://$PROJECT_DIR$/aplu5.jar!/ch/aplu/turtle/TurtleRenderer.class">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.3320158" vertical-offset="223" max-vertical-offset="2958">
<caret line="37" column="19" selection-start-line="37" selection-start-column="19" selection-end-line="37" selection-end-column="19" />
<folding>
<element signature="e#999#1000#0" expanded="true" />
<element signature="e#1063#1064#0" expanded="true" />
<element signature="e#2411#2412#0" expanded="true" />
<element signature="e#2469#2470#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/DrawingTools.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="306">
<caret line="7" column="0" selection-start-line="7" selection-start-column="0" selection-end-line="7" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/PythagorasTriangle.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="15" max-vertical-offset="1275">
<caret line="15" column="40" selection-start-line="15" selection-start-column="40" selection-end-line="15" selection-end-column="40" />
<state vertical-scroll-proportion="0.0" vertical-offset="914" max-vertical-offset="1445">
<caret line="72" column="0" selection-start-line="72" selection-start-column="0" selection-end-line="72" selection-end-column="0" />
<folding>
<element signature="e#1884#1885#0" expanded="true" />
<element signature="e#1921#1922#0" expanded="true" />
<element signature="e#1957#1958#0" expanded="true" />
<element signature="e#1989#1990#0" expanded="true" />
<element signature="e#2031#2032#0" expanded="true" />
<element signature="e#2069#2070#0" expanded="true" />
<element signature="e#2106#2107#0" expanded="true" />
<element signature="e#2139#2140#0" expanded="true" />
@ -576,24 +637,58 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/PythagorasTriangleList.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="493">
<caret line="9" column="70" selection-start-line="9" selection-start-column="70" selection-end-line="9" selection-end-column="70" />
<folding />
<state vertical-scroll-proportion="0.0" vertical-offset="64" max-vertical-offset="595">
<caret line="28" column="0" selection-start-line="28" selection-start-column="0" selection-end-line="28" selection-end-column="0" />
<folding>
<element signature="e#558#559#0" expanded="true" />
<element signature="e#616#617#0" expanded="true" />
<element signature="e#771#772#0" expanded="true" />
<element signature="e#834#835#0" expanded="true" />
<element signature="e#949#950#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="805" max-vertical-offset="3536">
<caret line="59" column="124" selection-start-line="59" selection-start-column="124" selection-end-line="59" selection-end-column="124" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/PythagorasTreeQueue.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="323">
<caret line="0" column="29" selection-start-line="0" selection-start-column="29" selection-end-line="0" selection-end-column="29" />
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="374">
<caret line="12" column="12" selection-start-line="12" selection-start-column="12" selection-end-line="12" selection-end-column="12" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="jar://$PROJECT_DIR$/aplu5.jar!/ch/aplu/turtle/Turtle.class">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="-3.7777777" vertical-offset="30226" max-vertical-offset="36686">
<caret line="1982" column="30" selection-start-line="1982" selection-start-column="19" selection-end-line="1982" selection-end-column="30" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/TurtleState.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0" vertical-offset="0" max-vertical-offset="374">
<caret line="13" column="35" selection-start-line="13" selection-start-column="35" selection-end-line="13" selection-end-column="35" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/PythagorasTree.java">
<provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.69878185" vertical-offset="134" max-vertical-offset="1360">
<caret line="45" column="0" selection-start-line="45" selection-start-column="0" selection-end-line="45" selection-end-column="0" />
<state vertical-scroll-proportion="0.13016845" vertical-offset="357" max-vertical-offset="1496">
<caret line="26" column="0" selection-start-line="26" selection-start-column="0" selection-end-line="26" selection-end-column="0" />
<folding>
<element signature="imports" expanded="true" />
</folding>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

12
src/DrawingTools.java Normal file
View File

@ -0,0 +1,12 @@
import ch.aplu.turtle.Turtle;
/**
* Created by Christian on 10.02.2015.
*/
public class DrawingTools {
public static void drawSquare(Turtle turtle, double size) {
for (int i = 0; i < 4; i++) {
turtle.forward(size).left(90);
}
}
}

202
src/Main.java Normal file
View File

@ -0,0 +1,202 @@
import ch.aplu.turtle.Options;
import ch.aplu.turtle.Playground;
import ch.aplu.turtle.Turtle;
import java.awt.*;
import java.util.Scanner;
/**
* Created by Christian on 10.02.2015.
*/
public class Main {
public static void main(String[] args) {
playgroundSettings();
while (true) {
if (args.length > 0) newPythagorasTree(args[0]);
else newPythagorasTree(null);
}
}
public static Turtle newTurtle() {
Playground playground = new Playground();
playground.setAntiAliasing(true);
playground.setAutoscrolls(true);
playground.setPreferredSize(new Dimension(2160, 1440));
playground.setMinimumSize(new Dimension(2160, 1440));
playground.add(new Turtle(Color.GREEN));
Turtle turtle = playground.getTurtle(0);
turtle.setFillColor(Color.BLACK).fill();
turtle.setPenColor(Color.GREEN);
turtle.hideTurtle();
turtle.penUp();
turtle.right(180);
turtle.forward(350);
turtle.left(90);
turtle.forward(50);
turtle.left(90);
turtle.penDown();
return turtle;
}
public static void newPythagorasTree(String input) {
PythagorasTree.PythagorasTreeVariant variant;
Scanner scanner = new Scanner(System.in);
if (input != null) variant = variantFromString(input);
else variant = variantInput(scanner);
double size = squareSizeInput(scanner);
int loopSize = loopSizeInput(scanner);
int depth = depthInput(scanner);
double angle = 45;
if (variant == PythagorasTree.PythagorasTreeVariant.AsymetricPythagorasTree) angle = angleInput(scanner);
for (int i = 0; i < loopSize; i++) {
new PythagorasTreeQueue(variant, new PythagorasTriangleList(variant, depth, angle), newTurtle(), size, 0, depth);
}
}
public static PythagorasTree.PythagorasTreeVariant variantFromString(String input) {
PythagorasTree.PythagorasTreeVariant variant;
if (input.equalsIgnoreCase("SymetricPythagorasTree")) {
variant = PythagorasTree.PythagorasTreeVariant.SymetricPythagorasTree;
} else if (input.equalsIgnoreCase("AsymetricPythagorasTree")) {
variant = PythagorasTree.PythagorasTreeVariant.AsymetricPythagorasTree;
} else if (input.equalsIgnoreCase("RegularRandomPythagorasTree")) {
variant = PythagorasTree.PythagorasTreeVariant.RegularRandomPythagorasTree;
} else if (input.equalsIgnoreCase("PisanoPythagorasTreeOne")) {
variant = PythagorasTree.PythagorasTreeVariant.PisanoPythagorasTreeOne;
} else if (input.equalsIgnoreCase("PisanoPythagorasTreeTwo")) {
variant = PythagorasTree.PythagorasTreeVariant.PisanoPythagorasTreeTwo;
} else if (input.equalsIgnoreCase("PisanoPythagorasTreeThree")) {
variant = PythagorasTree.PythagorasTreeVariant.PisanoPythagorasTreeThree;
} else if (input.equalsIgnoreCase("PisanoPythagorasTreeFour")) {
variant = PythagorasTree.PythagorasTreeVariant.PisanoPythagorasTreeFour;
} else if (input.equalsIgnoreCase("PisanoPythagorasTreeFive")) {
variant = PythagorasTree.PythagorasTreeVariant.PisanoPythagorasTreeFive;
} else variant = PythagorasTree.PythagorasTreeVariant.unselected;
return variant;
}
public static void playgroundSettings() {
Scanner scanner = new Scanner(System.in);
Options.setFrameTitle("PythagorasTree");
System.out.println("How wide should the window be?");
int width = Integer.parseInt(scanner.nextLine());
System.out.println("How high should the window be?");
int height = Integer.parseInt(scanner.nextLine());
Options.setPlaygroundSize(width, height);
Options.setFramePosition(0, 0);
}
public static Double squareSizeInput(Scanner scanner) {
System.out.println("Size of First Square:");
return Double.parseDouble(scanner.nextLine());
}
public static Integer loopSizeInput(Scanner scanner) {
System.out.println("Create Loop? Type '1' for no loop and any larger number for a loop of that length:");
return Integer.parseInt(scanner.nextLine());
}
public static Integer depthInput(Scanner scanner) {
System.out.println("How many levels should the tree be deep?");
return Integer.parseInt(scanner.nextLine());
}
public static Double angleInput(Scanner scanner) {
System.out.println("What angle should the triangles of the tree have?");
System.out.println("The angle put into here will be used as the left angle.");
return Double.parseDouble(scanner.nextLine());
}
public static PythagorasTree.PythagorasTreeVariant variantInput(Scanner scanner) {
PythagorasTree.PythagorasTreeVariant variant = PythagorasTree.PythagorasTreeVariant.unselected;
while (variant == PythagorasTree.PythagorasTreeVariant.unselected) {
System.out.println("No variant selected! Type in variant (To get the variants, type in 'help'):");
String variantString = scanner.nextLine();
if (variantString.equals("help")) variantHelp();
variant = variantFromString(variantString);
}
System.out.println(variant);
return variant;
}
public static void variantHelp() {
System.out.println("SymetricPythagorasTree:");
System.out.println("");
System.out.println("This creates a normal symetric Pythagoras Tree.");
System.out.println("");
System.out.println("");
System.out.println("");
System.out.println("AsymetricPythagorasTree:");
System.out.println("");
System.out.println("This creates an asymetric Pythagoras Tree.");
System.out.println("The used angle will be adjustable later.");
System.out.println("");
System.out.println("");
System.out.println("");
System.out.println("RegularRandomPythagorasTree:");
System.out.println("");
System.out.println("This creates an asymetric Pythagoras Tree.");
System.out.println("Each level of the tree will have it's own randomly generated angle.");
System.out.println("The generated angles will be between 20 and 70 degree.");
System.out.println("");
System.out.println("");
System.out.println("");
System.out.println("PisanoPythagorasTreeOne:");
System.out.println("");
System.out.println("This creates an asymetric Pythagoras Tree.");
System.out.println("The angles used in this tree are generated from the Fibonacci Numbers.");
System.out.println("This (and the following variants) are similar to the regular random trees, ");
System.out.println("just with angles generated from the Fibonacci Numbers.");
System.out.println("The angles of this variant calculated like this: ");
System.out.println("Fibonacci number of the Level modulo 4 multiplied by 10 plus 30");
System.out.println("");
System.out.println("");
System.out.println("");
System.out.println("PisanoPythagorasTreeTwo:");
System.out.println("");
System.out.println("The angles of this variant calculated like this: ");
System.out.println("Fibonacci number of the Level modulo 2 multiplied by 30 plus 30");
System.out.println("");
System.out.println("");
System.out.println("");
System.out.println("PisanoPythagorasTreeThree:");
System.out.println("");
System.out.println("The angles of this variant calculated like this: ");
System.out.println("Fibonacci number of the Level modulo 7 multiplied by 5 plus 30");
System.out.println("");
System.out.println("");
System.out.println("");
System.out.println("PisanoPythagorasTreeFour:");
System.out.println("");
System.out.println("The angles of this variant calculated like this: ");
System.out.println("Fibonacci number of the Level modulo 31 plus 30");
System.out.println("");
System.out.println("");
System.out.println("");
System.out.println("PisanoPythagorasTreeFive:");
System.out.println("");
System.out.println("The angles of this variant calculated like this: ");
System.out.println("Fibonacci number of the Level modulo 9 multiplied by 4 plus 29");
System.out.println("");
System.out.println("");
System.out.println("");
}
}

27
src/Numbers.java Normal file
View File

@ -0,0 +1,27 @@
import java.util.LinkedList;
/**
* Created by Christian on 10.02.2015.
*/
public class Numbers {
LinkedList<Long> fibonacci = new LinkedList<Long>();
LinkedList<Double> regularRandom = new LinkedList<Double>();
public Numbers() {
fibonacci.add((long) 1);
fibonacci.add((long) 1);
regularRandom.add(Math.random());
}
public long calcFibonacci(int index) {
if (index < fibonacci.size()) return fibonacci.get(index);
else return calcFibonacci(index - 1) + calcFibonacci(index - 2);
}
public double getRegularRandom(int index){
while (regularRandom.size() <= index) {
regularRandom.add(Math.random());
}
return regularRandom.get(index);
}
}

82
src/PythagorasTree.java Normal file
View File

@ -0,0 +1,82 @@
import ch.aplu.turtle.Turtle;
import java.awt.*;
import java.util.LinkedList;
/**
* Created by Christian on 10.02.2015.
*/
public class PythagorasTree {
private PythagorasTree rightSubTree;
private PythagorasTree leftSubTree;
private PythagorasTreeVariant variant;
private PythagorasTriangleList triangles;
private Turtle turtle;
private double size;
private int momentaryDepth;
private int maximalDepth;
public PythagorasTree(PythagorasTreeVariant variant, PythagorasTriangleList triangles, Turtle turtle, double size, int momentaryDepth, int maximalDepth) {
this.variant = variant;
this.triangles = triangles;
this.turtle = turtle;
this.size = size;
this.momentaryDepth = momentaryDepth;
this.maximalDepth = maximalDepth;
}
public void addPythagorasTree(PythagorasTreeQueue queue) {
if (momentaryDepth + 1 >= maximalDepth) return;
turtle.forward(size);
turtle.pushState();
turtle.right(triangles.getLeftAngle(momentaryDepth));
PythagorasTree treeOne = queue.remove();
treeOne.drawPythagorasTree(queue);
turtle.popState();
turtle.setPenColor(drawColor(momentaryDepth, maximalDepth));
turtle.left(triangles.getRightAngle(momentaryDepth));
turtle.forward(size * triangles.getRightSizeFactor(momentaryDepth));
PythagorasTree treeTwo = queue.remove();
treeTwo.drawPythagorasTree(queue);
treeOne.addPythagorasTree(queue);
treeTwo.addPythagorasTree(queue);
}
public void drawPythagorasTree(PythagorasTreeQueue queue) {
rightSubTree = new PythagorasTree(variant, triangles, turtle, size * triangles.getRightSizeFactor(momentaryDepth), momentaryDepth + 1, maximalDepth);
queue.add(rightSubTree);
leftSubTree = new PythagorasTree(variant, triangles, turtle, size * triangles.getLeftSizeFactor(momentaryDepth), momentaryDepth + 1, maximalDepth);
queue.add(leftSubTree);
DrawingTools.drawSquare(turtle, size);
}
public static Color drawColor(int momentaryDepth, int maximalDepth) {
double colorFactor = 255 / maximalDepth;
int red = (int) (colorFactor * (maximalDepth - momentaryDepth));
if (red > 139) red = 139;
if (red < 0) red = 0;
int green = 255 - (int) (colorFactor * (maximalDepth - momentaryDepth));
if (green < 69) green = 69;
int blue = (int) (colorFactor * ((maximalDepth - momentaryDepth) / 5));
if (blue > 19) blue = 19;
return new Color(red, green, blue);
}
public enum PythagorasTreeVariant {
SymetricPythagorasTree, AsymetricPythagorasTree, RegularRandomPythagorasTree,
PisanoPythagorasTreeOne, PisanoPythagorasTreeTwo, PisanoPythagorasTreeThree, PisanoPythagorasTreeFour, PisanoPythagorasTreeFive,
unselected,
}
}

View File

@ -0,0 +1,16 @@
import ch.aplu.turtle.Turtle;
import java.util.LinkedList;
/**
* Created by Christian on 10.02.2015.
*/
public class PythagorasTreeQueue extends LinkedList<PythagorasTree> {
public PythagorasTreeQueue(PythagorasTree.PythagorasTreeVariant variant, PythagorasTriangleList triangles, Turtle turtle, double size, int momentaryDepth, int maximalDepth) {
super();
add(new PythagorasTree(variant, triangles, turtle, size, momentaryDepth, maximalDepth));
PythagorasTree tree = remove();
tree.drawPythagorasTree(this);
tree.addPythagorasTree(this);
}
}

View File

@ -0,0 +1,79 @@
/**
* Created by Christian on 10.02.2015.
*/
public class PythagorasTriangle {
private double leftSizeFactor;
private double leftAngle;
private double rightSizeFactor;
private double rightAngle;
private PythagorasTree.PythagorasTreeVariant variant;
public PythagorasTriangle(PythagorasTree.PythagorasTreeVariant variant, int momentaryDepth, Numbers numbers, Double angle) {
switch (variant) {
case SymetricPythagorasTree:
leftAngle = 45;
break;
case AsymetricPythagorasTree:
if (angle < 0 || angle > 90) return;
leftAngle = angle;
break;
case RegularRandomPythagorasTree:
leftAngle = numbers.getRegularRandom(momentaryDepth) * 50 + 20;
break;
case PisanoPythagorasTreeOne:
leftAngle = (numbers.calcFibonacci(momentaryDepth) % 4) * 10 + 30;
break;
case PisanoPythagorasTreeTwo:
leftAngle = (numbers.calcFibonacci(momentaryDepth) % 2) * 30 + 30;
break;
case PisanoPythagorasTreeThree:
leftAngle = (numbers.calcFibonacci(momentaryDepth) % 7) * 5 + 30;
break;
case PisanoPythagorasTreeFour:
leftAngle = (numbers.calcFibonacci(momentaryDepth) % 31) + 30;
break;
case PisanoPythagorasTreeFive:
leftAngle = (numbers.calcFibonacci(momentaryDepth) % 9) * 4 + 29;
break;
default:
leftAngle = 45;
break;
}
rightAngle = (double) 90 - leftAngle;
leftSizeFactor = Math.sin(Math.toRadians(leftAngle));
rightSizeFactor = Math.sin(Math.toRadians(rightAngle));
}
public double getLeftSizeFactor() {
return leftSizeFactor;
}
public double getLeftAngle() {
return leftAngle;
}
public double getRightSizeFactor() {
return rightSizeFactor;
}
public double getRightAngle() {
return rightAngle;
}
}

View File

@ -0,0 +1,31 @@
import java.util.LinkedList;
/**
* Created by Christian on 10.02.2015.
*/
public class PythagorasTriangleList {
private LinkedList<PythagorasTriangle> triangles = new LinkedList<PythagorasTriangle>();
private Numbers numbers = new Numbers();
public PythagorasTriangleList(PythagorasTree.PythagorasTreeVariant variant, double maximalDepth, double angle) {
for (int i = 0; i < maximalDepth; i++) {
triangles.add(new PythagorasTriangle(variant, i, numbers, angle));
}
}
public double getLeftAngle(int index) {
return triangles.get(index).getLeftAngle();
}
public double getRightAngle(int index) {
return triangles.get(index).getRightAngle();
}
public double getLeftSizeFactor(int index) {
return triangles.get(index).getLeftSizeFactor();
}
public double getRightSizeFactor(int index) {
return triangles.get(index).getRightSizeFactor();
}
}

16
src/TurtleState.java Normal file
View File

@ -0,0 +1,16 @@
import ch.aplu.turtle.Turtle;
/**
* Created by Christian on 10.02.2015.
*/
public class TurtleState {
private double x;
private double y;
private double heading;
public TurtleState(Turtle turtle) {
x = turtle.getX();
y = turtle.getY();
heading = turtle.heading();
}
}