Skip to content

Commit caa5efb

Browse files
committed
fixes
1 parent 338feef commit caa5efb

File tree

4 files changed

+18
-22
lines changed

4 files changed

+18
-22
lines changed

src/GeometryBasics.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ module GeometryBasics
4949
export HyperSphere, Circle, Sphere
5050
export Cylinder, Cylinder2, Cylinder3, Pyramid, extremity
5151
export Rect, Rect2D, Rect3D, IRect, IRect2D, IRect3D, FRect, FRect2D, FRect3D
52-
export before, during, contains, isinside, isoutside, meets, overlaps, intersects, finishes
52+
export before, during, isinside, isoutside, meets, overlaps, intersects, finishes
5353
export centered, direction, area, update
5454
export max_dist_dim, max_euclidean, max_euclideansq, min_dist_dim, min_euclidean
5555
export min_euclideansq, minmax_dist_dim, minmax_euclidean, minmax_euclideansq

src/basic_types.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,21 @@ abstract type AbstractNgonFace{N, T} <: AbstractFace{N, T} end
2020

2121
abstract type AbstractSimplex{Dim, N, T} <: StaticVector{Dim, T} end
2222

23-
2423
"""
2524
coordinates(geometry)
26-
Returns the edges/vertices/coordinates of a geometry
25+
Returns the edges/vertices/coordinates of a geometry. Is allowed to return lazy iterators!
26+
Use `decompose(ConcretePointType, geometry)` to get `Vector{ConcretePointType}` with
27+
`ConcretePointType` to be something like `Point{3, Float32}`.
2728
"""
2829
function coordinates(points::AbstractVector{<:AbstractPoint})
2930
return points
3031
end
3132

3233
"""
3334
faces(geometry)
34-
Returns the face connections of a geometry
35+
Returns the face connections of a geometry. Is allowed to return lazy iterators!
36+
Use `decompose(ConcreteFaceType, geometry)` to get `Vector{ConcreteFaceType}` with
37+
`ConcreteFaceType` to be something like `TriangleFace{Int}`.
3538
"""
3639
function faces(f::AbstractVector{<:AbstractFace})
3740
return f

src/meshes.jl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,15 @@ function gl_uv_triangle_mesh2d(primitive::GeometryPrimitive)
130130
return Mesh(meta(points; uv=uv), fs)
131131
end
132132

133-
function gl_normal_mesh3d(primitive::GeometryPrimitive, nfaces=30)
134-
points = decompose(Point3f0, primitive, nfaces)
135-
fs = decompose(GLTriangleFace, primitive, nfaces)
133+
function gl_normal_mesh3d(primitive::GeometryPrimitive)
134+
points = decompose(Point3f0, primitive)
135+
fs = decompose(GLTriangleFace, primitive)
136+
return Mesh(meta(points; normals=normals(points, fs)), fs)
137+
end
138+
139+
function gl_normal_mesh3d(primitive::GeometryPrimitive, nvertices)
140+
points = decompose(Point3f0, primitive, nvertices)
141+
fs = decompose(GLTriangleFace, primitive, nvertices)
136142
return Mesh(meta(points; normals=normals(points, fs)), fs)
137143
end
138144

src/rectangles.jl

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ Check if Rects are contained in each other. This does not use
461461
strict inequality, so Rects may share faces and this will still
462462
return true.
463463
"""
464-
function contains(b1::Rect{N}, b2::Rect{N}) where N
464+
function Base.in(b2::Rect{N}, b1::Rect{N}) where N
465465
for i = 1:N
466466
maximum(b2)[i] <= maximum(b1)[i] &&
467467
minimum(b2)[i] >= minimum(b1)[i] ||
@@ -474,26 +474,13 @@ end
474474
Check if a point is contained in a Rect. This will return true if
475475
the point is on a face of the Rect.
476476
"""
477-
function contains(b1::Rect{N, T}, pt::VecTypes) where {T, N}
477+
function Base.in(pt::VecTypes, b1::Rect{N, T}) where {T, N}
478478
for i = 1:N
479479
pt[i] <= maximum(b1)[i] && pt[i] >= minimum(b1)[i] || return false
480480
end
481481
return true
482482
end
483483

484-
"""
485-
Check if Rects are contained in each other. This does not use
486-
strict inequality, so Rects may share faces and this will still
487-
return true.
488-
"""
489-
Base.in(b1::Rect, b2::Rect) = contains(b2, b1)
490-
491-
"""
492-
Check if a point is contained in a Rect. This will return true if
493-
the point is on a face of the Rect.
494-
"""
495-
Base.in(pt::VecTypes, b1::Rect) = contains(b1, pt)
496-
497484
#
498485
# Equality
499486
#

0 commit comments

Comments
 (0)