processing / processing/processing4
Add toroidal wrap function
未关闭
还没有人认领这个 Issue。
- 主要语言
- Java
- 星标
- 494
- 派生
- 183
- 平均合并
- 4 小时 39 分钟
- 30 天内合并 PR
- 3
描述
Relevant sub-area for this feature?
Math
Feature details
Feature description
In many programs a value starts again at zero if it gets larger than a max value or appears at max value when it goes below zero. Provide a function that does the wrapping as a single function.
/**
* Wraps a value at 0 and max to constrain value between zero and max.
* @param value The value to wrap
* @param max The maximum value (excluded)
* @return The toroidally wrapped value
float wrap(float value, float max) {
if (value < 0) {
return value + max;
} else if (value >= max) {
return value - max;
}
return value;
}
Benefits
This would reduce code sizes and make these toroidal worlds easier to understand.
Would you like to help implement this feature?
Yes, I’d like to help with this
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先定位 Processing 核心库中现有的数学入口点以及任何相关的 wrap 逻辑。定义 issue 中描述的环面 wrap 函数,然后为小于零的值、大于或等于最大值的值,以及已经处于范围内的值添加或更新测试覆盖率。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java
- 领域
- api
- Issue 类型
- 功能
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100