@@ -7,15 +7,21 @@ To display geometry primitives, they need to be decomposable.
77This can be done for any arbitrary primitive, by overloading the following interface:
88
99``` 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:
1212isdecomposable (:: Type{T} , :: Type{HR} ) where {T<: Point , HR<: SimpleRectangle } = true
1313isdecomposable (:: Type{T} , :: Type{HR} ) where {T<: Face , HR<: SimpleRectangle } = true
1414
15- # Example implementation of decompose for points
15+ # This is an example implementation of ` decompose` for points.
1616function GeometryBasics. decompose (P:: Type{Point{3, PT}} , r:: SimpleRectangle , resolution= (2 ,2 )) where PT
1717 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+ )
1925end
2026
2127function GeometryBasics. decompose (:: Type{T} , r:: SimpleRectangle , resolution= (2 ,2 )) where T <: Face
@@ -42,4 +48,4 @@ normals(m) # automatically calculated from mesh
4248```
4349
4450As 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