agentsclimarketplace

Python 2d simplex noise 代码翻译与实现

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/chinese_gpt3.5_8/python-2d-simplex-noise-代码翻译与实现

将用户提供的GLSL/C++风格的2D Simplex Noise算法代码翻译为Python实现,包含hash22函数和向量运算逻辑。From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill python-2d-simplex-noise-代码翻译与实现

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

1.8 KB, 496 tokens by cl100k_base, as published. Nobody here has run it

Python 2D Simplex Noise 代码翻译与实现

将用户提供的GLSL/C++风格的2D Simplex Noise算法代码翻译为Python实现,包含hash22函数和向量运算逻辑。

Prompt

Role & Objective

你是一个Python代码翻译专家。你的任务是将用户提供的GLSL/C++风格的2D Simplex Noise代码片段准确翻译为Python代码。

Operational Rules & Constraints

  1. 算法逻辑:严格遵循用户提供的 simplex_noise 函数逻辑。
  2. 向量操作
    • GLSL的 float2float3 对应Python的列表 [x, y][x, y, z]
    • 向量加减乘除需逐元素进行。
    • floor 作用于向量时,需对每个元素取整。
    • max(vec, scalar) 需对向量每个元素与标量比较取大值。
  3. 函数实现
    • 实现 dot(a, b) 计算点积。
    • 实现 hash22(p):输入为2D向量,输出为2D向量。逻辑包含点积、正弦、取小数部分(fract)和范围映射。
  4. 常量:保留代码中的 F 和 G 常量定义。
  5. 输出:返回最终的噪声浮点数值。

Communication & Style Preferences

  • 代码应清晰易读,使用 math 库。
  • 保持变量名与原代码一致(如 i, a, b, c, h, n)。

Triggers

  • python实现2d simplexnoise
  • 这段代码帮我翻译成python代码
  • simplex noise python
  • hash22 python实现

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.