Shapes Library aims to simplify the process of creating graphs. Generally creating graphs involves writing complex expressions. Using Shapes Library, with just a few steps you can construct different types of graphs. It provides functions to construct some general shapes like circles, parabolas, etc. The complete list of shapes that can be constructed are listed below. The Shapes Library also has features to modify the graphs after it is defined for example shifting or scaling a constructed graph .
To construct and modify a shape, the functions below are used in a sequence, delimited by commas or semicolons. The first function in the sequence defines the shape of the graph, the functions following it apply the modification to the shapes in their order of occurence.
Example: parabola(1), move(3,4), rotate(45) - constructs a parabola with the cooficient of x^2 equal to 1, then moves it to the location(3,4) on the graph and then rotates the parabola to an angle of 45 degree.
Shapes:
circle(r) - defines a circle with center at (0,0) and radius r.
Arc(r, a, b) - defines an arc with center at (0,0), radius r, starting at an angle a, ending at an angle b.
Arc(r, x, y, a, b) - defines an arc with center at (x,y), radius r, starting at an angle a, ending at an angle b.
parabola() - defines a parabola for y=x^2
parabola(a) - defines a parabola for y=a*x^2
parabola(x1,x2) - defines a parabola for y=x^2, where x=[x1,x2]
parabola(a,x1,x2) - defines a parabola for y=a*x^2, where x=[x1,x2]
hyperbola() - defines a hyperbola for y=1/x
hyperbola(a) - defines a hyperbola for y=a/x
hyperbola(x1,x2) - defines a hyperbola for y=1/x, where x=[x1,x2]
hyperbola(a,x1,x2) - defines a hyperbola for y=a/x, where x=[x1,x2]
line(a,b,c) - defines a line for a*x+b*y+c=0
ray(x1,y1,x2,y2) - defines a ray, starting at (x1, y1) and drawn through (x2, y2)
segment(x1,y1,x2,y2) - defines a segment, drawn from (x1, y1) to (x2, y2)
cubic() - defines graph as y=x^3
cubic(a) - defines graph as y=a*x^3
cubic(x1, y1) - defines graph as y=x^3, where x=[x1,x2]
cubic(a,x1,x2) - defines graph as y=a*x^3, where x=[x1,x2]
sqrt() - defines the square root of x
sqrt(x1) - defines the square root of x, where x=[x1,Infinity)
sqrt(a,x1) -defines a*(square root of x), where x=[x1,Infinity)
sqrt(a,x1,x2) -defines a*(square root of x), where x=[x1,x2]
ngon(n, r) - constructs a regular N-gon with n sides and circumradius r
triangle(side1, side2, side3) - constructs a triangle with sides as side1, side2, side3
rectangle(a, b) - constructs a rectangle with sides a and b
square(a) - constructs a square with side a
pentangle(a) - constructs a pentangle with side a
hexagon(a) -constructs a hexagon with side a
heptagon(a) - constructs a heptagon with side a
octagon(a) - constructs an octagon with side a
parallelogram(a, b, ang) - constructs a parallelogram with sides a and b, and an angle of ang
rhomboid(a, ang) - constructs a rhomboid with side a, and an angle of ang between the sides
fill(x,y) - fills the area where point (x,y) is located. Graphing visible area border, axis, or shapes should restrict filling.
Modifications:
move(dx,dy) - moves shape by dx in X direction and dy in Y direction.
scale(kx,ky) - scales shape by kx in X direction and ky in Y direction.
mirrorx(px) - reflects shape by x=px line.
mirrory(py) - reflects shape by y=py line.
rotate(ang) - rotates shape by ang degrees.
absx(px) - all points (x,y) are transformed to (|x-px|+px,y) (absolute value of y coordinate taking line x=px as zero line)
absy(py) - all points (x,y) are transformed to (x,|y-py|+py) (absolute value of x coordinate taking line y=py as zero line)
style(n[,m]) - if defined shape is "fill", n is the number of filling style. If defined shape is not "fill", n is number of line style, m is number of line color. m is necessary parameter. n,m=1,2,3
linestyle('style','rrggbb') - changes style and color of defined shape. Example: parabola(1),linestyle('dotted','ff0000').
fillstyle('style','rrggbb') - changes style and color of filled area. Example: fill(0.2,0.2),fillstyle('dotted','ff0000').
| Copyright 2007 | |