Skip to content

Commit b7b7eb7

Browse files
committed
Add Icosahedron example
1 parent 0bbec47 commit b7b7eb7

File tree

8 files changed

+79
-0
lines changed

8 files changed

+79
-0
lines changed

Examples/Icosahedron.shape

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// ShapeScript document
2+
3+
define points {
4+
define t 1 + sqrt(2) / 2
5+
6+
(-1 t 0)
7+
( 1 t 0)
8+
(-1 -t 0)
9+
( 1 -t 0)
10+
11+
( 0 -1 t)
12+
( 0 1 t)
13+
( 0 -1 -t)
14+
( 0 1 -t)
15+
16+
( t 0 -1)
17+
( t 0 1)
18+
(-t 0 -1)
19+
(-t 0 1)
20+
}
21+
22+
define triangle(a b c) {
23+
polygon {
24+
point a
25+
point b
26+
point c
27+
}
28+
}
29+
30+
mesh {
31+
// 5 triangles around first point
32+
triangle points.first points.twelfth points.sixth
33+
triangle points.first points.sixth points.second
34+
triangle points.first points.second points.eighth
35+
triangle points.first points.eighth points.eleventh
36+
triangle points.first points.eleventh points.twelfth
37+
38+
// 5 adjacent triangles
39+
triangle points.second points.sixth points.tenth
40+
triangle points.sixth points.twelfth points.fifth
41+
triangle points.twelfth points.eleventh points.third
42+
triangle points.eleventh points.eighth points.seventh
43+
triangle points.eighth points.second points.ninth
44+
45+
// 5 triangles around fourth point
46+
triangle points.fourth points.tenth points.fifth
47+
triangle points.fourth points.fifth points.third
48+
triangle points.fourth points.third points.seventh
49+
triangle points.fourth points.seventh points.ninth
50+
triangle points.fourth points.ninth points.tenth
51+
52+
// 5 adjacent triangles
53+
triangle points.fifth points.tenth points.sixth
54+
triangle points.third points.fifth points.twelfth
55+
triangle points.seventh points.third points.eleventh
56+
triangle points.ninth points.seventh points.eighth
57+
triangle points.tenth points.ninth points.second
58+
}

docs/images/icosahedron.png

17.4 KB
Loading

docs/ios/examples.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ The Earth example demonstrates use of the [texture](materials.md#texture) comman
2727

2828
![Earth](../images/earth.png)
2929

30+
## Icosahedron
31+
32+
The Icosahedron demonstrates the use of the [mesh command](meshes.md) along with [structured data](literals.md#structured-data) and [custom functions](functions.md#custom-functions) to create a complex shape that cannot easily be derived from the built-in primitives.
33+
34+
![Icosahedron](../images/icosahedron.png)
35+
3036
## Spirals
3137

3238
The Spirals example demonstrates using the [extrude](builders.md#extrude) command to create a spiral. This example also demonstrates the use of [for loops](control-flow.md#loops) and user-defined [options](blocks.md#options).

docs/ios/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ ShapeScript Help
158158
- [Chessboard](examples.md#chessboard)
159159
- [Cog](examples.md#cog)
160160
- [Earth](examples.md#earth)
161+
- [Icosahedron](examples.md#icosahedron)
161162
- [Spirals](examples.md#spirals)
162163
- [Spring](examples.md#spring)
163164
- [Train](examples.md#train)

docs/mac/examples.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ The Earth example demonstrates use of the [texture](materials.md#texture) comman
2727

2828
![Earth](../images/earth.png)
2929

30+
## Icosahedron
31+
32+
The Icosahedron demonstrates the use of the [mesh command](meshes.md) along with [structured data](literals.md#structured-data) and [custom functions](functions.md#custom-functions) to create a complex shape that cannot easily be derived from the built-in primitives.
33+
34+
![Icosahedron](../images/icosahedron.png)
35+
3036
## Spirals
3137

3238
The Spirals example demonstrates using the [extrude](builders.md#extrude) command to create a spiral. This example also demonstrates the use of [for loops](control-flow.md#loops) and user-defined [options](blocks.md#options).

docs/mac/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ ShapeScript Help
158158
- [Chessboard](examples.md#chessboard)
159159
- [Cog](examples.md#cog)
160160
- [Earth](examples.md#earth)
161+
- [Icosahedron](examples.md#icosahedron)
161162
- [Spirals](examples.md#spirals)
162163
- [Spring](examples.md#spring)
163164
- [Train](examples.md#train)

docs/src/examples.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ The Earth example demonstrates use of the [texture](materials.md#texture) comman
2727

2828
![Earth](../images/earth.png)
2929

30+
## Icosahedron
31+
32+
The Icosahedron demonstrates the use of the [mesh command](meshes.md) along with [structured data](literals.md#structured-data) and [custom functions](functions.md#custom-functions) to create a complex shape that cannot easily be derived from the built-in primitives.
33+
34+
![Icosahedron](../images/icosahedron.png)
35+
3036
## Spirals
3137

3238
The Spirals example demonstrates using the [extrude](builders.md#extrude) command to create a spiral. This example also demonstrates the use of [for loops](control-flow.md#loops) and user-defined [options](blocks.md#options).

docs/src/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ ShapeScript Help
158158
- [Chessboard](examples.md#chessboard)
159159
- [Cog](examples.md#cog)
160160
- [Earth](examples.md#earth)
161+
- [Icosahedron](examples.md#icosahedron)
161162
- [Spirals](examples.md#spirals)
162163
- [Spring](examples.md#spring)
163164
- [Train](examples.md#train)

0 commit comments

Comments
 (0)