Library
PenPlots.unitvec
— ConstantThe unit vector (0, 1).
Useful for creating n-gons, e.g.:
using PenPlots
expect = [
[-1, 0],
[0, -1],
[1, 0],
[0, 1],
]
isapprox(expect, [frac_rotation(i/4) * unitvec for i in 1:4])
# output
true
PenPlots.Extent
— TypeA pair of Point
s representing a rectangle.
PenPlots.Layer
— TypeRepresents a layer of a plot.
A "layer" is a full pass of one pen. A layer has an associated color which is used for previewing the plot in the SVG export, but the color is not used by the plotting software.
PenPlots.MultiPath
— TypeAn array of paths. Corresponds one-to-one with a layer in a plot.
PenPlots.Path
— TypeA 1-dimensional array of Point
s.
PenPlots.PenPlot
— TypeA plot, consisting of one or more layers.
Constructed with:
PenPlot(layers...)
Construct a pen plot consisting of the given layers.
Layers may be:
PenPlots.center
— MethodCompute the center of an Extent
as a Point
.
PenPlots.combine_extents
— MethodCompute an extent which encompasses the given two Extent
s.
PenPlots.degree_rotation
— Methoddegree_rotation(deg)
Create a rotation matrix for the angle given in degrees.
PenPlots.extent
— MethodCompute an extent which encompasses the given MultiPath
.
PenPlots.extent
— MethodCompute an extent which encompasses the given Layer
.
PenPlots.extent
— MethodCompute an extent which encompasses the given Path
.
PenPlots.extent
— MethodCompute an extent which encompasses the given PenPlot
.
PenPlots.frac_rotation
— Methodfrac_rotation(frac)
Create a rotation matrix for the angle given as a fraction, i.e. 1.0 represents a full rotation and 0.5 a half rotation.
PenPlots.perlin_noise
— Methodperlin_noise(control_points, point)
Compute the noise gradient for the given point, given a grid of control points.
PenPlots.point_matrix
— Methodpoint_matrix(xs, ys)
Generate a matrix by producing Point
s for the cartesian product of the vectors of x
and y
values given. The resulting matrix will have as many columns as entries of xs
, and as many rows as values of ys
.
PenPlots.radian_rotation
— Methodradian_rotation(rad)
Create a rotation matrix for the angle given in radians.
PenPlots.random_vector_matrix
— Methodrandom_vector_matrix([rng,] rows, cols)
Produce a matrix with the given number of rows and columns, in which every entry is a random unit vector. If provided, the given random number generator is used to determine the vectors.
PenPlots.to_path_string
— Methodto_path_string(path)
Returns SVG path syntax for the given path.
PenPlots.to_svg
— Methodto_svg(plot)
Returns an SVG representation of the given plot as a string.