@@ -39,94 +39,115 @@ to ensure that the transparency is enabled when rendering the mesh.
3939
4040## Triangle
4141``` julia
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 )
42+ turtle = Turtle ()
43+ p = Triangle! (turtle; length = 1.0 , width = 1.0 , colors = rand (RGBA))
44+ render (Mesh (turtle), wireframe = true )
4445```
4546
4647## Rectangle
4748``` julia
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 )
49+ turtle = Turtle ()
50+ p = Rectangle! (turtle; length = 1.0 , width = 1.0 , colors = rand (RGBA))
51+ render (Mesh (turtle), wireframe = true )
5052```
5153
5254## Trapezoid
5355``` julia
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 )
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 )
5659```
5760
5861## Ellipse
5962``` julia
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 )
63+ turtle = Turtle ()
64+ p = Ellipse! (turtle; length = 1.0 , width = 1.0 , n = 30 , colors = rand (RGBA))
65+ render (Mesh (turtle), wireframe = true )
6266```
6367
6468## Axis-aligned bounding box
6569``` julia
70+ turtle = Turtle ()
6671p = BBox (Vec (0.0 , 0.0 , 0.0 ), Vec (1.0 , 1.0 , 1.0 ))
67- render (p, wireframe = true , normals = true , color = RGBA (0 ,1 ,0 ,0.5 ), transparency = true )
72+ Mesh! (turtle, p, colors = rand (RGBA))
73+ render (Mesh (turtle), wireframe = true )
6874```
6975
7076## Cube
7177
7278Solid version
7379
7480``` julia
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 )
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 )
7784```
7885
7986Hollow version
8087
8188``` julia
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 )
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)
8492```
8593
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+
86101## Cylinder
87102
88103Solid version
89104
90105``` julia
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 )
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 )
93109```
94110
95111Hollow version
96112
97113``` julia
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 )
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 )
100117```
101118
102119## Frustum
103120
104121Solid version
105122
106123``` julia
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 )
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 )
109127```
110128
111129Hollow version
112130
113131``` julia
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 )
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 )
116135```
117136
118137## Cone
119138
120139Solid version
121140
122141``` julia
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 )
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 )
125145```
126146
127147Hollow version
128148
129149``` julia
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 )
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 )
132153```
0 commit comments