-
Notifications
You must be signed in to change notification settings - Fork 3
/
basic-shapes.sk
159 lines (130 loc) · 2.69 KB
/
basic-shapes.sk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
## Examples of 3D objects from sketch-lib
##
## Author : Alex Dumitrache <[email protected]>
## License: GPL
## Predefined styles (you may uncomment one of them)
def blue<>
% def red<>
% def gray<>
## Include the shapes library
input{lib/defaults.sk}
input{lib/objects.sk}
{cylinder}
put{translate([5,0,0])}
{
def generatrix<>
input{lib/cylinder}
put{scale(2)}{coordsys}
}
put{translate([10,0,0])}
{
def segments 10
def wireframe<>
put{scale([1,1,2])}{input{lib/cylinder}}
put{scale(2.5)}{coordsys}
}
put {translate([15,0,0])}
{
def segments 20
def generatrix<>
def style [cull=false, draw=red]
put{scale([1,1,2])}{input{lib/cylinder}}
put{scale(2.5)}{coordsys}
}
put{translate([0,5,0])}
{pyramid}
put{translate([5,5,0])}
{
def n 3
input{lib/pyramid}
put{scale(2)}{coordsys}
}
put{translate([10,5,0])}
{
def n 6
def wireframe<>
put{scale([1,1,2])}{input{lib/pyramid}}
put{scale([2,2,3])}{coordsys}
}
put{translate([15,5,0])}
{
def n 4
def style [draw=green, style=thick]
put{scale([1,1,2])}{input{lib/pyramid}}
put{scale([2,2,3])}{coordsys}
}
put{translate([0,10,0])}
{box}
put{translate([5,10,0])}
put{scale([1,1,2])}{box}
put{translate([10,10,0])}
{
def style[draw=red, style=thick]
def wireframe<>
input{lib/box}
}
put{translate([15,10,0])}
{
def style[draw=black, style=thick]
input{lib/box}
def rgb<>
put{scale(2)}
{
input{lib/coordsys}
special |\path #1 node[right] {$x_{box}$}
#2 node[right] {$y_{box}$}
#3 node[left] {$z_{box}$};|(x)(y)(z)
}
}
put{translate([0,15,0])}
{sphere}
put{translate([5,15,0])}
{
def segments 10
input{lib/sphere}
put{scale(2)}{coordsys}
}
put{translate([10,15,0])}
{
def wireframe<>
def segments 10
input{lib/sphere}
}
put{translate([15,15,0])}
{
def style [draw=none, fill=blue!20]
input{lib/sphere}
}
put{translate([0,20,0])}
{
put{scale([1,1,2])}{cone}
put{scale([2,2,3])}
{
{coordsys}
special |\path #1 node[right] {$x$}
#2 node[right] {$y$}
#3 node[above] {$z$};|(x)(y)(z)
}
}
put{translate([5,20,0])}
{
def generatrix<>
put{scale([1,1,2])}{input{lib/cone}}
}
put{translate([10,20,0])}
{
def wireframe<>
put{scale([1,1,2])}{input{lib/cone}}
}
put{translate([15,20,0])}
{
def style [draw=orange, style=thick]
def generatrix<>
put{scale([1,1,2])}{input{lib/cone}}
}
line [arrows=<->, style=dashed] (5,0,1.5)(5,5,1.5)
global
{
language tikz
camera rotate(0, (1,0,0)) * view((-2.7,2,1.5),(0,0,0),[0,0,1]) * rotate(180, (0,0,1)) * scale(0.75)
}