PaperMC / PaperMC/adventure

Allow hue in `HSVLike.hsvLike` to be outside the range of [0, 1]

Open
#930 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
887
Forks
160
PR merge metrics
No merged PRs in 30d

Description

As hue represents an angle on a cylinder, it makes sense to allow it to go outside the range - it should just loop back from the "other" side.
To make sure it'll not break much, HSVLike#h() still should return a value in the range. So, instead of checking if the value is in range, it should loop into it internally.
Like 11.3 should be transformed into 0.3, -1.8 into 0.2, etc.

It'd probably be better to also accept h in HSVLike.hsvLike as a double instead of float to make sure the imprecision is not as bad for larger values, but it feels a bit unnatural for it to accept h as double but then return it as float.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Locate HSVLike.hsvLike and HSVLike#h() in the Java sources and read their existing range validation and related tests. Update the hue behavior so values outside [0, 1] wrap into that range while preserving the requested API precision decision, then verify examples such as 11.3 → 0.3 and -1.8 → 0.2.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
computer-graphics
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.