Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FaceView Documentation, MethodError: no method matching FaceView(::Vector{Point{3, Float32}}, ::Vector{TriangleFace}) #202

Open
mkitti opened this issue Aug 31, 2023 · 1 comment

Comments

@mkitti
Copy link

mkitti commented Aug 31, 2023

The following example is included in the documentation for FaceView, but no longer functions.

x = FaceView(rand(Point3f, 10), TriangleFace[(1, 2, 3), (2, 4, 5), ...])
x[1] isa Triangle == true
x isa AbstractVector{<: Triangle} == true
# This means we can use it as a mesh:
Mesh(x) # should just work!
# Can also be used for Points:

linestring = FaceView(points, LineFace[...])
Polygon(linestring)

"""
FaceView{Element, Point, Face, P, F}
FaceView enables to link one array of points via a face array, to generate one
abstract array of elements.
E.g., this becomes possible:
```
x = FaceView(rand(Point3f, 10), TriangleFace[(1, 2, 3), (2, 4, 5), ...])
x[1] isa Triangle == true
x isa AbstractVector{<: Triangle} == true
# This means we can use it as a mesh:
Mesh(x) # should just work!
# Can also be used for Points:
linestring = FaceView(points, LineFace[...])
Polygon(linestring)
```
"""

julia> using GeometryBasics

julia> x = FaceView(rand(Point3f, 10), TriangleFace[(1, 2, 3), (2, 4, 5)])
ERROR: MethodError: no method matching FaceView(::Vector{Point{3, Float32}}, ::Vector{TriangleFace})
@mkitti
Copy link
Author

mkitti commented Aug 31, 2023

Perhaps the closest function code is

julia> using GeometryBasics

julia> x = Mesh(rand(Point3f, 10), TriangleFace{Int}[(1, 2, 3), (2, 4, 5)])
Mesh{3, Float32, Triangle}:
 Triangle(Float32[0.01959169, 0.27225375, 0.013921678], Float32[0.6437949, 0.9430128, 0.59738755], Float32[0.49121314, 0.80466264, 0.8372437])
 Triangle(Float32[0.6437949, 0.9430128, 0.59738755], Float32[0.81211555, 0.6806344, 0.15718842], Float32[0.7763256, 0.033540606, 0.6247859])

julia> x[1] isa Triangle
true

julia> x isa AbstractVector{<: Triangle}
true

julia> Mesh(x)
Mesh{3, Float32, Triangle}:
 Triangle(Float32[0.01959169, 0.27225375, 0.013921678], Float32[0.6437949, 0.9430128, 0.59738755], Float32[0.49121314, 0.80466264, 0.8372437])
 Triangle(Float32[0.6437949, 0.9430128, 0.59738755], Float32[0.81211555, 0.6806344, 0.15718842], Float32[0.7763256, 0.033540606, 0.6247859])

Is FaceView still needed?

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

No branches or pull requests

1 participant