You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/src/objects.md
+98-73
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ Object(
47
47
"cube")
48
48
```
49
49
50
-
The default rendering applied by `pin()`uses less than fifty shades of grey to draw it.
50
+
The default rendering applied by `pin()`is an attempt at a simple hidden-surface display. In real 3D software, this process has to be far more sophisticated.
The gfunction here receives the `vertices`, `faces`, and `labels` in `args`, but the faces and labels are empty, so this simple use of `pin` only needs to draw a polygon through the vertices.
96
-
97
-
!!! warning
98
-
99
-
The gfunction used by `pin()` for objects doesn't give you access to the 3D points, unlike the versions used for points.
95
+
The `objecttopoly()` function returns a tuple, containing the 2D vertices, and the polygons that define the faces.
100
96
101
97
## OFF the shelf objects
102
98
@@ -120,11 +116,12 @@ sethue("blue") # hide
120
116
helloworld() # hide
121
117
122
118
t = Tiler(600, 300, 2, 2)
119
+
setline(0.5)
123
120
for (n, o) in enumerate([Cube, Tetrahedron, Pyramid, Teapot])
@@ -162,7 +162,13 @@ which brings these objects into play:
162
162
163
163
## Rendering objects
164
164
165
-
To render objects, there are many choices you can make about how to draw the faces and the vertices. You do this with a gfunction. For objects, the gfunction is more complex than for points and lines. It takes lists of vertices, faces, and labels. Here's a simple example:
165
+
To render objects, there are many choices you can make about how to draw the faces and the vertices.
166
+
167
+
### Using gfunctions
168
+
169
+
You do this with a gfunction.
170
+
171
+
Here's a simple example:
166
172
167
173
```@example
168
174
using Thebes, Luxor # hide
@@ -177,32 +183,37 @@ helloworld() # hide
177
183
setlinejoin("bevel")
178
184
eyepoint(150, 150, 150)
179
185
180
-
function mygfunction(vertices, faces, labels; action=:fill)
@@ -219,53 +230,67 @@ The faces are drawn in the order in which they were defined. But to be a more re
219
230
220
231
This is why Thebes is more of a wireframe tool than any kind of genuine 3D application. Use Makie.jl. Or program Blender with Julia.
221
232
222
-
In theory it's possible to do some quick calculations on an object to sort the faces into the correct order for a particular viewpoint. The `sortfaces!()` function can do this for simple objects - it may be sufficient.
233
+
In theory it's possible to do some quick calculations on an object to sort the faces into the correct order for a particular viewpoint. The `sortfaces!()` function used above can do this for simple objects - it may be sufficient.
Thebes.jl is a work in progress, and a good general-purpose rendering function that draws everything with lots of optional parameters is not yet provided. However, you can avoid using the built-in `pin(o::Object)` function, and experiment with code such as the following:
0 commit comments