mirror of
				https://github.com/christiaangoossens/Planetary-Orbit-Simulator
				synced 2025-10-31 02:32:48 +00:00 
			
		
		
		
	Fixed bugs with the node calculations
There's a small bug with there possibly being two minima or maxima in one round. The simulator can't handle that currently.
This commit is contained in:
		
							
								
								
									
										293
									
								
								simulator/.idea/workspace.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										293
									
								
								simulator/.idea/workspace.xml
									
									
									
										generated
									
									
									
								
							| @@ -7,12 +7,10 @@ | ||||
|   </component> | ||||
|   <component name="ChangeListManager"> | ||||
|     <list default="true" id="17f368cb-44f8-4101-9a29-49a0f4ff1f92" name="Default" comment="Update workspace"> | ||||
|       <change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/src/com/verictas/pos/simulator/Node.java" /> | ||||
|       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" /> | ||||
|       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/verictas/pos/simulator/Main.java" afterPath="$PROJECT_DIR$/src/com/verictas/pos/simulator/Main.java" /> | ||||
|       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/verictas/pos/simulator/Simulator.java" afterPath="$PROJECT_DIR$/src/com/verictas/pos/simulator/Simulator.java" /> | ||||
|       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/verictas/pos/simulator/SimulatorConfig.java" afterPath="$PROJECT_DIR$/src/com/verictas/pos/simulator/SimulatorConfig.java" /> | ||||
|       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/verictas/pos/simulator/mathUtils/AOP.java" afterPath="$PROJECT_DIR$/src/com/verictas/pos/simulator/mathUtils/AOP.java" /> | ||||
|       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/verictas/pos/simulator/mathUtils/AU.java" afterPath="$PROJECT_DIR$/src/com/verictas/pos/simulator/mathUtils/AU.java" /> | ||||
|       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/verictas/pos/simulator/processor/ObjectProcessor.java" afterPath="$PROJECT_DIR$/src/com/verictas/pos/simulator/processor/ObjectProcessor.java" /> | ||||
|       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/com/verictas/pos/simulator/processor/Processor.java" afterPath="$PROJECT_DIR$/src/com/verictas/pos/simulator/processor/Processor.java" /> | ||||
|     </list> | ||||
| @@ -49,38 +47,98 @@ | ||||
|       <file leaf-file-name="Simulator.java" pinned="false" current-in-tab="false"> | ||||
|         <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/Simulator.java"> | ||||
|           <provider selected="true" editor-type-id="text-editor"> | ||||
|             <state relative-caret-position="-3"> | ||||
|               <caret line="62" column="0" selection-start-line="62" selection-start-column="0" selection-end-line="62" selection-end-column="0" /> | ||||
|             <state relative-caret-position="136"> | ||||
|               <caret line="8" column="24" selection-start-line="8" selection-start-column="24" selection-end-line="8" selection-end-column="24" /> | ||||
|               <folding> | ||||
|                 <element signature="imports" expanded="true" /> | ||||
|                 <element signature="method#run#0;class#Simulator#0" expanded="false" /> | ||||
|                 <element signature="method#accelerate#0;class#Simulator#0" expanded="false" /> | ||||
|               </folding> | ||||
|             </state> | ||||
|           </provider> | ||||
|         </entry> | ||||
|       </file> | ||||
|       <file leaf-file-name="ObjectProcessor.java" pinned="false" current-in-tab="false"> | ||||
|         <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/processor/ObjectProcessor.java"> | ||||
|       <file leaf-file-name="Main.java" pinned="false" current-in-tab="false"> | ||||
|         <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/Main.java"> | ||||
|           <provider selected="true" editor-type-id="text-editor"> | ||||
|             <state relative-caret-position="-479"> | ||||
|               <caret line="9" column="31" selection-start-line="9" selection-start-column="31" selection-end-line="9" selection-end-column="31" /> | ||||
|             <state relative-caret-position="629"> | ||||
|               <caret line="39" column="94" selection-start-line="39" selection-start-column="94" selection-end-line="39" selection-end-column="94" /> | ||||
|               <folding /> | ||||
|             </state> | ||||
|           </provider> | ||||
|         </entry> | ||||
|       </file> | ||||
|       <file leaf-file-name="SimulatorConfig.java" pinned="false" current-in-tab="false"> | ||||
|         <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/SimulatorConfig.java"> | ||||
|           <provider selected="true" editor-type-id="text-editor"> | ||||
|             <state relative-caret-position="119"> | ||||
|               <caret line="7" column="42" selection-start-line="7" selection-start-column="42" selection-end-line="7" selection-end-column="42" /> | ||||
|               <folding /> | ||||
|             </state> | ||||
|           </provider> | ||||
|         </entry> | ||||
|       </file> | ||||
|       <file leaf-file-name="Node.java" pinned="false" current-in-tab="false"> | ||||
|         <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/Node.java"> | ||||
|           <provider selected="true" editor-type-id="text-editor"> | ||||
|             <state relative-caret-position="544"> | ||||
|               <caret line="34" column="27" selection-start-line="34" selection-start-column="27" selection-end-line="34" selection-end-column="27" /> | ||||
|               <folding> | ||||
|                 <element signature="imports" expanded="true" /> | ||||
|                 <element signature="method#processAphelionAndPerihelion#0;class#ObjectProcessor#0" expanded="false" /> | ||||
|                 <element signature="method#calculateTops#0;class#ObjectProcessor#0" expanded="false" /> | ||||
|                 <element signature="method#processNodes#0;class#ObjectProcessor#0" expanded="false" /> | ||||
|                 <element signature="method#processRoundCheck#0;class#ObjectProcessor#0" expanded="false" /> | ||||
|                 <element signature="method#reset#0;class#ObjectProcessor#0" expanded="false" /> | ||||
|                 <element signature="e#287#288#0" expanded="true" /> | ||||
|                 <element signature="e#319#320#0" expanded="true" /> | ||||
|                 <element signature="e#394#395#0" expanded="true" /> | ||||
|                 <element signature="e#439#440#0" expanded="true" /> | ||||
|                 <element signature="method#empty#0;class#Node#0" expanded="false" /> | ||||
|               </folding> | ||||
|             </state> | ||||
|           </provider> | ||||
|         </entry> | ||||
|       </file> | ||||
|       <file leaf-file-name="Processor.java" pinned="false" current-in-tab="true"> | ||||
|       <file leaf-file-name="Object.java" pinned="false" current-in-tab="false"> | ||||
|         <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/Object.java"> | ||||
|           <provider selected="true" editor-type-id="text-editor"> | ||||
|             <state relative-caret-position="1850"> | ||||
|               <caret line="146" column="7" selection-start-line="146" selection-start-column="7" selection-end-line="146" selection-end-column="7" /> | ||||
|               <folding> | ||||
|                 <element signature="imports" expanded="true" /> | ||||
|                 <element signature="method#getSpeed#0;class#Object#0" expanded="false" /> | ||||
|                 <element signature="method#getPosition#0;class#Object#0" expanded="false" /> | ||||
|                 <element signature="method#setAcceleration#1;class#Object#0" expanded="false" /> | ||||
|                 <element signature="method#getAcceleration#0;class#Object#0" expanded="false" /> | ||||
|                 <element signature="method#setOldAcceleration#1;class#Object#0" expanded="false" /> | ||||
|                 <element signature="method#getOldAcceleration#0;class#Object#0" expanded="false" /> | ||||
|                 <element signature="method#toString#0;class#Object#0" expanded="false" /> | ||||
|                 <element signature="method#getForceOnObject#0;class#Object#0" expanded="false" /> | ||||
|                 <element signature="method#getDistance#1;class#Object#0" expanded="false" /> | ||||
|                 <element signature="method#updatePosition#0;class#Object#0" expanded="false" /> | ||||
|                 <element signature="method#updateSpeed#0;class#Object#0" expanded="false" /> | ||||
|                 <element signature="method#enactForceOnObject#0;class#Object#0" expanded="false" /> | ||||
|               </folding> | ||||
|             </state> | ||||
|           </provider> | ||||
|         </entry> | ||||
|       </file> | ||||
|       <file leaf-file-name="ObjectProcessor.java" pinned="false" current-in-tab="true"> | ||||
|         <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/processor/ObjectProcessor.java"> | ||||
|           <provider selected="true" editor-type-id="text-editor"> | ||||
|             <state relative-caret-position="286"> | ||||
|               <caret line="109" column="72" selection-start-line="109" selection-start-column="72" selection-end-line="109" selection-end-column="72" /> | ||||
|               <folding> | ||||
|                 <element signature="imports" expanded="true" /> | ||||
|                 <element signature="e#1132#1133#0" expanded="true" /> | ||||
|                 <element signature="e#1172#1173#0" expanded="true" /> | ||||
|                 <element signature="method#processRoundCheck#0;class#ObjectProcessor#0" expanded="false" /> | ||||
|                 <element signature="method#cleanHistory#0;class#ObjectProcessor#0" expanded="false" /> | ||||
|               </folding> | ||||
|             </state> | ||||
|           </provider> | ||||
|         </entry> | ||||
|       </file> | ||||
|       <file leaf-file-name="Processor.java" pinned="false" current-in-tab="false"> | ||||
|         <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/processor/Processor.java"> | ||||
|           <provider selected="true" editor-type-id="text-editor"> | ||||
|             <state relative-caret-position="425"> | ||||
|               <caret line="102" column="64" selection-start-line="102" selection-start-column="64" selection-end-line="102" selection-end-column="64" /> | ||||
|             <state relative-caret-position="544"> | ||||
|               <caret line="63" column="62" selection-start-line="63" selection-start-column="16" selection-end-line="63" selection-end-column="62" /> | ||||
|               <folding> | ||||
|                 <element signature="imports" expanded="true" /> | ||||
|                 <element signature="method#objectArrayToHashMap#0;class#Processor#0" expanded="false" /> | ||||
| @@ -131,12 +189,13 @@ | ||||
|         <option value="$PROJECT_DIR$/src/com/verictas/pos/simulator/Object.java" /> | ||||
|         <option value="$PROJECT_DIR$/src/com/verictas/pos/simulator/dataWriter/DataWriter.java" /> | ||||
|         <option value="$PROJECT_DIR$/src/com/verictas/pos/simulator/mathUtils/AU.java" /> | ||||
|         <option value="$PROJECT_DIR$/src/com/verictas/pos/simulator/Simulator.java" /> | ||||
|         <option value="$PROJECT_DIR$/src/com/verictas/pos/simulator/processor/ObjectProcessor.java" /> | ||||
|         <option value="$PROJECT_DIR$/src/com/verictas/pos/simulator/SimulatorConfig.java" /> | ||||
|         <option value="$PROJECT_DIR$/src/com/verictas/pos/simulator/Main.java" /> | ||||
|         <option value="$PROJECT_DIR$/src/com/verictas/pos/simulator/mathUtils/AOP.java" /> | ||||
|         <option value="$PROJECT_DIR$/src/com/verictas/pos/simulator/Simulator.java" /> | ||||
|         <option value="$PROJECT_DIR$/src/com/verictas/pos/simulator/processor/Processor.java" /> | ||||
|         <option value="$PROJECT_DIR$/src/com/verictas/pos/simulator/Node.java" /> | ||||
|         <option value="$PROJECT_DIR$/src/com/verictas/pos/simulator/SimulatorConfig.java" /> | ||||
|         <option value="$PROJECT_DIR$/src/com/verictas/pos/simulator/processor/ObjectProcessor.java" /> | ||||
|       </list> | ||||
|     </option> | ||||
|   </component> | ||||
| @@ -187,6 +246,8 @@ | ||||
|       <foldersAlwaysOnTop value="true" /> | ||||
|     </navigator> | ||||
|     <panes> | ||||
|       <pane id="Scope" /> | ||||
|       <pane id="PackagesPane" /> | ||||
|       <pane id="Scratches" /> | ||||
|       <pane id="ProjectPane"> | ||||
|         <subPane> | ||||
| @@ -284,8 +345,6 @@ | ||||
|           </PATH> | ||||
|         </subPane> | ||||
|       </pane> | ||||
|       <pane id="Scope" /> | ||||
|       <pane id="PackagesPane" /> | ||||
|     </panes> | ||||
|   </component> | ||||
|   <component name="PropertiesComponent"> | ||||
| @@ -295,6 +354,7 @@ | ||||
|     <property name="project.structure.last.edited" value="Artifacts" /> | ||||
|     <property name="project.structure.proportion" value="0.15" /> | ||||
|     <property name="project.structure.side.proportion" value="0.2" /> | ||||
|     <property name="SearchEverywhereHistoryKey" value="	FILE	file://D:/Projecten/PWS/simulator/src/com/verictas/pos/simulator/Node.java" /> | ||||
|   </component> | ||||
|   <component name="RecentsManager"> | ||||
|     <key name="MoveFile.RECENT_KEYS"> | ||||
| @@ -593,18 +653,17 @@ | ||||
|     <layout> | ||||
|       <window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> | ||||
|       <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> | ||||
|       <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.2653277" sideWeight="0.49375" order="10" side_tool="false" content_ui="tabs" /> | ||||
|       <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.2653277" sideWeight="0.48541668" order="10" side_tool="false" content_ui="tabs" /> | ||||
|       <window_info id="Palette	" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> | ||||
|       <window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" /> | ||||
|       <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.30866808" sideWeight="0.42083332" order="7" side_tool="true" content_ui="tabs" /> | ||||
|       <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.20084566" sideWeight="0.4328125" order="7" side_tool="true" content_ui="tabs" /> | ||||
|       <window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" 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" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" /> | ||||
|       <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.30866808" sideWeight="0.57916665" 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" show_stripe_button="true" weight="0.20084566" sideWeight="0.5671875" 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" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" /> | ||||
|       <window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" /> | ||||
|       <window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" /> | ||||
|       <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.17864583" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> | ||||
|       <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32980973" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> | ||||
|       <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" 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" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" 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" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> | ||||
| @@ -616,6 +675,7 @@ | ||||
|       <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" /> | ||||
|       <window_info id="Documentation" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="FLOATING" visible="false" show_stripe_button="true" weight="0.48125" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" x="1312" y="663" width="586" height="345" /> | ||||
|       <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" 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" show_stripe_button="true" weight="0.32980973" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> | ||||
|     </layout> | ||||
|   </component> | ||||
|   <component name="Vcs.Log.UiProperties"> | ||||
| @@ -635,7 +695,7 @@ | ||||
|   </component> | ||||
|   <component name="XDebuggerManager"> | ||||
|     <breakpoint-manager> | ||||
|       <option name="time" value="36" /> | ||||
|       <option name="time" value="46" /> | ||||
|     </breakpoint-manager> | ||||
|     <watches-manager /> | ||||
|   </component> | ||||
| @@ -644,13 +704,6 @@ | ||||
|     <option name="FILTER_TARGETS" value="false" /> | ||||
|   </component> | ||||
|   <component name="editorHistoryManager"> | ||||
|     <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/mathUtils/Vector3dMatrix.java"> | ||||
|       <provider selected="true" editor-type-id="text-editor"> | ||||
|         <state relative-caret-position="2442"> | ||||
|           <caret line="116" column="5" selection-start-line="116" selection-start-column="5" selection-end-line="116" selection-end-column="5" /> | ||||
|         </state> | ||||
|       </provider> | ||||
|     </entry> | ||||
|     <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/Main.java"> | ||||
|       <provider selected="true" editor-type-id="text-editor"> | ||||
|         <state relative-caret-position="0"> | ||||
| @@ -664,6 +717,7 @@ | ||||
|           <caret line="4" column="24" selection-start-line="4" selection-start-column="24" selection-end-line="4" selection-end-column="24" /> | ||||
|           <folding> | ||||
|             <element signature="imports" expanded="true" /> | ||||
|             <element signature="method#run#0;class#Simulator#0" expanded="false" /> | ||||
|             <element signature="method#accelerate#0;class#Simulator#0" expanded="false" /> | ||||
|           </folding> | ||||
|         </state> | ||||
| @@ -682,6 +736,7 @@ | ||||
|           <caret line="55" column="39" selection-start-line="55" selection-start-column="39" selection-end-line="55" selection-end-column="39" /> | ||||
|           <folding> | ||||
|             <element signature="imports" expanded="true" /> | ||||
|             <element signature="method#run#0;class#Simulator#0" expanded="false" /> | ||||
|             <element signature="method#accelerate#0;class#Simulator#0" expanded="false" /> | ||||
|           </folding> | ||||
|         </state> | ||||
| @@ -729,6 +784,7 @@ | ||||
|           <caret line="55" column="39" selection-start-line="55" selection-start-column="39" selection-end-line="55" selection-end-column="39" /> | ||||
|           <folding> | ||||
|             <element signature="imports" expanded="true" /> | ||||
|             <element signature="method#run#0;class#Simulator#0" expanded="false" /> | ||||
|             <element signature="method#accelerate#0;class#Simulator#0" expanded="false" /> | ||||
|           </folding> | ||||
|         </state> | ||||
| @@ -776,6 +832,7 @@ | ||||
|           <caret line="55" column="39" selection-start-line="55" selection-start-column="39" selection-end-line="55" selection-end-column="39" /> | ||||
|           <folding> | ||||
|             <element signature="imports" expanded="true" /> | ||||
|             <element signature="method#run#0;class#Simulator#0" expanded="false" /> | ||||
|             <element signature="method#accelerate#0;class#Simulator#0" expanded="false" /> | ||||
|           </folding> | ||||
|         </state> | ||||
| @@ -823,6 +880,7 @@ | ||||
|           <caret line="35" column="30" selection-start-line="35" selection-start-column="30" selection-end-line="35" selection-end-column="30" /> | ||||
|           <folding> | ||||
|             <element signature="imports" expanded="true" /> | ||||
|             <element signature="method#run#0;class#Simulator#0" expanded="false" /> | ||||
|             <element signature="method#accelerate#0;class#Simulator#0" expanded="false" /> | ||||
|           </folding> | ||||
|         </state> | ||||
| @@ -954,17 +1012,94 @@ | ||||
|         </state> | ||||
|       </provider> | ||||
|     </entry> | ||||
|     <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/ObjectStore.java"> | ||||
|     <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/ObjectStore.java" /> | ||||
|     <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/dataWriter/DataWriter.java"> | ||||
|       <provider selected="true" editor-type-id="text-editor"> | ||||
|         <state relative-caret-position="85"> | ||||
|           <caret line="5" column="24" selection-start-line="5" selection-start-column="24" selection-end-line="5" selection-end-column="24" /> | ||||
|         <state relative-caret-position="577"> | ||||
|           <caret line="145" column="35" selection-start-line="145" selection-start-column="35" selection-end-line="145" selection-end-column="35" /> | ||||
|           <folding> | ||||
|             <element signature="method#write#0;class#DataWriter#0" expanded="false" /> | ||||
|             <element signature="method#save#0;class#DataWriter#0" expanded="false" /> | ||||
|           </folding> | ||||
|         </state> | ||||
|       </provider> | ||||
|     </entry> | ||||
|     <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/mathUtils/AU.java"> | ||||
|       <provider selected="true" editor-type-id="text-editor"> | ||||
|         <state relative-caret-position="408"> | ||||
|           <caret line="52" column="41" selection-start-line="52" selection-start-column="25" selection-end-line="52" selection-end-column="41" /> | ||||
|           <folding> | ||||
|             <element signature="e#1368#1369#0" expanded="false" /> | ||||
|             <element signature="e#1412#1413#0" expanded="false" /> | ||||
|           </folding> | ||||
|         </state> | ||||
|       </provider> | ||||
|     </entry> | ||||
|     <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/Simulator.java"> | ||||
|       <provider selected="true" editor-type-id="text-editor"> | ||||
|         <state relative-caret-position="136"> | ||||
|           <caret line="8" column="24" selection-start-line="8" selection-start-column="24" selection-end-line="8" selection-end-column="24" /> | ||||
|           <folding> | ||||
|             <element signature="imports" expanded="true" /> | ||||
|             <element signature="method#run#0;class#Simulator#0" expanded="false" /> | ||||
|             <element signature="method#accelerate#0;class#Simulator#0" expanded="false" /> | ||||
|           </folding> | ||||
|         </state> | ||||
|       </provider> | ||||
|     </entry> | ||||
|     <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/mathUtils/AOP.java"> | ||||
|       <provider selected="true" editor-type-id="text-editor"> | ||||
|         <state relative-caret-position="204"> | ||||
|           <caret line="12" column="52" selection-start-line="12" selection-start-column="52" selection-end-line="12" selection-end-column="52" /> | ||||
|           <folding /> | ||||
|         </state> | ||||
|       </provider> | ||||
|     </entry> | ||||
|     <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/processor/Processor.java"> | ||||
|       <provider selected="true" editor-type-id="text-editor"> | ||||
|         <state relative-caret-position="544"> | ||||
|           <caret line="63" column="62" selection-start-line="63" selection-start-column="16" selection-end-line="63" selection-end-column="62" /> | ||||
|           <folding> | ||||
|             <element signature="imports" expanded="true" /> | ||||
|             <element signature="method#objectArrayToHashMap#0;class#Processor#0" expanded="false" /> | ||||
|             <element signature="method#close#0;class#Processor#0" expanded="false" /> | ||||
|           </folding> | ||||
|         </state> | ||||
|       </provider> | ||||
|     </entry> | ||||
|     <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/Main.java"> | ||||
|       <provider selected="true" editor-type-id="text-editor"> | ||||
|         <state relative-caret-position="629"> | ||||
|           <caret line="39" column="94" selection-start-line="39" selection-start-column="94" selection-end-line="39" selection-end-column="94" /> | ||||
|           <folding /> | ||||
|         </state> | ||||
|       </provider> | ||||
|     </entry> | ||||
|     <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/SimulatorConfig.java"> | ||||
|       <provider selected="true" editor-type-id="text-editor"> | ||||
|         <state relative-caret-position="119"> | ||||
|           <caret line="7" column="42" selection-start-line="7" selection-start-column="42" selection-end-line="7" selection-end-column="42" /> | ||||
|           <folding /> | ||||
|         </state> | ||||
|       </provider> | ||||
|     </entry> | ||||
|     <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/Node.java"> | ||||
|       <provider selected="true" editor-type-id="text-editor"> | ||||
|         <state relative-caret-position="544"> | ||||
|           <caret line="34" column="27" selection-start-line="34" selection-start-column="27" selection-end-line="34" selection-end-column="27" /> | ||||
|           <folding> | ||||
|             <element signature="e#287#288#0" expanded="true" /> | ||||
|             <element signature="e#319#320#0" expanded="true" /> | ||||
|             <element signature="e#394#395#0" expanded="true" /> | ||||
|             <element signature="e#439#440#0" expanded="true" /> | ||||
|             <element signature="method#empty#0;class#Node#0" expanded="false" /> | ||||
|           </folding> | ||||
|         </state> | ||||
|       </provider> | ||||
|     </entry> | ||||
|     <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/Object.java"> | ||||
|       <provider selected="true" editor-type-id="text-editor"> | ||||
|         <state relative-caret-position="164"> | ||||
|         <state relative-caret-position="1850"> | ||||
|           <caret line="146" column="7" selection-start-line="146" selection-start-column="7" selection-end-line="146" selection-end-column="7" /> | ||||
|           <folding> | ||||
|             <element signature="imports" expanded="true" /> | ||||
| @@ -984,86 +1119,16 @@ | ||||
|         </state> | ||||
|       </provider> | ||||
|     </entry> | ||||
|     <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/dataWriter/DataWriter.java"> | ||||
|       <provider selected="true" editor-type-id="text-editor"> | ||||
|         <state relative-caret-position="577"> | ||||
|           <caret line="145" column="35" selection-start-line="145" selection-start-column="35" selection-end-line="145" selection-end-column="35" /> | ||||
|           <folding> | ||||
|             <element signature="method#write#0;class#DataWriter#0" expanded="false" /> | ||||
|             <element signature="method#save#0;class#DataWriter#0" expanded="false" /> | ||||
|           </folding> | ||||
|         </state> | ||||
|       </provider> | ||||
|     </entry> | ||||
|     <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/mathUtils/AU.java"> | ||||
|       <provider selected="true" editor-type-id="text-editor"> | ||||
|         <state relative-caret-position="408"> | ||||
|           <caret line="52" column="41" selection-start-line="52" selection-start-column="25" selection-end-line="52" selection-end-column="41" /> | ||||
|           <folding> | ||||
|             <element signature="e#1368#1369#0" expanded="true" /> | ||||
|             <element signature="e#1412#1413#0" expanded="true" /> | ||||
|           </folding> | ||||
|         </state> | ||||
|       </provider> | ||||
|     </entry> | ||||
|     <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/Main.java"> | ||||
|       <provider selected="true" editor-type-id="text-editor"> | ||||
|         <state relative-caret-position="272"> | ||||
|           <caret line="39" column="94" selection-start-line="39" selection-start-column="94" selection-end-line="39" selection-end-column="94" /> | ||||
|           <folding /> | ||||
|         </state> | ||||
|       </provider> | ||||
|     </entry> | ||||
|     <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/SimulatorConfig.java"> | ||||
|       <provider selected="true" editor-type-id="text-editor"> | ||||
|         <state relative-caret-position="102"> | ||||
|           <caret line="6" column="0" selection-start-line="6" selection-start-column="0" selection-end-line="6" selection-end-column="0" /> | ||||
|           <folding /> | ||||
|         </state> | ||||
|       </provider> | ||||
|     </entry> | ||||
|     <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/mathUtils/AOP.java"> | ||||
|       <provider selected="true" editor-type-id="text-editor"> | ||||
|         <state relative-caret-position="204"> | ||||
|           <caret line="12" column="52" selection-start-line="12" selection-start-column="52" selection-end-line="12" selection-end-column="52" /> | ||||
|           <folding /> | ||||
|         </state> | ||||
|       </provider> | ||||
|     </entry> | ||||
|     <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/processor/ObjectProcessor.java"> | ||||
|       <provider selected="true" editor-type-id="text-editor"> | ||||
|         <state relative-caret-position="-479"> | ||||
|           <caret line="9" column="31" selection-start-line="9" selection-start-column="31" selection-end-line="9" selection-end-column="31" /> | ||||
|         <state relative-caret-position="286"> | ||||
|           <caret line="109" column="72" selection-start-line="109" selection-start-column="72" selection-end-line="109" selection-end-column="72" /> | ||||
|           <folding> | ||||
|             <element signature="imports" expanded="true" /> | ||||
|             <element signature="method#processAphelionAndPerihelion#0;class#ObjectProcessor#0" expanded="false" /> | ||||
|             <element signature="method#calculateTops#0;class#ObjectProcessor#0" expanded="false" /> | ||||
|             <element signature="method#processNodes#0;class#ObjectProcessor#0" expanded="false" /> | ||||
|             <element signature="e#1132#1133#0" expanded="true" /> | ||||
|             <element signature="e#1172#1173#0" expanded="true" /> | ||||
|             <element signature="method#processRoundCheck#0;class#ObjectProcessor#0" expanded="false" /> | ||||
|             <element signature="method#reset#0;class#ObjectProcessor#0" expanded="false" /> | ||||
|           </folding> | ||||
|         </state> | ||||
|       </provider> | ||||
|     </entry> | ||||
|     <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/Simulator.java"> | ||||
|       <provider selected="true" editor-type-id="text-editor"> | ||||
|         <state relative-caret-position="-3"> | ||||
|           <caret line="62" column="0" selection-start-line="62" selection-start-column="0" selection-end-line="62" selection-end-column="0" /> | ||||
|           <folding> | ||||
|             <element signature="imports" expanded="true" /> | ||||
|             <element signature="method#accelerate#0;class#Simulator#0" expanded="false" /> | ||||
|           </folding> | ||||
|         </state> | ||||
|       </provider> | ||||
|     </entry> | ||||
|     <entry file="file://$PROJECT_DIR$/src/com/verictas/pos/simulator/processor/Processor.java"> | ||||
|       <provider selected="true" editor-type-id="text-editor"> | ||||
|         <state relative-caret-position="425"> | ||||
|           <caret line="102" column="64" selection-start-line="102" selection-start-column="64" selection-end-line="102" selection-end-column="64" /> | ||||
|           <folding> | ||||
|             <element signature="imports" expanded="true" /> | ||||
|             <element signature="method#objectArrayToHashMap#0;class#Processor#0" expanded="false" /> | ||||
|             <element signature="method#close#0;class#Processor#0" expanded="false" /> | ||||
|             <element signature="method#cleanHistory#0;class#ObjectProcessor#0" expanded="false" /> | ||||
|           </folding> | ||||
|         </state> | ||||
|       </provider> | ||||
|   | ||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										41
									
								
								simulator/src/com/verictas/pos/simulator/Node.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								simulator/src/com/verictas/pos/simulator/Node.java
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,41 @@ | ||||
| package com.verictas.pos.simulator; | ||||
|  | ||||
| import javax.vecmath.Vector3d; | ||||
|  | ||||
| /** | ||||
|  * Storage object for storing nodes on the graph | ||||
|  */ | ||||
| public class Node extends Vector3d { | ||||
|     public int round; | ||||
|  | ||||
|     /** | ||||
|      * Constructor for casting | ||||
|      * @param vector | ||||
|      */ | ||||
|     public Node(Vector3d vector) { | ||||
|         this.set(vector); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Constructor for empty creation | ||||
|      */ | ||||
|     public Node() { | ||||
|         this.set(new Vector3d(0,0,0)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Sets the stored round associated with this node | ||||
|      * (It will most likely be the round when this node is reached) | ||||
|      * @param round | ||||
|      */ | ||||
|     public void setRound(int round) { | ||||
|         this.round = round; | ||||
|     } | ||||
|  | ||||
|     public boolean empty() { | ||||
|         if (this.getX() == 0 && this.getY() == 0 && this.getZ() == 0) { | ||||
|             return true; | ||||
|         } | ||||
|         return false; | ||||
|     } | ||||
| } | ||||
| @@ -7,6 +7,12 @@ import com.verictas.pos.simulator.processor.ProcessingException; | ||||
| import com.verictas.pos.simulator.processor.Processor; | ||||
|  | ||||
| public class Simulator { | ||||
|     public static int round = 0; // Stores an global integer value with the current round (as a timestamp) | ||||
|  | ||||
|     /** | ||||
|      * Run method for the Simulator | ||||
|      * @param objects | ||||
|      */ | ||||
|     public static void run(Object[] objects) { | ||||
|  | ||||
|         /** | ||||
| @@ -44,11 +50,13 @@ public class Simulator { | ||||
|              * Start the rounds loop | ||||
|              */ | ||||
|             for(int t = 0; t != rounds; t++) { | ||||
|                 // Set round | ||||
|                 Simulator.round++; | ||||
|  | ||||
|                 /** | ||||
|                  * The round has started | ||||
|                  */ | ||||
|                 //System.out.println("\nRound " + (t + 1) + " started!"); | ||||
|                 System.out.println("Round " + (t + 1) + " started!"); | ||||
|                 System.out.println("Round " + (Simulator.round + 1) + " started!"); | ||||
|  | ||||
|                 for(int i = 0; i < objects.length; i++) { | ||||
|                     objects[i].updatePosition(time); | ||||
| @@ -64,7 +72,7 @@ public class Simulator { | ||||
|                 /** | ||||
|                  * Do the processing on the objects | ||||
|                  */ | ||||
|                 processor.process(objects, t + 1); | ||||
|                 processor.process(objects); | ||||
|  | ||||
|                 /** | ||||
|                  * The round has ended | ||||
| @@ -83,13 +91,20 @@ public class Simulator { | ||||
|             long stopTime = System.currentTimeMillis(); | ||||
|             System.out.println("Simulation took: " + (stopTime - startTime) + "ms"); | ||||
|         } catch(ProcessingException e) { | ||||
|             System.out.println("\nERROR:: Processing failed."); | ||||
|             e.printStackTrace(); | ||||
|         } catch(WritingException e) { | ||||
|             System.out.println("\nERROR:: Writing to file failed."); | ||||
|             e.printStackTrace(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public static void accelerate(Object[] objects, Vector3dMatrix matrix) { | ||||
|     /** | ||||
|      * Accelerates the given objects, puts the results in the given matrix and enacts forces | ||||
|      * @param objects | ||||
|      * @param matrix | ||||
|      */ | ||||
|     private static void accelerate(Object[] objects, Vector3dMatrix matrix) { | ||||
|         // Loop | ||||
|         for(int i = 0; i < objects.length; i++) { | ||||
|             /** | ||||
| @@ -109,27 +124,20 @@ public class Simulator { | ||||
|  | ||||
|                 Vector3d force = objects[i].getForceOnObject(objects[o]); | ||||
|                 matrix.setPosition(force, i, o); | ||||
|                 //System.out.println("Force " + (i + 1) + " on " + (o + 1) + " - " + force); | ||||
|  | ||||
|                 /** | ||||
|                  * Also put in the opposite force | ||||
|                  */ | ||||
|                 force.scale(-1); | ||||
|                 matrix.setPosition(force, o, i); | ||||
|                 //System.out.println("Force " + (o + 1) + " on " + (i + 1) + " - " + force); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|  | ||||
|         //System.out.println("\n"); | ||||
|         //System.out.println(matrix); | ||||
|  | ||||
|         for(int i = 0; i < objects.length; i++) { | ||||
|             /** | ||||
|              * Progress forces on the object | ||||
|              */ | ||||
|             Vector3d forceOnI = matrix.getColumnTotal(i); | ||||
|             //System.out.println("All forces on " + (i + 1) + " - " + forceOnI); | ||||
|             objects[i].enactForceOnObject(forceOnI); | ||||
|         } | ||||
|     } | ||||
|   | ||||
| @@ -5,7 +5,7 @@ public class SimulatorConfig { | ||||
|      * Time settings | ||||
|      */ | ||||
|  | ||||
|     public static int rounds = 526100 * 10; // Amount of rounds to run the simulator for | ||||
|     public static int rounds = 526100 * 35; // Amount of rounds to run the simulator for | ||||
|     public static double time = 60; // Time steps in seconds | ||||
|  | ||||
|     /** | ||||
|   | ||||
| @@ -1,13 +1,18 @@ | ||||
| package com.verictas.pos.simulator.processor; | ||||
|  | ||||
| import com.verictas.pos.simulator.Node; | ||||
| import com.verictas.pos.simulator.Object; | ||||
| import com.verictas.pos.simulator.Simulator; | ||||
| import com.verictas.pos.simulator.SimulatorConfig; | ||||
|  | ||||
| import javax.vecmath.Vector3d; | ||||
| import java.util.HashMap; | ||||
| import java.util.Iterator; | ||||
| import java.util.Map; | ||||
|  | ||||
| public class ObjectProcessor { | ||||
|     public Vector3d aphelion; | ||||
|     public Vector3d perihelion; | ||||
|     public Node aphelion; | ||||
|     public Node perihelion; | ||||
|     public double aphelionDistance = -1; | ||||
|     public double perihelionDistance = -1; | ||||
|  | ||||
| @@ -18,11 +23,14 @@ public class ObjectProcessor { | ||||
|     public double lastStartDistance = -1; | ||||
|     public double beforeLastStartDistance = -1; | ||||
|  | ||||
|     public Vector3d ascendingNode; | ||||
|     public Vector3d descendingNode; | ||||
|     public Node ascendingNode; | ||||
|     public Node descendingNode; | ||||
|  | ||||
|     public Vector3d absoluteMax; | ||||
|     public Vector3d absoluteMin; | ||||
|     public Node absoluteMax; | ||||
|     public Node absoluteMin; | ||||
|  | ||||
|     public Node carryOverNode; | ||||
|     public int carryOverBit; | ||||
|  | ||||
|     public double referenceZ; | ||||
|  | ||||
| @@ -44,8 +52,8 @@ public class ObjectProcessor { | ||||
|      * Keep an history of the object position and speed (for logging and further processing) | ||||
|      */ | ||||
|  | ||||
|     public void processHistory(int round) { | ||||
|         this.history.put(round, new Vector3d[] {this.thisObject.position, this.thisObject.speed}); | ||||
|     public void processHistory() { | ||||
|         this.history.put(Simulator.round, new Vector3d[] {this.thisObject.position, this.thisObject.speed}); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
| @@ -71,12 +79,14 @@ public class ObjectProcessor { | ||||
|          */ | ||||
|  | ||||
|         if (sunDistance > aphelionDistance) { | ||||
|             this.aphelion = this.thisObject.position; | ||||
|             this.aphelion = new Node(this.thisObject.position); | ||||
|             this.aphelion.setRound(Simulator.round); | ||||
|             this.aphelionDistance = sunDistance; | ||||
|         } | ||||
|  | ||||
|         if (sunDistance < perihelionDistance) { | ||||
|             this.perihelion = this.thisObject.position; | ||||
|             this.perihelion = new Node(this.thisObject.position); | ||||
|             this.perihelion.setRound(Simulator.round); | ||||
|             this.perihelionDistance = sunDistance; | ||||
|         } | ||||
|     } | ||||
| @@ -87,20 +97,36 @@ public class ObjectProcessor { | ||||
|      */ | ||||
|  | ||||
|     public void calculateTops() { | ||||
|         if (this.absoluteMax == null) { | ||||
|             this.absoluteMax = this.thisObject.position; | ||||
|         if (this.absoluteMax == null || this.absoluteMax.empty()) { | ||||
|             this.absoluteMax = new Node(this.thisObject.position); | ||||
|             this.absoluteMax.setRound(Simulator.round); | ||||
|         } | ||||
|  | ||||
|         if (this.absoluteMin == null) { | ||||
|             this.absoluteMin = this.thisObject.position; | ||||
|         if (this.absoluteMin == null || this.absoluteMin.empty()) { | ||||
|             this.absoluteMin = new Node(this.thisObject.position); | ||||
|             this.absoluteMin.setRound(Simulator.round); | ||||
|         } | ||||
|  | ||||
|         if (this.thisObject.position.getZ() > this.absoluteMax.getZ()) { | ||||
|             this.absoluteMax = this.thisObject.position; | ||||
|             /** | ||||
|              * If the next maximum is more than 50 timesteps removed from the last, we've a problem | ||||
|              */ | ||||
|             if (Simulator.round > this.absoluteMax.round + (SimulatorConfig.time * 500)) { | ||||
|                 System.out.println("ERROR: I already have a maximum (" + this.absoluteMax + "), but a new one (" + this.thisObject.position + ") has presented itself."); | ||||
|             } | ||||
|             this.absoluteMax = new Node(this.thisObject.position); | ||||
|             this.absoluteMax.setRound(Simulator.round); | ||||
|         } | ||||
|  | ||||
|         if (this.thisObject.position.getZ() < this.absoluteMin.getZ()) { | ||||
|             this.absoluteMin = this.thisObject.position; | ||||
|             /** | ||||
|              * If the next minimum is more than 50 timesteps removed from the last, we've a problem | ||||
|              */ | ||||
|             if (Simulator.round > this.absoluteMin.round + (SimulatorConfig.time * 500)) { | ||||
|                 System.out.println("ERROR: I already have a minimum (" + this.absoluteMin + "), but a new one (" + this.thisObject.position + ") has presented itself."); | ||||
|             } | ||||
|             this.absoluteMin = new Node(this.thisObject.position); | ||||
|             this.absoluteMin.setRound(Simulator.round); | ||||
|         } | ||||
|     } | ||||
|     /** | ||||
| @@ -108,39 +134,112 @@ public class ObjectProcessor { | ||||
|      */ | ||||
|  | ||||
|     public void processNodes() { | ||||
|         this.referenceZ = (this.absoluteMin.getZ() + this.absoluteMax.getZ()) / 2; | ||||
|         /** | ||||
|          * Determine how the starting positions are | ||||
|          */ | ||||
|  | ||||
|         /** | ||||
|          * Carry out carry over checking | ||||
|          */ | ||||
|  | ||||
|         if (this.carryOverNode != null) { | ||||
|             // There is a node present in memory from last round. We should check what the carryOverBit is, to see if it's a maximum or a minimum | ||||
|             if (this.carryOverBit == 1) { | ||||
|                 // Last rounds node is a maximum, we're searching for a descending node | ||||
|                 Node result = this.findNode(this.absoluteMin, this.carryOverNode); | ||||
|  | ||||
|                 if (!result.empty()) { | ||||
|                     System.out.println("INFO:: Found descending node in round " + result.round + "\n"); | ||||
|                     this.descendingNode = result; | ||||
|                 } | ||||
|             } else { | ||||
|                 // Last rounds node is a minimum, we're searching for an ascending node | ||||
|                 Node result = this.findNode(this.carryOverNode, this.absoluteMax); | ||||
|  | ||||
|                 if (!result.empty()) { | ||||
|                     System.out.println("INFO:: Found ascending node in round " + result.round + "\n"); | ||||
|                     this.ascendingNode = result; | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             // Cleaning up | ||||
|             this.carryOverNode = null; | ||||
|             this.carryOverBit = -1; | ||||
|         } | ||||
|  | ||||
|         /** | ||||
|          * Carry out the normal checking | ||||
|          */ | ||||
|  | ||||
|         double minRound = this.absoluteMin.round; | ||||
|         double maxRound = this.absoluteMax.round; | ||||
|  | ||||
|         if (minRound < maxRound) { | ||||
|             // The minimum came before the maximum node, we're expecting to find the ascending node between the two | ||||
|             // The maximum node should remain in memory to find the descending node next round | ||||
|  | ||||
|             Node result = this.findNode(this.absoluteMin, this.absoluteMax); | ||||
|  | ||||
|             if (!result.empty()) { | ||||
|                 System.out.println("INFO:: Found ascending node in round " + result.round + "\n"); | ||||
|                 this.ascendingNode = result; | ||||
|             } | ||||
|  | ||||
|             this.carryOverNode = this.absoluteMax; | ||||
|             this.carryOverBit = 1; | ||||
|             this.cleanHistory(this.absoluteMax.round); | ||||
|         } else { | ||||
|             // The maximum came before the minimum node, we're expecting to find the descending node between the two | ||||
|             // The minimum node should remain in memory to find the ascending node next round | ||||
|  | ||||
|             Node result = this.findNode(this.absoluteMin, this.absoluteMax); | ||||
|  | ||||
|             if (!result.empty()) { | ||||
|                 System.out.println("INFO:: Found descending node in round " + result.round + "\n"); | ||||
|                 this.descendingNode = result; | ||||
|             } | ||||
|  | ||||
|             this.carryOverNode = this.absoluteMin; | ||||
|             this.carryOverBit = 0; | ||||
|             this.cleanHistory(this.absoluteMin.round); | ||||
|         } | ||||
|  | ||||
|     } | ||||
|  | ||||
|     private Node findNode(Node min, Node max) { | ||||
|         this.referenceZ = (min.getZ() + max.getZ()) / 2; | ||||
|         System.out.println("INFO:: Called node finder with min: " + min + " (round " + min.round + ") and max: " + max + " (round " + max.round + ") and a reference height of " + referenceZ); | ||||
|         Node returnNode = new Node(); | ||||
|  | ||||
|         // Loop through the entire history | ||||
|         for (Map.Entry<Integer, Vector3d[]> entry : this.history.entrySet()) { | ||||
|             Integer round = entry.getKey(); | ||||
|             Vector3d[] vectorArray = entry.getValue(); | ||||
|  | ||||
|             if (this.history.get(round + 1) != null) { | ||||
|                 // There is a next key! | ||||
|             boolean roundCheck; | ||||
|  | ||||
|             if (min.round < max.round) { | ||||
|                 roundCheck = min.round < round && round < max.round; | ||||
|             } else { | ||||
|                 roundCheck = max.round < round && round < min.round; | ||||
|             } | ||||
|  | ||||
|             if ((this.history.get(round + 1) != null) && roundCheck) { | ||||
|                 // There is a next key and this key is within logical bounds | ||||
|  | ||||
|                 if (vectorArray[0].getZ() < referenceZ && this.history.get(round + 1)[0].getZ() > referenceZ) { | ||||
|                     // This point is below the reference height and the next is above. This point is the ascending node (with positive z) | ||||
|                     if (referenceZ <= 0) { | ||||
|                         // Descending | ||||
|                         this.descendingNode = vectorArray[0]; | ||||
|                         System.out.println("INFO:: Found a descending node at round " + round + " at position: " + vectorArray[0]); | ||||
|                     } else { | ||||
|                         // Ascending | ||||
|                         this.ascendingNode = vectorArray[0]; | ||||
|                         System.out.println("INFO:: Found a ascending node at round " + round + " at position: " + vectorArray[0]); | ||||
|                     } | ||||
|                     returnNode = new Node(vectorArray[0]); | ||||
|                     returnNode.setRound(round); | ||||
|                 } else if (vectorArray[0].getZ() > referenceZ && this.history.get(round + 1)[0].getZ() < referenceZ) { | ||||
|                     // This point is above the reference height and the next is below. This point is the descending node (with positive z) | ||||
|                     if (referenceZ <= 0) { | ||||
|                         // Ascending | ||||
|                         this.ascendingNode = vectorArray[0]; | ||||
|                         System.out.println("INFO:: Found a ascending node at round " + round + " at position: " + vectorArray[0]); | ||||
|                     returnNode = new Node(vectorArray[0]); | ||||
|                     returnNode.setRound(round); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         if (!returnNode.empty()) { | ||||
|             return returnNode; | ||||
|         } else { | ||||
|                         // Descending | ||||
|                         this.descendingNode = vectorArray[0]; | ||||
|                         System.out.println("INFO:: Found a descending node at round " + round + " at position: " + vectorArray[0]); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|             return new Node(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| @@ -194,13 +293,25 @@ public class ObjectProcessor { | ||||
|         perihelionDistance = -1; | ||||
|         lastStartDistance = -1; | ||||
|         beforeLastStartDistance = -1; | ||||
|         aphelion = null; | ||||
|         perihelion = null; | ||||
|         ascendingNode = null; | ||||
|         descendingNode = null; | ||||
|         history = new HashMap<>(); | ||||
|         absoluteMax = null; | ||||
|         absoluteMin = null; | ||||
|         aphelion = new Node(); | ||||
|         perihelion = new Node(); | ||||
|         ascendingNode = new Node(); | ||||
|         descendingNode = new Node(); | ||||
|         absoluteMax = new Node(); | ||||
|         absoluteMin = new Node(); | ||||
|         referenceZ = -1; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Clears all entries from history before the given key | ||||
|      * @param key | ||||
|      */ | ||||
|     public void cleanHistory(int key) { | ||||
|         for(Iterator<Map.Entry<Integer, Vector3d[]>> it = this.history.entrySet().iterator(); it.hasNext(); ) { | ||||
|             Map.Entry<Integer, Vector3d[]> entry = it.next(); | ||||
|             if(entry.getKey() < key) { | ||||
|                 it.remove(); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,6 +1,7 @@ | ||||
| package com.verictas.pos.simulator.processor; | ||||
|  | ||||
| import com.verictas.pos.simulator.Object; | ||||
| import com.verictas.pos.simulator.Simulator; | ||||
| import com.verictas.pos.simulator.SimulatorConfig; | ||||
| import com.verictas.pos.simulator.dataWriter.DataWriter; | ||||
| import com.verictas.pos.simulator.dataWriter.WritingException; | ||||
| @@ -37,7 +38,7 @@ public class Processor { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     public void process(Object[] objectArray, int rounds) throws ProcessingException, WritingException { | ||||
|     public void process(Object[] objectArray) throws ProcessingException, WritingException { | ||||
|         HashMap<String, Object> objects = objectArrayToHashMap(objectArray); | ||||
|  | ||||
|         /** | ||||
| @@ -48,7 +49,7 @@ public class Processor { | ||||
|  | ||||
|             object.setObjectData(objects.get(objectName)); | ||||
|             object.setReferenceObjectData(objects.get(SimulatorConfig.sunName)); | ||||
|             object.processHistory(rounds); | ||||
|             object.processHistory(); | ||||
|  | ||||
|             // Check if the object has gone round last round | ||||
|  | ||||
| @@ -58,9 +59,9 @@ public class Processor { | ||||
|                 object.processNodes(); | ||||
|  | ||||
|                 // ECHO:: Object has gone full circle last round! | ||||
|                 System.out.println("\n\n============== ROTATION DATA: " + objectName.toUpperCase() + ", ROUND " + (rounds - 1) + " ============="); | ||||
|                 System.out.println("\n\n============== ROTATION DATA: " + objectName.toUpperCase() + ", ROUND " + (Simulator.round - 1) + " ============="); | ||||
|  | ||||
|                 if (SimulatorConfig.outputUnit == "AU") { | ||||
|                 if (SimulatorConfig.outputUnit.equals("AU")) { | ||||
|                     System.out.println("Current position (AU): " + AU.convertFromMeter(objects.get(objectName).position) + "\n"); | ||||
|                     System.out.println("Highest point (z-axis graph) (AU): " + AU.convertFromMeter(object.absoluteMax)); | ||||
|                     System.out.println("Lowest point (z-axis graph) (AU): " + AU.convertFromMeter(object.absoluteMin)); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user