SVG Illustration
Back to Download Form
This sample program attempts to render spheres into SVG using analytical results
to find overlaps. Current implementation is a bit on the
brute-force side and could certainly be improved upon if the general
results seem useful. Both efficiency and accuracy need to be examined
as redraws could be done more cleanly with less duplication and
multiple overlaps etc could be examined and generalized. In the
BMP below, note some visible boundary lines and other artifacts
or inaccuracies even as most of the simple cases seem to be reasonably
drawn. The brightness gradient uses SVG facilities and doesn't attempt
to model Lambertian or other surface properties.
While intended for rendering pdb files, it does not currently accept
this input format directly.
$ ./pdb2svg.exe -xlate "20;20;20;8" -atom "C;255;128;128;1;O;0;255;0;1;N;0;0;25
5;1;S;255;00;255;1" -loadpts cd25sulfenic.pts -center -sort -out > cd25sulfe
nic.svg
Sample SVG output of pdb file
Using the hollow option to find overlaps,
$ ./pdb2svg.exe -xlate "20;20;20;8" -atom "C;255;128;128;1;O;0;255;0;1;N;0;0;25
5;1;S;255;00;255;1" -loadpts cd25sulfenic.pts -center -sort -hollow -out -label
z > surb.svg
Sample SVG output for diagnosis and analysis
$ ./pdb2svg
Usage: pdb2svg file
Convert input point list into an SVG file.
Direct pdb input not supported.
Input is executed left to right,
-load fn : load spheres in format x y z R r g b per line
-loadpts fn : as above but a y z ATOM where ATOM's are defined below
-sort: z-sort list in current form
-out: generate svg from current model to stdout
-xlate li : modify next loads with x;y;z;M translate and then scale my M
-atom li: define atoms by {S;r;g;b;R};... where S is symbol, R radius
-zin zmax: maximum unput Z to accept
-zout zmax: maximum transformed z value to render
-xform nm: apply xform to current model
rotate;theta;phi;alpha : rotate by alpha around normal theta-phi
-radfac f: multiply all model radii by f
-hollow : don't fill atoms, just outline and show olap areas.
-vw n : view width in user coords
-vh n : view height in user coords
-center : set origin at center of mass of current model/view
-label nm : add labels, right now only z is supported with -hollow
-about : show version and credit info
Contact: marchywka@hotmail.com
$ ./pdb2svg -about
pdb2svg.cpp705Dec 26 200813:53:42
Credit: Written by Mike Marchywka , marchywka@hotmail.com ca. Dec 2008
Note: IO buffering needs work
Note: Known to pick wrong arcs sometimes
Note: Slow and not guaranteed to handle all overlaps well
Note: Developed under cywgin, based on spec here:
Ref: http://www.w3.org/TR/SVG11/index.html#minitoc
Ref: http://en.wikipedia.org/wiki/Rotation_matrix