Skip to content

Polygon with BigFloats #132

@zekeriyasari

Description

@zekeriyasari

The construction of a polygon with Float64 points such as

hexagon = Polygon(
    [Point(cos(θ), sin(θ)) for θ in 0 : π / 3 : 2π - π / 3]
)

does not throw an error, while the one with BigFloat points such as

hexagon = Polygon(
    [Point(BigFloat(cos(θ)), BigFloat(sin(θ))) for θ in 0 : π / 3 : 2π - π / 3]
)

does throw an error. The error thrown is

ERROR: ArgumentError: cannot reinterpret `Tuple{Point2{BigFloat}, Point2{BigFloat}}` as `Line{2, BigFloat}`, type `Line{2, BigFloat}` is not a bits type
Stacktrace:
 [1] (::Base.var"#throwbits#243")(S::Type, T::Type, U::Type)
   @ Base ./reinterpretarray.jl:16
 [2] reinterpret(#unused#::Type{Line{2, BigFloat}}, a::TupleView{Tuple{Point2{BigFloat}, Point2{BigFloat}}, 2, 1, Vector{Point2{BigFloat}}})
   @ Base ./reinterpretarray.jl:36
 [3] connect
   @ ~/.julia/packages/GeometryBasics/l4gkj/src/viewtypes.jl:77 [inlined]
 [4] LineString(points::Vector{Point2{BigFloat}}, skip::Int64)
   @ GeometryBasics ~/.julia/packages/GeometryBasics/l4gkj/src/basic_types.jl:209
 [5] Polygon(exterior::Vector{Point2{BigFloat}}, skip::Int64)
   @ GeometryBasics ~/.julia/packages/GeometryBasics/l4gkj/src/basic_types.jl:275
 [6] top-level scope
   @ REPL[559]:1

Is there a possible workaround for this error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions