Skip to content

Instantly share code, notes, and snippets.

@kenwebb
Created March 12, 2012 20:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenwebb/2024605 to your computer and use it in GitHub Desktop.
Save kenwebb/2024605 to your computer and use it in GitHub Desktop.
Venus and Jupiter in 'close encounter'
<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook http://www.primordion.com/Xholon/wb/ (C) Ken Webb Mon Mar 12 2012 21:20:04 GMT-0400 (EDT)-->
<XholonWorkbook>
<Notes><![CDATA[
Xholon
------
Title: Venus and Jupiter in 'close encounter'
Description: Astronomy enthusiasts are gearing up for a dazzling planetary conjunction this week during which Jupiter and Venus will appear to be side by side.
Url: http://www.cbc.ca/news/technology/story/2012/03/12/venus-jupiter-conjunction.html
InternalName:
YoutubeId:
Keywords:
My Notes
--------
March 12, 2012
The CBC article doesn't mention which way the planets are moving. I'm sure that Venus appears to move a lot faster than Jupiter because it's closer to the Sun and also much closer to the Earth. All planets move along the same plane (the ecliptic), so Venus should either move directly towards or directly away from Jupiter, or parallel to Jupiter, so really it could be moving in any direction. I'll have it move generally towards Jupiter because there's more "space" in that direction on the SVG image.
To watch the animation, press the Run button above, and then press Pause (to unpause the app). Continue to press Pause to pause and unpause, or press Step to have it run for one time step. Press Refresh to reset the simulation.
See the Venusbehavior script below, for the JavaScript/jQuery code that runs each time step to move Venus forward.
This page is intended to only use the information in the article, so I won't go any further with it. There are many ways to improve it, but I think it gets the basic idea across, and provides a useful supplement to what was in the news article.
]]></Notes>
<script implName="lang:python:inline:"><![CDATA[
#print "height = 12.34 m"
]]></script>
<script implName="lang:javascript:inline:"><![CDATA[
//print("height = 56.78 meters\n");
]]></script>
<_-.XholonClass>
<!-- domain objects -->
<PhysicalSystem/>
<Space/>
<Planet>
<Venus/>
<Earth/>
<Jupiter/>
</Planet>
<Moon/>
<Observer/>
<!-- quantities -->
<Separation superClass="Angle"/>
</_-.XholonClass>
<xholonClassDetails>
<Observer>
<port name="venus" connector="#xpointer(../../Venus)"/>
<port name="jupiter" connector="#xpointer(../../Jupiter)"/>
</Observer>
</xholonClassDetails>
<PhysicalSystem>
<Space>
<Venus/>
<Jupiter/>
<Moon/>
<Earth>
<Observer>
<!-- aparent separation between Venus and Jupiter, as seen from Earth
"a couple of finger-widths held at arm's length" -->
<Separation>3 °</Separation>
</Observer>
</Earth>
</Space>
</PhysicalSystem>
<Blockbehavior implName="lang:python:inline:"><![CDATA[
# This works if pasted in as a last child of Block.
#height.incVal(0.02)
#print("Python wants something to do. Height:" + str(height))
]]></Blockbehavior>
<Blockbehavior implName="lang:javascript:inline:"><![CDATA[
// This works if pasted in as a last child of Block.
//height.incVal(0.02);
//print("JavaScript wants something to do. Height:" + height + "\n");
]]></Blockbehavior>
<Venusbehavior implName="lang:webEditionjs:inline:"><![CDATA[
var svg = $($('div#mySVGDiv > object')[0].contentDocument.getElementsByTagNameNS(svgns, 'svg')[0]);
var venus = svg.children().children().children('circle').eq(0);
venus.attr('cx', venus.attr('cx') - 0 + 1);
]]></Venusbehavior>
<Blockbehavior implName="lang:bsh:inline:"><![CDATA[
// This works if pasted in as a last child of Block.
//height.incVal(0.02);
//System.out.print("Java/Beanshell wants something to do. Height:" + height + "\n");
]]></Blockbehavior>
<Blockbehavior implName="lang:jruby:inline:"><![CDATA[
#require 'java'
# This works if pasted in as a last child of Block.
#$height.incVal(0.02)
#puts "Ruby wants something to do. Height: #{$height}"
]]></Blockbehavior>
<Blockbehavior implName="lang:groovy:inline:"><![CDATA[
// This works if pasted in as a last child of Block.
//height.incVal(0.02);
//System.out.print("Groovy wants something to do. Height:" + height + "\n");
]]></Blockbehavior>
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml,
<svg width="500" height="300" xmlns="http://www.w3.org/2000/svg">
<g>
<title>Space</title>
<rect y="0" x="0" height="300" width="500" fill="#000000" id="PhysicalSystem/Space"/>
<g id="svg_1">
<title>Venus</title>
<circle r="5" cy="42" cx="110" fill="#FFF8DC" id="PhysicalSystem/Space/Venus"/>
</g>
<g id="svg_2">
<title>Jupiter</title>
<circle r="4" cy="28" cx="350" fill="#FFF8DC" id="PhysicalSystem/Space/Jupiter"/>
</g>
<g id="svg_3">
<title>Moon</title>
<circle transform="rotate(-15, 218.5, 247)" r="23.94922" cy="247" cx="218.5" fill="#FFF8DC" id="PhysicalSystem/Space/Moon"/>
<path opacity="0.8" transform="rotate(-15, 217.467, 243.145)" stroke="#000000" fill="#000000" d="m193.00026,243.14476c0,-11.02544 10.94931,-19.95604 24.467,-19.95604c13.51767,0 24.46698,8.9306 24.46698,19.95604c0,11.02544 -10.94931,19.95604 -24.46698,19.95604c-13.51768,0 -24.467,-8.9306 -24.467,-19.95604z" id="svg_4"/>
</g>
</g>
</svg>
]]></Attribute_String><Attribute_String roleName="setup">${MODELNAME_DEFAULT},${SVGURI_DEFAULT}</Attribute_String></SvgClient>
</XholonWorkbook>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment