JuliaGeometry / JuliaGeometry/GeometryBasics.jl
Consider changing internal representation of Rect for more float safety
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 215
- Forks
- 64
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 2
Description
Using origins and widths means that all the vertices except for origin have (potential for) float precision issues. For example, if we wanted a (Float32) Rect from -1f10 to 500 we would instead get:
julia> Point2f(-1f10) + (Point2f(500) - Point2f(-1f10))
2-element Point{2, Float32} with indices SOneTo(2):
0.0
0.0
julia> coordinates(Rect2f([Point2f(-1f10), Point2f(500)]))
4-element Vector{Point{2, Float32}}:
[-1.0f10, -1.0f10]
[0.0, -1.0f10]
[0.0, 0.0]
[-1.0f10, 0.0]
because eps(-1f10) = 1024f0 can not resolve 500.
For reference, I hit this here: https://github.com/MakieOrg/Makie.jl/pull/4911
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the Rect representation and the coordinates(Rect2f) behavior shown in the issue, then reproduce the Point2f Float32 example. Compare candidate representations against the -1f10-to-500 case; done means Rect vertices retain the intended values without the reported precision loss.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- computer-graphics
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100