Skip to content

Commit 18f8b60

Browse files
committed
fix remaining unbound arg errors
1 parent fe80737 commit 18f8b60

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

src/basic_types.jl

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Abstract Geometry in R{Dim} with Number type T
33
"""
44
abstract type AbstractGeometry{Dim,T<:Number} end
55
abstract type GeometryPrimitive{Dim,T} <: AbstractGeometry{Dim,T} end
6-
Base.ndims(x::AbstractGeometry{Dim}) where {Dim} = Dim
6+
Base.ndims(::AbstractGeometry{Dim}) where {Dim} = Dim
77

88
"""
99
Geometry made of N connected points. Connected as one flat geometry, it makes a Ngon / Polygon.
@@ -63,9 +63,10 @@ end
6363

6464
const NNgon{N} = Ngon{Dim,T,N,P} where {Dim,T,P}
6565

66-
function (::Type{<:NNgon{N}})(points::Vararg{P,N}) where {P<:AbstractPoint{Dim,T},
67-
N} where {Dim,T}
68-
return Ngon{Dim,T,N,P}(SVector(points))
66+
function (::Type{<:NNgon{N1}})(p0::P, points::Vararg{P,N2}) where {P<:AbstractPoint{Dim,T},
67+
N1, N2} where {Dim,T}
68+
@assert N1 == N2+1
69+
return Ngon{Dim,T,N1,P}(SVector(p0, points...))
6970
end
7071
Base.show(io::IO, x::NNgon{N}) where {N} = print(io, "Ngon{$N}(", join(x, ", "), ")")
7172

@@ -101,12 +102,12 @@ const Triangle{Dim,T} = TriangleP{Dim,T,Point{Dim,T}}
101102
const Triangle3d{T} = Triangle{3,T}
102103

103104
Base.show(io::IO, x::TriangleP) = print(io, "Triangle(", join(x, ", "), ")")
104-
Base.summary(io::IO, x::Type{<:TriangleP}) = print(io, "Triangle")
105+
Base.summary(io::IO, ::Type{<:TriangleP}) = print(io, "Triangle")
105106

106107
const Quadrilateral{Dim,T} = Ngon{Dim,T,4,P} where {P<:AbstractPoint{Dim,T}}
107108

108109
Base.show(io::IO, x::Quadrilateral) = print(io, "Quad(", join(x, ", "), ")")
109-
Base.summary(io::IO, x::Type{<:Quadrilateral}) = print(io, "Quad")
110+
Base.summary(io::IO, ::Type{<:Quadrilateral}) = print(io, "Quad")
110111

111112
function coordinates(lines::AbstractArray{LineP{Dim,T,PointType}}) where {Dim,T,PointType}
112113
return if lines isa Base.ReinterpretArray
@@ -149,9 +150,10 @@ Base.show(io::IO, x::TetrahedronP) = print(io, "Tetrahedron(", join(x, ", "), ")
149150

150151
coordinates(x::Simplex) = x.points
151152

152-
function (::Type{<:NSimplex{N}})(points::Vararg{P,N}) where {P<:AbstractPoint{Dim,T},
153-
N} where {Dim,T}
154-
return Simplex{Dim,T,N,P}(SVector(points))
153+
function (::Type{<:NSimplex{N1}})(p0::P, points::Vararg{P,N2}) where {P<:AbstractPoint{Dim,T},
154+
N1, N2} where {Dim,T}
155+
@assert N1 == N2+1
156+
return Simplex{Dim,T,N1,P}(SVector(p0, points...))
155157
end
156158

157159
# Base Array interface

src/primitives/rectangles.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,16 @@ function Rect(v1::Vec{N,T1}, v2::Vec{N,T2}) where {N,T1,T2}
4848
return Rect{N,T}(Vec{N,T}(v1), Vec{N,T}(v2))
4949
end
5050

51-
function RectT{T}(v1::VecTypes{N,T1}, v2::VecTypes{N,T2}) where {N,T,T1,T2}
51+
function RectT{T}(v1::VecTypes{N}, v2::VecTypes{N}) where {N,T}
5252
return if T <: Integer
5353
Rect{N,T}(round.(T, v1), round.(T, v2))
5454
else
5555
return Rect{N,T}(Vec{N,T}(v1), Vec{N,T}(v2))
5656
end
5757
end
5858

59-
function Rect{N}(v1::VecTypes{N,T1}, v2::VecTypes{N,T2}) where {N,T1,T2}
60-
T = promote_type(T1, T2)
59+
function Rect{N}(v1::VecTypes{N}, v2::VecTypes{N}) where {N}
60+
T = promote_type(eltype(v1), eltype(v2))
6161
return Rect{N,T}(Vec{N,T}(v1), Vec{N,T}(v2))
6262
end
6363

0 commit comments

Comments
 (0)