Skip to content

Commit

Permalink
Embeded SVGs in README.
Browse files Browse the repository at this point in the history
  • Loading branch information
colah committed Oct 25, 2011
1 parent 43ea1ea commit 8987b9a
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions README.markdown
Expand Up @@ -27,21 +27,25 @@ A simple 2D example:
> import Implicit
>
> out = union
> (square 40)
> (translate (20,20) (circle 15) )
> (square 80)
> (translate (40,40) (circle 30) )
>
> writeSVG (-50,-50) (50,50) 1 "test.svg" out
> writeSVG (-100,-100) (100,100) 2 "test.svg" out
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"> <polyline points=" 60.0,60.0 110.0,60.0 110.01667,59.0 110.06675,58.0 110.1504,57.0 110.26792,56.0 110.419716,55.0 110.606285,54.0 110.828224,53.0 111.0,52.332405 111.08643,52.0 111.382195,51.0 111.716125,50.0 112.0,49.237034 112.08963,49.0 112.50527,48.0 112.96311,47.0 113.0,46.925415 113.468025,46.0 114.0,45.034214 114.01933,45.0 114.62415,44.0 115.0,43.422 115.28292,43.0 116.0,42.0 116.785065,41.0 117.0,40.741535 117.641594,40.0 118.0,39.60705 118.57849,39.0 119.0,38.578495 119.607056,38.0 120.0,37.64159 120.74154,37.0 121.0,36.785065 122.0,36.0 123.0,35.28292 123.422,35.0 124.0,34.62415 125.0,34.019333 125.03421,34.0 126.0,33.468025 126.925415,33.0 127.0,32.963108 128.0,32.505272 129.0,32.08963 129.23703,32.0 130.0,31.716124 131.0,31.382198 132.0,31.086435 132.33241,31.0 133.0,30.828226 134.0,30.606283 135.0,30.419716 136.0,30.267921 137.0,30.1504 138.0,30.066746 139.0,30.016672 140.0,30.0 141.0,30.016672 142.0,30.066746 143.0,30.1504 144.0,30.267921 145.0,30.419716 146.0,30.606283 147.0,30.828226 147.66759,31.0 148.0,31.086435 149.0,31.382198 150.0,31.716124 150.76297,32.0 151.0,32.08963 152.0,32.505272 153.0,32.963108 153.07458,33.0 154.0,33.468025 154.96579,34.0 155.0,34.019333 156.0,34.62415 156.578,35.0 157.0,35.28292 158.0,36.0 159.0,36.785065 159.25847,37.0 160.0,37.64159 160.39294,38.0 161.0,38.578495 161.42151,39.0 162.0,39.60705 162.35841,40.0 163.0,40.741535 163.21494,41.0 164.0,42.0 164.71709,43.0 165.0,43.422 165.37585,44.0 165.98067,45.0 166.0,45.034214 166.53197,46.0 167.0,46.925415 167.0369,47.0 167.49472,48.0 167.91037,49.0 168.0,49.237034 168.28387,50.0 168.6178,51.0 168.91356,52.0 169.0,52.332405 169.17177,53.0 169.39372,54.0 169.58029,55.0 169.73207,56.0 169.8496,57.0 169.93326,58.0 169.98332,59.0 170.0,60.0 169.98332,61.0 169.93326,62.0 169.8496,63.0 169.73207,64.0 169.58029,65.0 169.39372,66.0 169.17177,67.0 169.0,67.667595 168.91356,68.0 168.6178,69.0 168.28387,70.0 168.0,70.76297 167.91037,71.0 167.49472,72.0 167.0369,73.0 167.0,73.074585 166.53197,74.0 166.0,74.96579 165.98067,75.0 165.37585,76.0 165.0,76.578 164.71709,77.0 164.0,78.0 163.21494,79.0 163.0,79.25846 162.35841,80.0 162.0,80.392944 161.42151,81.0 161.0,81.42151 160.39294,82.0 160.0,82.358406 159.25847,83.0 159.0,83.214935 158.0,84.0 157.0,84.71708 156.578,85.0 156.0,85.37585 155.0,85.98067 154.96579,86.0 154.0,86.531975 153.07458,87.0 153.0,87.03689 152.0,87.49473 151.0,87.91037 150.76297,88.0 150.0,88.283875 149.0,88.617805 148.0,88.91357 147.66759,89.0 147.0,89.171776 146.0,89.393715 145.0,89.580284 144.0,89.73208 143.0,89.8496 142.0,89.93325 141.0,89.98333 140.0,90.0 140.0,140.0 60.0,140.0 60.0,60.0" style="stroke:rgb(0,0,255);stroke-width:1;fill:none;"/> </svg>


A rounded union:

> import Implicit
>
> out = unionR 7
> (square 40)
> (translate (20,20) (circle 15) )
>
> writeSVG (-50,-50) (50,50) 1 "test.svg" out
> out = unionR 14
> (square 80)
> (translate (40,40) (circle 30) )
>
> writeSVG (-100,-100) (100,100) 2 "test.svg" out
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"> <polyline points=" 60.0,60.0 96.0,60.0 97.0,59.96324 98.0,59.85333 99.0,59.670185 100.0,59.41287 101.0,59.07953 101.20004,59.0 102.0,58.657124 103.0,58.14931 103.25851,58.0 104.0,57.544456 104.78286,57.0 105.0,56.84066 106.0,56.028313 106.03189,56.0 107.0,55.10062 107.09954,55.0 108.0,54.05292 108.046616,54.0 108.90062,53.0 109.0,52.880234 109.68259,52.0 110.0,51.579777 110.410385,51.0 111.0,50.147427 111.09563,50.0 111.736015,49.0 112.0,48.580837 112.34271,48.0 112.92159,47.0 113.0,46.863213 113.464424,46.0 114.0,45.034214 114.01933,45.0 114.62415,44.0 115.0,43.422 115.28292,43.0 116.0,42.0 116.785065,41.0 117.0,40.741535 117.641594,40.0 118.0,39.60705 118.57849,39.0 119.0,38.578495 119.607056,38.0 120.0,37.64159 120.74154,37.0 121.0,36.785065 122.0,36.0 123.0,35.28292 123.422,35.0 124.0,34.62415 125.0,34.019333 125.03421,34.0 126.0,33.468025 126.925415,33.0 127.0,32.963108 128.0,32.505272 129.0,32.08963 129.23703,32.0 130.0,31.716124 131.0,31.382198 132.0,31.086435 132.33241,31.0 133.0,30.828226 134.0,30.606283 135.0,30.419716 136.0,30.267921 137.0,30.1504 138.0,30.066746 139.0,30.016672 140.0,30.0 141.0,30.016672 142.0,30.066746 143.0,30.1504 144.0,30.267921 145.0,30.419716 146.0,30.606283 147.0,30.828226 147.66759,31.0 148.0,31.086435 149.0,31.382198 150.0,31.716124 150.76297,32.0 151.0,32.08963 152.0,32.505272 153.0,32.963108 153.07458,33.0 154.0,33.468025 154.96579,34.0 155.0,34.019333 156.0,34.62415 156.578,35.0 157.0,35.28292 158.0,36.0 159.0,36.785065 159.25847,37.0 160.0,37.64159 160.39294,38.0 161.0,38.578495 161.42151,39.0 162.0,39.60705 162.35841,40.0 163.0,40.741535 163.21494,41.0 164.0,42.0 164.71709,43.0 165.0,43.422 165.37585,44.0 165.98067,45.0 166.0,45.034214 166.53197,46.0 167.0,46.925415 167.0369,47.0 167.49472,48.0 167.91037,49.0 168.0,49.237034 168.28387,50.0 168.6178,51.0 168.91356,52.0 169.0,52.332405 169.17177,53.0 169.39372,54.0 169.58029,55.0 169.73207,56.0 169.8496,57.0 169.93326,58.0 169.98332,59.0 170.0,60.0 169.98332,61.0 169.93326,62.0 169.8496,63.0 169.73207,64.0 169.58029,65.0 169.39372,66.0 169.17177,67.0 169.0,67.667595 168.91356,68.0 168.6178,69.0 168.28387,70.0 168.0,70.76297 167.91037,71.0 167.49472,72.0 167.0369,73.0 167.0,73.074585 166.53197,74.0 166.0,74.96579 165.98067,75.0 165.37585,76.0 165.0,76.578 164.71709,77.0 164.0,78.0 163.21494,79.0 163.0,79.25846 162.35841,80.0 162.0,80.392944 161.42151,81.0 161.0,81.42151 160.39294,82.0 160.0,82.358406 159.25847,83.0 159.0,83.214935 158.0,84.0 157.0,84.71708 156.578,85.0 156.0,85.37585 155.0,85.98067 154.96579,86.0 154.0,86.535576 153.1368,87.0 153.0,87.07841 152.0,87.65729 151.41916,88.0 151.0,88.263985 150.0,88.90437 149.85257,89.0 149.0,89.589615 148.42023,90.0 148.0,90.31741 147.11977,91.0 147.0,91.09938 146.0,91.953384 145.94708,92.0 145.0,92.90046 144.89938,93.0 144.0,93.96811 143.9717,94.0 143.15933,95.0 143.0,95.21714 142.45555,96.0 142.0,96.74149 141.8507,97.0 141.34288,98.0 141.0,98.79996 140.92047,99.0 140.58713,100.0 140.32982,101.0 140.14667,102.0 140.03676,103.0 140.0,104.0 140.0,140.0 60.0,140.0 60.0,60.0" style="stroke:rgb(0,0,255);stroke-width:1;fill:none;"/> </svg>

A simple 3D example:

Expand Down

0 comments on commit 8987b9a

Please sign in to comment.