The renderHierarchy function below, makes it easy to render any data structure as a hierarchy of svg elements. The example code renders the same nodes from two data structures that inpmements the same hierarchy - one natural hierarchy and one flat list where a parent attribute is used to define the hierarchy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Verifying my Blockstack ID is secured with the address 15bWtNMFcaj96pT5ZtH2FB4Nx6fyL5ERNf https://explorer.blockstack.org/address/15bWtNMFcaj96pT5ZtH2FB4Nx6fyL5ERNf |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
</head> | |
<style> | |
svg { | |
background-color: #eee; | |
} | |
path { | |
stroke: black; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:stylesheet version="1.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:variable name="fromchar" select="'abcdefghijklmnopqrstuvwABCDEFGHIJKLMNOPQRSTUVW0123456789'" /> | |
<xsl:variable name="tochar" select="'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1111111111'" /> | |
<xsl:output omit-xml-declaration="no"/> | |
<!-- copy unchanged by default --> | |
<xsl:template match="node()|@*"> | |
<xsl:copy> | |
<xsl:apply-templates select="node()|@*"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
rect, circle { | |
fill: none; | |
stroke: black; | |
} | |
</style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
rect, circle { | |
fill: none; | |
stroke: black; | |
} | |
</style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function main(params) { | |
return union( | |
CSG.cylinder({start:[0,-75,0], end:[0,-74,0], radius: 30, resolution:36}), | |
CSG.cylinder({start:[0,-83,0], end:[0,90,0], radius: 2, resolution:36}), | |
shifter().translate([0, -80, 0]), | |
ball_bearing().translate([0, -80.5, 0]), | |
ball_bearing().translate([0, 80.5, 0]), | |
ball_bearing().translate([0, 83.5, 0]), | |
ball_bearing().translate([0, -84.5, -10]), | |
CSG.cylinder({start:[0,-90,0], end:[0,-80,0], radius: 2, resolution:36}).translate([0, 0, -10]), |