This wiki is closed in favour of the new wiki. Information shown is likely to be very out of date. |
Difference between revisions of "User:Space/Template:DrawLine"
From Discovery Wiki
Jump to navigationJump to searchm |
m |
||
Line 1: | Line 1: | ||
− | <noinclude><nowiki>{{User:Space/Template:DrawLine|x1|y1|x2|y2|width in px}}</nowiki | + | <noinclude><nowiki>{{User:Space/Template:DrawLine|x1|y1|x2|y2|width in px}}</nowiki></noinclude> |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
<includeonly>{{atan2|{{#expr:{{{4}}}-{{{2}}}}}|{{#expr: {{{3}}}-{{{1}}}}}}} <div style="-webkit-transform-origin: 0 100%; width: {{#expr: (({{{1}}}-{{{3}}})^2+({{{2}}}*{{{4}}})^2)^0.5}}px; height: {{{5}}}px; background: #000;"></div></includeonly> | <includeonly>{{atan2|{{#expr:{{{4}}}-{{{2}}}}}|{{#expr: {{{3}}}-{{{1}}}}}}} <div style="-webkit-transform-origin: 0 100%; width: {{#expr: (({{{1}}}-{{{3}}})^2+({{{2}}}*{{{4}}})^2)^0.5}}px; height: {{{5}}}px; background: #000;"></div></includeonly> | ||
− | |||
− | Test: {{User:Space/Template:DrawLine|0|2|0|9|3}}</noinclude> | + | <noinclude>Test: {{User:Space/Template:DrawLine|0|2|0|9|3}}</noinclude> |
<noinclude><!-- var length = Math.sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)); | <noinclude><!-- var length = Math.sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)); | ||
Line 20: | Line 11: | ||
theta *= 180/pi // rads to degs | theta *= 180/pi // rads to degs | ||
$angle = rad2deg(atan2(($y2 - $y1), ($x2 - x1))); | $angle = rad2deg(atan2(($y2 - $y1), ($x2 - x1))); | ||
+ | |||
+ | <!-- Calculates the length of the line --> | ||
+ | |||
+ | {{#expr: atan2 (({{{4}}}-{{{2}}}),({{{3}}}-{{{1}}}))}} | ||
+ | |||
+ | {{atan2|{{#expr:{{{4}}}-{{{2}}}}}|{{{3}}}-{{{1}}}}} | ||
+ | |||
+ | <!-- Renders the line --></noinclude> | ||
--></noinclude> | --></noinclude> |
Revision as of 12:45, 8 April 2013
{{User:Space/Template:DrawLine|x1|y1|x2|y2|width in px}}
Test:
1.5707963267949
--></noinclude>
Expression error: Unexpected ( operator.
-->