JuliaGeometry / GeometryBasics.jl

Basic Geometry Types
MIT License
164 stars 54 forks source link

Mesh with tris and quads? #142

Open RibeiroAndre opened 3 years ago

RibeiroAndre commented 3 years ago

Hi! Any way to create a mesh of mixed element types? I don't see any way of mixing tris and quads in the same mesh. Thanks a lot!

juliohm commented 3 years ago

Take a look at Meshes.jl for mixed element meshes. We have a simple UnstructuredMesh representation and will be adding other data structures soon for fast navigation over the faces of any kind.

On Sat, Mar 27, 2021, 18:06 RibeiroAndre @.***> wrote:

Hi! Any way to create a mesh of mixed element types? I don't see any way of mixing tris and quads in the same mesh. Thanks a lot!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/JuliaGeometry/GeometryBasics.jl/issues/142, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZQW3L3N446MJC2RF7VBVLTFZCFFANCNFSM4Z5JI7MQ .

RibeiroAndre commented 3 years ago

Thanks for the quick answer. Would the meshes from Meshes.jl be compatible with Makie? Thanks!

juliohm commented 3 years ago

Not yet but we are working on recipes and trying to provide feedback to improve the Makie recipe system.

On Sat, Mar 27, 2021, 18:11 RibeiroAndre @.***> wrote:

Thanks for the quick answer. Would the meshes from Meshes.jl be compatible with Makie? Thanks!

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/JuliaGeometry/GeometryBasics.jl/issues/142#issuecomment-808802954, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZQW3ODHDA7BDZSNRJGT73TFZCYXANCNFSM4Z5JI7MQ .

RibeiroAndre commented 3 years ago

Ok, thanks!

SimonDanisch commented 3 years ago

There is an overload missing to create the correct polytope type:

using GeometryBasics
using GeometryBasics: AbstractNgonFace, AbstractPoint, Ngon
function GeometryBasics.Polytope(P::Type{<:AbstractPoint{Dim,T}},
                  ::Type{<:AbstractNgonFace{N,IT} where N}) where {Dim,T,IT}
    return Ngon{Dim,T,N,P} where N
end

f = [TriangleFace(1, 2, 3), QuadFace(1, 2, 3, 4)]

p = Point2f0[(0, 1), (1, 2), (3, 4), (4, 5)]
Mesh(p, x);

There seem to be some more overloads missing for when there are faces with different Ns, so display errors as well...

BambOoxX commented 2 years ago

Hi @SimonDanisch , I just stumbled upon this very issue, is there a plan to implement a correction for this issue ?

I also tried your fix (just correcting x by f in Mesh(p,x) and it shows no error as long as the output is omitted with ; as you proposed. However, if i remove the trailing ; an exception occurs

ERROR: MethodError: no method matching (Ngon{2, Float32, N, Point{2, Float32}} where N)(::QuadFace{Point{2, Float32}})

I'm working with