JuliaGeometry/Meshes.jl

Methods for constructing a `Cylinder` from a segment do not work.

Closed this issue · 1 comments

The help menu for Cylinder lists the following methods:

Cylinder(bottom, top, radius)
A solid circular cylinder embedded in R³ with given radius, delimited by bottom and top planes.

Cylinder(segment, radius)
Alternatively, construct a right circular cylinder with given radius and segment between bottom and top planes.

Cylinder(segment)
Or construct a right circular cylinder with unit radius along the segment.

Cylinder(radius)
Finally, construct a right vertical circular cylinder with given radius.

However, the methods using a Segment seem to throw errors:

> Cylinder(Segment((0., 0., 0.), (1., 2., 1.)),1.2)
MethodError: no method matching Cylinder(::Segment{3, Float64, Vector{Meshes.Point3}}, ::Float64)

Closest candidates are:
  Cylinder(::T) where T
   @ Meshes C:\Users\anonc\.julia\packages\Meshes\uPQGa\src\primitives\cylinder.jl:45
> Cylinder(Segment((0., 0., 0.), (1., 2., 1.)))
MethodError: Cannot `convert` an object of type Int64 to an object of type Vector{Meshes.Point3}

Closest candidates are:
  convert(::Type{Array{T, N}}, ::StaticArraysCore.SizedArray{S, T, N, N, Array{T, N}}) where {S, T, N}
   @ StaticArrays C:\Users\anonc\.julia\packages\StaticArrays\PLKkM\src\SizedArray.jl:88
  convert(::Type{Array{T, N}}, ::StaticArraysCore.SizedArray{S, T, N, M, TData} where {M, TData<:AbstractArray{T, M}}) where {T, S, N}
   @ StaticArrays C:\Users\anonc\.julia\packages\StaticArrays\PLKkM\src\SizedArray.jl:82
  convert(::Type{T}, ::LinearAlgebra.Factorization) where T<:AbstractArray
   @ LinearAlgebra C:\Users\anonc\.julia\juliaup\julia-1.10.0+0.x64.w64.mingw32\share\julia\stdlib\v1.10\LinearAlgebra\src\factorization.jl:108
  ...

Thank you for reporting this documentation issue @orswan. You can construct Cylinder with the end points of the segment instead:

Cylinder((0,0,0), (1,1,1))

Would you like to become a contributor? :) You can update the docstring here and here