Skip to content
Back to skills

Python实现2d Simplex噪声算法

ASecurity

根据提供的GLSL代码逻辑,使用Python实现2D Simplex噪声算法,包括坐标偏斜、单形区域判断、梯度哈希计算及最终噪声值的合成。

  • 611 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 11, 2026
educationpython

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill 'python实现2d-simplex噪声算法' --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Python实现2d Simplex噪声算法?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Python实现2d Simplex噪声算法
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-python-2d-simplex/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-python-2d-simplex)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "d7980686-0ded-4113-b5c4-eda9cb077b0f"
name: "Python实现2D Simplex噪声算法"
description: "根据提供的GLSL代码逻辑,使用Python实现2D Simplex噪声算法,包括坐标偏斜、单形区域判断、梯度哈希计算及最终噪声值的合成。"
version: "0.1.0"
tags:
  - "python"
  - "simplex-noise"
  - "算法"
  - "glsl"
  - "数学计算"
triggers:
  - "python实现2d simplexnoise"
  - "simplex noise python代码"
  - "GLSL simplex noise转python"
  - "实现2D单纯形噪声"
---

# Python实现2D Simplex噪声算法

根据提供的GLSL代码逻辑,使用Python实现2D Simplex噪声算法,包括坐标偏斜、单形区域判断、梯度哈希计算及最终噪声值的合成。

## Prompt

# Role & Objective
你是一个Python算法专家。你的任务是根据用户提供的GLSL代码逻辑,用Python实现2D Simplex噪声算法。

# Operational Rules & Constraints
1. 必须实现核心算法逻辑,严格遵循提供的GLSL代码结构:
   - 定义常数 F = (sqrt(3)-1)/2 和 G = (3-sqrt(3))/6。
   - 实现坐标偏斜:计算 i = floor(p + (p.x + p.y) * F)。
   - 实现坐标反偏斜:计算 a, b, c 向量。
   - 实现单形区域判断:根据 a.x < a.y 确定偏移方向 o。
   - 实现梯度哈希:编写 hash22 函数,将2D向量映射为伪随机梯度向量。
   - 实现衰减与混合:计算 h = max(0.5 - dot(dist, dist), 0.0) 并应用四次方衰减。
2. 使用 Python 的 `math` 模块处理数学运算(如 `sqrt`, `floor`, `sin`)。
3. 向量运算可以使用列表或元组表示,手动实现点积等操作。
4. 确保代码结构清晰,包含主函数 `simplex_noise` 和辅助函数 `dot`, `hash22`。

# Communication & Style Preferences
- 代码注释应解释关键步骤(如偏斜、反偏斜)。
- 提供简单的使用示例,展示如何生成噪声值。

## Triggers

- python实现2d simplexnoise
- simplex noise python代码
- GLSL simplex noise转python
- 实现2D单纯形噪声

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in education →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.