Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

decomposing Simplex into Point or Simplex{1} #123

Open
goretkin opened this issue Nov 30, 2017 · 1 comment
Open

decomposing Simplex into Point or Simplex{1} #123

goretkin opened this issue Nov 30, 2017 · 1 comment

Comments

@goretkin
Copy link
Contributor

I might be misunderstanding the intention of decompose, but my guess is that these should work.

julia> s = Simplex{3,Point}(Point(1,0,0), Point(0,1,0), Point(0,0,1))
3-element GeometryTypes.Simplex{3,GeometryTypes.Point}:
 [1, 0, 0]
 [0, 1, 0]
 [0, 0, 1]

julia> decompose(Simplex{2}, s)
(GeometryTypes.Point[[1, 0, 0], [0, 1, 0]], GeometryTypes.Point[[0, 1, 0], [0, 0, 1]], GeometryTypes.Point[[0, 0, 1], [1, 0, 0]])

julia> decompose(Simplex{1}, s)
ERROR: MethodError: GeometryTypes.Simplex{1,GeometryTypes.Point}(::GeometryTypes.Point{3,Int64}) is ambiguous. Candidates:
  (::Type{GeometryTypes.Simplex{1,T}})(x::T) where T in GeometryTypes at /Users/goretkin/playgrounds/vamp/packages/v0.6/GeometryTypes/src/simplices.jl:16
  (::Type{GeometryTypes.Simplex{S,T}})(x) where {S, T} in GeometryTypes at /Users/goretkin/playgrounds/vamp/packages/v0.6/GeometryTypes/src/simplices.jl:10
  (::Type{S})(sv::StaticArrays.StaticArray{Tuple{N},T,1} where T where N) where S<:GeometryTypes.Simplex in GeometryTypes at /Users/goretkin/playgrounds/vamp/packages/v0.6/GeometryTypes/src/simplices.jl:6
Possible fix, define
  (::Type{GeometryTypes.Simplex{1,T<:(StaticArrays.StaticArray{Tuple{N},T,1} where T where N)}})(::T<:(StaticArrays.StaticArray{Tuple{N},T,1} where T where N))
Stacktrace:
 [1] decompose(::Type{GeometryTypes.Simplex{1,T} where T}, ::GeometryTypes.Simplex{3,GeometryTypes.Point}) at /Users/goretkin/playgrounds/vamp/packages/v0.6/GeometryTypes/src/decompose.jl:139

julia> decompose(Point, s)
ERROR: MethodError: no method matching decompose(::Type{GeometryTypes.Point}, ::GeometryTypes.Simplex{3,GeometryTypes.Point})
Closest candidates are:
  decompose(::Type{SV<:(StaticArrays.StaticArray{Tuple{N},T,1} where T where N)}, ::GeometryTypes.AbstractGeometry{N,T}, ::Any...) where {SV<:(StaticArrays.StaticArray{Tuple{N},T,1} where T where N), N, T} at /Users/goretkin/playgrounds/vamp/packages/v0.6/GeometryTypes/src/decompose.jl:8
  decompose(::Type{GeometryTypes.Simplex{3,T1}}, ::GeometryTypes.Simplex{N,T2}) where {N, T1, T2} at /Users/goretkin/playgrounds/vamp/packages/v0.6/GeometryTypes/src/decompose.jl:92
  decompose(::Type{GeometryTypes.Simplex{3,T} where T}, ::GeometryTypes.Simplex{N,T}) where {N, T} at /Users/goretkin/playgrounds/vamp/packages/v0.6/GeometryTypes/src/decompose.jl:106
  ...
@SimonDanisch
Copy link
Member

decompose pretty much grew organically, so whenever someone needed a primitive to decompose into some other primitive, they implemented it ;) If you need this functionality, you're very welcome to implement it! If you need any guidance, let me know!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants