ZealOS/docs/Apps/Span/SpanBridge.ZC.html
2021-12-30 22:21:33 -05:00

116 lines
12 KiB
HTML
Executable file

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=US-ASCII">
<meta name="generator" content="ZealOS V1.08">
<style type="text/css">
body {background-color:#1f1f1f;}
.cF0{color:#e3e3e3;background-color:#1f1f1f;}
.cF1{color:#4f84a6;background-color:#1f1f1f;}
.cF2{color:#73a255;background-color:#1f1f1f;}
.cF3{color:#297582;background-color:#1f1f1f;}
.cF4{color:#b34f4b;background-color:#1f1f1f;}
.cF5{color:#8a52c3;background-color:#1f1f1f;}
.cF6{color:#b7822f;background-color:#1f1f1f;}
.cF7{color:#444444;background-color:#1f1f1f;}
.cF8{color:#6d6d6d;background-color:#1f1f1f;}
.cF9{color:#94bfde;background-color:#1f1f1f;}
.cFA{color:#a1ce97;background-color:#1f1f1f;}
.cFB{color:#6db4be;background-color:#1f1f1f;}
.cFC{color:#e88e88;background-color:#1f1f1f;}
.cFD{color:#ca94e8;background-color:#1f1f1f;}
.cFE{color:#d4b475;background-color:#1f1f1f;}
.cFF{color:#1f1f1f;background-color:#1f1f1f;}
</style>
</head>
<body>
<pre style="font-family:monospace;font-size:12pt">
<a name="l1"></a><span class=cF0>#</span><span class=cF1>define</span><span class=cF0> STRENGTH_SCALE </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>5</span><span class=cF0>e7
<a name="l2"></a>#</span><span class=cF1>define</span><span class=cF0> SPRING_SCALE </span><span class=cFE>6</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>e6
<a name="l3"></a>#</span><span class=cF1>define</span><span class=cF0> COST_SCALE </span><span class=cFE>375</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>
<a name="l4"></a>#</span><span class=cF1>define</span><span class=cF0> MASS_RADIUS </span><span class=cFE>3</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>
<a name="l5"></a>#</span><span class=cF1>define</span><span class=cF0> MASS_MASS </span><span class=cFE>10</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>
<a name="l6"></a>#</span><span class=cF1>define</span><span class=cF0> WIRE_PERCENT </span><span class=cFE>0</span><span class=cF0>.</span><span class=cFE>99</span><span class=cF0>
<a name="l7"></a>
<a name="l8"></a>#</span><span class=cF1>define</span><span class=cF0> RIVER_BANK_COLS </span><span class=cFE>5</span><span class=cF0>
<a name="l9"></a>#</span><span class=cF1>define</span><span class=cF0> SKY_LINES </span><span class=cFE>40</span><span class=cF0>
<a name="l10"></a>
<a name="l11"></a>#</span><span class=cF1>define</span><span class=cF0> FIXED_X1 (</span><span class=cF7>(</span><span class=cF0>RIVER_BANK_COLS - </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0> * </span><span class=cF3>FONT_WIDTH</span><span class=cF0>)
<a name="l12"></a>#</span><span class=cF1>define</span><span class=cF0> FIXED_X2 (</span><span class=cF7>(</span><span class=cF0>RIVER_BANK_COLS - </span><span class=cFE>4</span><span class=cF7>)</span><span class=cF0> * </span><span class=cF3>FONT_WIDTH</span><span class=cF0>)
<a name="l13"></a>#</span><span class=cF1>define</span><span class=cF0> FIXED_X3 (</span><span class=cF3>TEXT_COLS</span><span class=cF0> * </span><span class=cF3>FONT_WIDTH</span><span class=cF0> &gt;&gt; </span><span class=cFE>1</span><span class=cF0>)
<a name="l14"></a>#</span><span class=cF1>define</span><span class=cF0> FIXED_Y1 (</span><span class=cF7>(</span><span class=cF0>SKY_LINES + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0> * </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>)
<a name="l15"></a>#</span><span class=cF1>define</span><span class=cF0> FIXED_Y2 (</span><span class=cF7>(</span><span class=cF0>SKY_LINES + </span><span class=cFE>5</span><span class=cF7>)</span><span class=cF0> * </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>)
<a name="l16"></a>#</span><span class=cF1>define</span><span class=cF0> FIXED_Y3 (</span><span class=cF7>(</span><span class=cF0>SKY_LINES + </span><span class=cFE>12</span><span class=cF7>)</span><span class=cF0> * </span><span class=cF3>FONT_HEIGHT</span><span class=cF0>)
<a name="l17"></a>
<a name="l18"></a>#</span><span class=cF1>define</span><span class=cF0> LOAD_WEIGHTS </span><span class=cFE>8</span><span class=cF0>
<a name="l19"></a>
<a name="l20"></a></span><span class=cF1>U0</span><span class=cF0> SpanBridge1Init(</span><span class=cF9>CMathODE</span><span class=cF0> *)
<a name="l21"></a>{
<a name="l22"></a> </span><span class=cF9>I64</span><span class=cF0> i;
<a name="l23"></a>
<a name="l24"></a> MyMass *tmpm;
<a name="l25"></a> tmpm=PlaceMass(</span><span class=cF3>GR_WIDTH</span><span class=cF0> - FIXED_X1, FIXED_Y1);
<a name="l26"></a> tmpm-&gt;flags |= </span><span class=cF3>MSF_FIXED</span><span class=cF0>;
<a name="l27"></a> tmpm=PlaceMass(</span><span class=cF3>GR_WIDTH</span><span class=cF0> - FIXED_X2, FIXED_Y1);
<a name="l28"></a> tmpm-&gt;flags |= </span><span class=cF3>MSF_FIXED</span><span class=cF0>;
<a name="l29"></a> tmpm=PlaceMass(</span><span class=cF3>GR_WIDTH</span><span class=cF0> - FIXED_X1, FIXED_Y2);
<a name="l30"></a> tmpm-&gt;flags |= </span><span class=cF3>MSF_FIXED</span><span class=cF0>;
<a name="l31"></a> tmpm=PlaceMass(FIXED_X1, FIXED_Y1);
<a name="l32"></a> tmpm-&gt;flags |= </span><span class=cF3>MSF_FIXED</span><span class=cF0>;
<a name="l33"></a> tmpm=PlaceMass(FIXED_X2, FIXED_Y1);
<a name="l34"></a> tmpm-&gt;flags |= </span><span class=cF3>MSF_FIXED</span><span class=cF0>;
<a name="l35"></a> tmpm=PlaceMass(FIXED_X1, FIXED_Y2);
<a name="l36"></a> tmpm-&gt;flags |= </span><span class=cF3>MSF_FIXED</span><span class=cF0>;
<a name="l37"></a> tmpm=PlaceMass(FIXED_X3, FIXED_Y3);
<a name="l38"></a> tmpm-&gt;flags |= </span><span class=cF3>MSF_FIXED</span><span class=cF0>;
<a name="l39"></a>
<a name="l40"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; LOAD_WEIGHTS; i++)
<a name="l41"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l42"></a> tmpm = PlaceMass(FIXED_X1 + </span><span class=cF7>(</span><span class=cF0>i + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0> * </span><span class=cF7>(</span><span class=cF3>GR_WIDTH</span><span class=cF0> - </span><span class=cFE>2</span><span class=cF0> * FIXED_X1</span><span class=cF7>)</span><span class=cF0> / </span><span class=cF7>(</span><span class=cF0>LOAD_WEIGHTS + </span><span class=cFE>1</span><span class=cF7>)</span><span class=cF0>, FIXED_Y1);
<a name="l43"></a> tmpm-&gt;load_t = (i + </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>) / LOAD_WEIGHTS;
<a name="l44"></a> tmpm-&gt;color = </span><span class=cF3>RED</span><span class=cF0>;
<a name="l45"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l46"></a>
<a name="l47"></a> </span><span class=cF5>DocClear</span><span class=cF0>;
<a name="l48"></a> </span><span class=cF6>&quot;$BG,LTCYAN$%h*c&quot;</span><span class=cF0>, SKY_LINES, </span><span class=cF6>'\n'</span><span class=cF0>;
<a name="l49"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; </span><span class=cFE>10</span><span class=cF0>; i++)
<a name="l50"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l51"></a> </span><span class=cF6>&quot;$BG,BROWN$%h*c&quot;</span><span class=cF0>, RIVER_BANK_COLS, </span><span class=cF3>CH_SPACE</span><span class=cF0>;
<a name="l52"></a> </span><span class=cF6>&quot;$BG,LTCYAN$%h*c&quot;</span><span class=cF0>, </span><span class=cF3>TEXT_COLS</span><span class=cF0> - </span><span class=cFE>2</span><span class=cF0> * RIVER_BANK_COLS, </span><span class=cF3>CH_SPACE</span><span class=cF0>;
<a name="l53"></a> </span><span class=cF6>&quot;$BG,BROWN$%h*c\n&quot;</span><span class=cF0>, RIVER_BANK_COLS, </span><span class=cF3>CH_SPACE</span><span class=cF0>;
<a name="l54"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l55"></a> </span><span class=cF1>for</span><span class=cF0> (i = </span><span class=cFE>0</span><span class=cF0>; i &lt; </span><span class=cFE>5</span><span class=cF0>; i++)
<a name="l56"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l57"></a> </span><span class=cF6>&quot;$BG,BROWN$%h*c&quot;</span><span class=cF0>, RIVER_BANK_COLS + i, </span><span class=cF3>CH_SPACE</span><span class=cF0>;
<a name="l58"></a> </span><span class=cF6>&quot;$BG,BLUE$%h*c&quot;</span><span class=cF0>, </span><span class=cF3>TEXT_COLS</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0> -RIVER_BANK_COLS - </span><span class=cFE>2</span><span class=cF0> * i, </span><span class=cF3>CH_SPACE</span><span class=cF0>;
<a name="l59"></a> </span><span class=cF6>&quot;$BG,BROWN$%h*c&quot;</span><span class=cF0>, </span><span class=cFE>2</span><span class=cF0> * i, </span><span class=cF3>CH_SPACE</span><span class=cF0>;
<a name="l60"></a> </span><span class=cF6>&quot;$BG,BLUE$%h*c&quot;</span><span class=cF0>, </span><span class=cF3>TEXT_COLS</span><span class=cF0> / </span><span class=cFE>2</span><span class=cF0> - RIVER_BANK_COLS - </span><span class=cFE>2</span><span class=cF0> * i, </span><span class=cF3>CH_SPACE</span><span class=cF0>;
<a name="l61"></a> </span><span class=cF6>&quot;$BG,BROWN$%h*c\n&quot;</span><span class=cF0>, RIVER_BANK_COLS + i, </span><span class=cF3>CH_SPACE</span><span class=cF0>;
<a name="l62"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l63"></a>}
<a name="l64"></a>
<a name="l65"></a></span><span class=cF1>U0</span><span class=cF0> AdjustLoads(</span><span class=cF9>CMathODE</span><span class=cF0> *ode)
<a name="l66"></a>{
<a name="l67"></a> MyMass *tmpm = ode-&gt;next_mass;
<a name="l68"></a> </span><span class=cF1>F64</span><span class=cF0> d, tt = SpanTime / </span><span class=cFE>10</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
<a name="l69"></a> </span><span class=cF1>while</span><span class=cF0> (tmpm != &amp;ode-&gt;next_mass)
<a name="l70"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l71"></a> </span><span class=cF1>if</span><span class=cF0> (tmpm-&gt;load_t)
<a name="l72"></a> {
<a name="l73"></a> </span><span class=cF1>if</span><span class=cF0> (tt)
<a name="l74"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l75"></a> d = </span><span class=cF5>Abs</span><span class=cF0>(</span><span class=cF5>Sin</span><span class=cF7>(</span><span class=cF0>tmpm-&gt;load_t * </span><span class=cF3>pi</span><span class=cF0> + tt</span><span class=cF7>)</span><span class=cF0>); </span><span class=cF2>//0.0&lt;=d&lt;=1.0</span><span class=cF0>
<a name="l76"></a> tmpm-&gt;mass = </span><span class=cFE>100</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> * </span><span class=cF5>Sqr</span><span class=cF0>(</span><span class=cF5>Sqr</span><span class=cF7>(</span><span class=cF0>d + </span><span class=cFE>1</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF7>)</span><span class=cF0>);
<a name="l77"></a> tmpm-&gt;radius = </span><span class=cFE>7</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0> * d + </span><span class=cFE>2</span><span class=cF0>.</span><span class=cFE>0</span><span class=cF0>;
<a name="l78"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l79"></a> </span><span class=cF1>else</span><span class=cF0>
<a name="l80"></a> </span><span class=cF7>{</span><span class=cF0>
<a name="l81"></a> tmpm-&gt;mass = MASS_MASS;
<a name="l82"></a> tmpm-&gt;radius = MASS_RADIUS;
<a name="l83"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l84"></a> }
<a name="l85"></a> tmpm = tmpm-&gt;next;
<a name="l86"></a> </span><span class=cF7>}</span><span class=cF0>
<a name="l87"></a>}
</span></pre></body>
</html>