@@ -39,115 +39,94 @@ to ensure that the transparency is enabled when rendering the mesh.
3939
4040## Triangle
4141``` julia
42- turtle = Turtle ()
43- p = Triangle! (turtle; length = 1.0 , width = 1.0 , colors = rand (RGBA))
44- render (Mesh (turtle), wireframe = true )
42+ p = Triangle (length = 1.0 , width = 1.0 )
43+ render (p, wireframe = true , normals = true , color = RGBA (0 ,1 ,0 ,0.5 ), transparency = true )
4544```
4645
4746## Rectangle
4847``` julia
49- turtle = Turtle ()
50- p = Rectangle! (turtle; length = 1.0 , width = 1.0 , colors = rand (RGBA))
51- render (Mesh (turtle), wireframe = true )
48+ p = Rectangle (length = 1.0 , width = 1.0 )
49+ render (p, wireframe = true , normals = true , color = RGBA (0 ,1 ,0 ,0.5 ), transparency = true )
5250```
5351
5452## Trapezoid
5553``` julia
56- turtle = Turtle ()
57- p = Trapezoid! (turtle; length = 1.0 , width = 1.0 , ratio = 0.5 , colors = rand (RGBA))
58- render (Mesh (turtle), wireframe = true )
54+ p = Trapezoid (length = 1.0 , width = 1.0 , ratio = 0.5 )
55+ render (p, wireframe = true , normals = true , color = RGBA (0 ,1 ,0 ,0.5 ), transparency = true )
5956```
6057
6158## Ellipse
6259``` julia
63- turtle = Turtle ()
64- p = Ellipse! (turtle; length = 1.0 , width = 1.0 , n = 30 , colors = rand (RGBA))
65- render (Mesh (turtle), wireframe = true )
60+ p = Ellipse (length = 1.0 , width = 1.0 , n = 30 )
61+ render (p, wireframe = true , normals = true , color = RGBA (0 ,1 ,0 ,0.5 ), transparency = true )
6662```
6763
6864## Axis-aligned bounding box
6965``` julia
70- turtle = Turtle ()
7166p = BBox (Vec (0.0 , 0.0 , 0.0 ), Vec (1.0 , 1.0 , 1.0 ))
72- Mesh! (turtle, p, colors = rand (RGBA))
73- render (Mesh (turtle), wireframe = true )
67+ render (p, wireframe = true , normals = true , color = RGBA (0 ,1 ,0 ,0.5 ), transparency = true )
7468```
7569
7670## Cube
7771
7872Solid version
7973
8074``` julia
81- turtle = Turtle ()
82- p = SolidCube! (turtle; length = 1.0 , width = 1.0 , height = 1.0 , colors = rand (RGBA))
83- render (Mesh (turtle), wireframe = true )
75+ p = SolidCube (length = 1.0 , width = 1.0 , height = 1.0 )
76+ render (p, wireframe = true , normals = true , color = RGBA (0 ,1 ,0 ,0.5 ), transparency = true )
8477```
8578
8679Hollow version
8780
8881``` julia
89- turtle = Turtle ()
90- p = HollowCube! (turtle; length = 1.0 , width = 1.0 , height = 1.0 , colors = rand (RGBA))
91- render (Mesh (turtle), wireframe = true )e)
82+ p = HollowCube (length = 1.0 , width = 1.0 , height = 1.0 )
83+ render (p, wireframe = true , normals = true , color = RGBA (0 ,1 ,0 ,0.5 ), transparency = true )
9284```
9385
94-
95- ## Primitives with (semi-)circular bases
96-
97- The following primitive types share a parameter n, which is the number of triangles to discretize the cylinder into.
98- The lower is number n, cicle base shape will be more rough (e.g., n = 20, base shape is a pentagon).
99- The higher is number n, cicle base shape will be more smooth (e.g., n = 80, base shape is a circle).
100-
10186## Cylinder
10287
10388Solid version
10489
10590``` julia
106- turtle = Turtle ()
107- p = SolidCylinder! (turtle; length = 1.0 , width = 1.0 , height = 1.0 , n = 80 , colors = rand (RGBA))
108- render (Mesh (turtle), wireframe = true )
91+ p = SolidCylinder (length = 1.0 , width = 1.0 , height = 1.0 , n = 80 )
92+ render (p, wireframe = true , normals = true , color = RGBA (0 ,1 ,0 ,0.5 ), transparency = true )
10993```
11094
11195Hollow version
11296
11397``` julia
114- turtle = Turtle ()
115- p = HollowCylinder! (turtle; length = 1.0 , width = 1.0 , height = 1.0 , n = 80 , colors = rand (RGBA))
116- render (Mesh (turtle), wireframe = true )
98+ p = HollowCylinder (length = 1.0 , width = 1.0 , height = 1.0 , n = 40 )
99+ render (p, wireframe = true , normals = true , color = RGBA (0 ,1 ,0 ,0.5 ), transparency = true )
117100```
118101
119102## Frustum
120103
121104Solid version
122105
123106``` julia
124- turtle = Turtle ()
125- p = SolidFrustum! (turtle; length = 1.0 , width = 1.0 , height = 1.0 , ratio = 0.5 , n = 80 , colors = rand (RGBA))
126- render (Mesh (turtle), wireframe = true )
107+ p = SolidFrustum (length = 1.0 , width = 1.0 , height = 1.0 , ratio = 0.5 , n = 80 )
108+ render (p, wireframe = true , normals = true , color = RGBA (0 ,1 ,0 ,0.5 ), transparency = true )
127109```
128110
129111Hollow version
130112
131113``` julia
132- turtle = Turtle ()
133- p = HollowFrustum! (turtle; length = 1.0 , width = 1.0 , height = 1.0 , ratio = 0.5 , n = 80 , colors = rand (RGBA))
134- render (Mesh (turtle), wireframe = true )
114+ p = HollowFrustum (length = 1.0 , width = 1.0 , height = 1.0 , ratio = 0.5 , n = 40 )
115+ render (p, wireframe = true , normals = true , color = RGBA (0 ,1 ,0 ,0.5 ), transparency = true )
135116```
136117
137118## Cone
138119
139120Solid version
140121
141122``` julia
142- turtle = Turtle ()
143- p = SolidCone! (turtle; length = 1.0 , width = 1.0 , height = 1.0 , n = 80 , colors = rand (RGBA))
144- render (Mesh (turtle), wireframe = true )
123+ p = SolidCone (length = 1.0 , width = 1.0 , height = 1.0 , n = 40 )
124+ render (p, wireframe = true , normals = true , color = RGBA (0 ,1 ,0 ,0.5 ), transparency = true )
145125```
146126
147127Hollow version
148128
149129``` julia
150- turtle = Turtle ()
151- p = HollowCone! (turtle; length = 1.0 , width = 1.0 , height = 1.0 , n = 80 , colors = rand (RGBA))
152- render (Mesh (turtle), wireframe = true )
130+ p = HollowCone (length = 1.0 , width = 1.0 , height = 1.0 , n = 20 )
131+ render (p, wireframe = true , normals = true , color = RGBA (0 ,1 ,0 ,0.5 ), transparency = true )
153132```
0 commit comments