I am advancing only slowly, but I do. :)

About this XSLT I found this page: http://www.styleassistant.de/tips/tip89.htm

And I made a SVG file which plots a horizontal sundial, given the
location and the inclination (so it can be a south facing vertical as
well. Just change the capital latters variable values in the source
code. They will hopefully be settable like in a html form.
The images does not take into accounf the longitude lambda yet and I
have not tried printing it on any size.
It works with Firefox 3 (tested).
Find the source below and attached.
Thomas




<?xml version="1.0"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";>

<svg version="1.1"
   xmlns="http://www.w3.org/2000/svg";
   xmlns:dc="http://purl.org/dc/elements/1.1/";
   xmlns:cc="http://web.resource.org/cc/";
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
   viewBox="-300 -150 600 600"
   onload="start(evt)" >
  <title>Thomas' SVG sundail</title>
  <desc>A SVG file ploting a horizontal sundial given the inclination</desc>
  <metadata>
    <rdf:RDF>
      <cc:Work>
        <dc:creator>
          <cc:Agent>
            <dc:title>Thomas' SVG sundial</dc:title>
          </cc:Agent>
        </dc:creator>
        <cc:license
rdf:resource="http://creativecommons.org/licenses/by-sa/2.5/"; />
      </cc:Work>
      <cc:License rdf:about="http://creativecommons.org/licenses/by-sa/2.5/";>
        <cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"; />
        <cc:permits rdf:resource="http://web.resource.org/cc/Distribution"; />
        <cc:requires rdf:resource="http://web.resource.org/cc/Notice"; />
        <cc:requires rdf:resource="http://web.resource.org/cc/Attribution"; />
        <cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"; />
        <cc:requires rdf:resource="http://web.resource.org/cc/ShareAlike"; />
      </cc:License>
    </rdf:RDF>
  </metadata>

  <script type="text/ecmascript">
  <![CDATA[

    var PHI     = 51.1*2.0*Math.PI/360.0;
    var LAMBDA  = 15.13888*2.0*Math.PI/360.0;
    var INCLINE = 0.0*2.0*Math.PI/360.0;
    var SIZE    = 200;

    function start(evt) {
      var dials =
document.getElementsByTagNameNS("http://www.w3.org/2000/svg","line";);
      for(var i=0; i<dials.length; i++) {
        var dial = dials.item(i);
        var hr = dial.getAttributeNS(null, 'hr');
        var ang=angle(hr);
        dial.setAttributeNS(null, 'x1', 0.3*SIZE*Math.sin(ang) );
        dial.setAttributeNS(null, 'y1', 0.3*SIZE*Math.cos(ang) );
        dial.setAttributeNS(null, 'x2',     SIZE*Math.sin(ang) );
        dial.setAttributeNS(null, 'y2',     SIZE*Math.cos(ang) );
      }
      var texs =
document.getElementsByTagNameNS("http://www.w3.org/2000/svg","text";);
      for(var i=0; i<texs.length; i++) {
        var tex = texs.item(i);
        var hr = tex.getAttributeNS(null, 'hr');
        var ang=angle(hr);
        tex.setAttributeNS(null, 'x', 1.1*SIZE*Math.sin(ang) );
        tex.setAttributeNS(null, 'y', 1.1*SIZE*Math.cos(ang) );
      }
    }

    function angle(t) {
      tau=(t-12.0)*15.0*2.0*Math.PI/360.0;
      tz=Math.sin(PHI+INCLINE)*Math.tan(tau);
      z=Math.atan( tz );
      return( z );
    }


  ]]>
  </script>


  <line hr="5" x1="0" y1="0" x2="10" y2="10" stroke="red" stroke-width="1px" />
  <line hr="6" x1="0" y1="0" x2="10" y2="10" stroke="red" stroke-width="1px" />
  <line hr="7" x1="0" y1="0" x2="10" y2="10" stroke="red" stroke-width="1px" />
  <line hr="8" x1="0" y1="0" x2="10" y2="10" stroke="red" stroke-width="1px" />
  <line hr="9" x1="0" y1="0" x2="10" y2="10" stroke="red" stroke-width="1px" />
  <line hr="10" x1="0" y1="0" x2="10" y2="10" stroke="red" stroke-width="1px" />
  <line hr="11" x1="0" y1="0" x2="10" y2="10" stroke="red" stroke-width="1px" />
  <line hr="12" x1="0" y1="0" x2="10" y2="10" stroke="red" stroke-width="1px" />
  <line hr="13" x1="0" y1="0" x2="10" y2="10" stroke="red" stroke-width="1px" />
  <line hr="14" x1="0" y1="0" x2="10" y2="10" stroke="red" stroke-width="1px" />
  <line hr="15" x1="0" y1="0" x2="10" y2="10" stroke="red" stroke-width="1px" />
  <line hr="16" x1="0" y1="0" x2="10" y2="10" stroke="red" stroke-width="1px" />
  <line hr="17" x1="0" y1="0" x2="10" y2="10" stroke="red" stroke-width="1px" />
  <line hr="18" x1="0" y1="0" x2="10" y2="10" stroke="red" stroke-width="1px" />

  <text hr="6" x="1" y="1" font-size="20px" fill="red" >6</text>
  <text hr="7" x="1" y="1" font-size="20px" fill="red" >7</text>
  <text hr="8" x="1" y="1" font-size="20px" fill="red" >8</text>
  <text hr="9" x="1" y="1" font-size="20px" fill="red" >9</text>
  <text hr="10" x="1" y="1" font-size="20px" fill="red" >10</text>
  <text hr="11" x="1" y="1" font-size="20px" fill="red" >11</text>
  <text hr="12" x="1" y="1" font-size="20px" fill="red" >12</text>
  <text hr="13" x="1" y="1" font-size="20px" fill="red" >13</text>
  <text hr="14" x="1" y="1" font-size="20px" fill="red" >14</text>
  <text hr="15" x="1" y="1" font-size="20px" fill="red" >15</text>
  <text hr="16" x="1" y="1" font-size="20px" fill="red" >16</text>
  <text hr="17" x="1" y="1" font-size="20px" fill="red" >17</text>
  <text hr="18" x="1" y="1" font-size="20px" fill="red" >18</text>

  <circle cx="0" cy="0" r="55" fill="none" stroke="red" />

</svg>


[Non-text portions of this message have been removed]


------------------------------------

-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
----Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/svg-developers/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Reply via email to