reader | R Documentation |
Various utilities for reading and creating svg files for use with inkscape
reader(filename)
write_svg(k, oldfile, safe=TRUE,
regex1 ='sodipodi:docname=',
regex2=' *d *= *" *M.*C.*[zZ] *"')
filename |
Name of a file to be read by |
safe |
Boolean, with default |
k , oldfile , regex1 , regex2 |
Various arguments sent to
|
Function reader()
is the way to get started with a new
knot. This takes a filename which is an .svg
file created with
inkscape. Instructions for creating a suitable inkscape file are
given in knotR-package.Rd
.
Inkscape's default is to use a mixture of absolute and relative
coordinates. Function reader()
assumes that the .svg
file uses only absolute coordinates.
To ensure that only absolute coordinates are used, open the ‘SVG output’ menu in ‘inkscape preferences’ and uncheck the “Allow relative coordinates” option.
The format of .svg
file is described in the W3C recommendation
(2011) for Scalable Vector Graphics (SVG) 1.1, second edition.
Sometimes, reader()
will fail with a valid .svg
file if
a node is sufficiently close to the x or y axis to require exponential
notation (this typically happens with complicated rotational
symmetry). If the file contains text like
...35.3635879230533 -1.323423734554e-15 , 10.3538368384142...
the second value is zero to numerical precision, but the text form of
the number interferes with the operation of reader()
. To deal
with this we need to edit the file in a text editor and replace the
offending number with an exact zero:
...35.3635879230533 0 , 10.3538368384142...
(I guess the ideal would be to incorporate some clever regexp
technique into reader()
but this turned out to be harder than I
thought).
Robin K. S. Hankin
utilities
,knotR-package
## Not run:
a <- reader("6_3.svg")
b <- getcontrolpoints(a)
knotplot(a)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.