@@ -7,15 +7,21 @@ To display geometry primitives, they need to be decomposable.
7
7
This can be done for any arbitrary primitive, by overloading the following interface:
8
8
9
9
``` julia
10
- # Lets take SimpleRectangle as an example:
11
- # Minimal set of decomposable attributes to build up a triangle mesh
10
+ # Let's take SimpleRectangle as an example:
11
+ # Below is a minimal set of decomposable attributes to build up a triangle mesh:
12
12
isdecomposable (:: Type{T} , :: Type{HR} ) where {T<: Point , HR<: SimpleRectangle } = true
13
13
isdecomposable (:: Type{T} , :: Type{HR} ) where {T<: Face , HR<: SimpleRectangle } = true
14
14
15
- # Example implementation of decompose for points
15
+ # This is an example implementation of ` decompose` for points.
16
16
function GeometryBasics. decompose (P:: Type{Point{3, PT}} , r:: SimpleRectangle , resolution= (2 ,2 )) where PT
17
17
w,h = resolution
18
- vec (P[(x,y,0 ) for x= range (r. x, stop = r. x+ r. w, length = w), y= range (r. y, stop = r. y+ r. h, length = h)])
18
+ vec (
19
+ PT[
20
+ (x,y,0 )
21
+ for x in range (r. x, stop = r. x+ r. w, length = w),
22
+ y in range (r. y, stop = r. y+ r . h, length = h)
23
+ ]
24
+ )
19
25
end
20
26
21
27
function GeometryBasics. decompose (:: Type{T} , r:: SimpleRectangle , resolution= (2 ,2 )) where T <: Face
@@ -42,4 +48,4 @@ normals(m) # automatically calculated from mesh
42
48
```
43
49
44
50
As you can see, the normals are automatically calculated only with the faces and points.
45
- You can overwrite that behavior, by also defining decompose for the ` Normal ` type!
51
+ You can overwrite that behavior by also defining decompose for the ` Normal ` type!
0 commit comments