Skip to content

Commit ffa5e08

Browse files
committed
introduce TriangleMesh
1 parent 90aed0e commit ffa5e08

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/interfaces.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ function decompose(::Normal{T}, primitive) where {T}
141141
n = normals(decompose(Point, primitive), faces(primitive), T)
142142
else
143143
points = decompose(Point, primitive)
144-
n = (Vec3f(0, 0, 1) for p in points)
144+
n = [T(0, 0, 1) for p in points]
145145
end
146146
else
147147
n = _n

src/meshes.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ function mesh(primitive::AbstractGeometry; pointtype=Point, facetype=GLTriangleF
2828
return Mesh(positions, f)
2929
end
3030

31+
const SimpleMesh{N, T, FT} = Mesh{N, T, Vector{Point{N, T}}, Vector{FT}}
32+
const TriangleMesh{N} = SimpleMesh{N, Float32, GLTriangleFace}
33+
3134
"""
3235
mesh(polygon::AbstractVector{P}; pointtype=P, facetype=GLTriangleFace,
3336
normaltype=nothing)
@@ -38,11 +41,11 @@ function mesh(polygon::AbstractVector{P}; pointtype=P) where {P<:Point{2}}
3841
return mesh(Polygon(polygon); pointtype=pointtype)
3942
end
4043

41-
function triangle_mesh(primitive::AbstractGeometry{N}) where {N}
44+
function triangle_mesh(primitive::AbstractGeometry{N})::TriangleMesh{N} where {N}
4245
return mesh(primitive; pointtype=Point{N, Float32})
4346
end
4447

45-
function triangle_mesh(primitive::AbstractVector{<: Point})
48+
function triangle_mesh(primitive::AbstractVector{<: Point2})::TriangleMesh{2}
4649
return mesh(Polygon(primitive))
4750
end
4851

0 commit comments

Comments
 (0)