|
|
Line 177: |
Line 177: |
| <hr/> | | <hr/> |
|
| |
|
| === graphic === | | == ''Movement'' helpers == |
| '''parameters''': (group, ySet, dx=1, origin=nil, color="#0" | | === flipX === |
| Plots the curve sampled in <'''ySet'''> with a resolution of <'''dx'''>.
| | '''parameters''': (elem, Xaxis=0) |
| * '''ySet''' as [y0,...,yn] in pixels. | | Flips horizontally the element. |
| * '''dx''' optional curve resolution in pixels. 1 px by default. | | * '''elem''' element to be flipped. |
| * '''origin''' optional as [x,y] in pixels, [0,0] by default.
| | * '''Xaxis''' abscissa of the symmetry axis . If 0 (default) element flips in-place. |
| * '''color''' optional grid color as [r,g,b] or "#rrggbb". Black by default. | | <hr/> |
| {| class="wikitable"
| | === flipX === |
| |-
| | '''parameters''': (elem, Yaxis=0) |
| ! example !! Screenshot
| | Flips vertically the element. |
| |-
| | * '''elem''' element to be flipped. |
| |
| | * '''Yaxis''' ordenate of the symmetry axis . If 0 (default) element flips in-place. |
| {{Note| This assumes that you already have a top-level root group set up, and his ''group'' child named '''myGroup'''. }} <syntaxhighlight lang="nasal">
| |
| var (red,blue,green,orange) = ['#ee0000', [0,0,1], [0,0.8,0], '#ea9a32' ];
| |
| var yValues = [];
| |
| for(var i=0;i<460;i+=4) append(yValues, 30*math.sin(i*D2R));
| |
| var xAxis = canvas.plot2D.hzLine(myGroup, [10,100],175,blue);
| |
| var yAxis = canvas.plot2D.vtLine(myGroup, [15,180],-175,blue);
| |
| var graph = canvas.plot2D.graphic(myGroup, yValues,,[15,100],red);
| |
| | |
| </syntaxhighlight>
| |
| || [[File:Plot2D,graphic.png|thumb]]
| |
| <hr/> | | <hr/> |