新闻详情

新闻详情

首页 / 资讯中心 / 详情

彭罗斯非周期镶嵌(Penrose Tiling):Canvas 五次对称生成艺术

发布时间:2026/11/18 1:37:44来源:尧图网络
彭罗斯非周期镶嵌(Penrose Tiling):Canvas 五次对称生成艺术
在 1974 年之前经典晶体学与几何学界公认一条铁律“任何能够无缝铺满平面的二维密铺瓷砖在数学上必定具备平移周期性Periodic Translation且其旋转对称性只能是 2、3、4 或 6 重对称绝对不可能存在 5 重旋转对称性Fivefold Symmetry”然而英国著名数学物理学家、诺贝尔物理学奖得主罗杰·彭罗斯Roger Penrose以惊世骇俗的数学洞察彻底推翻了这一定论。他仅仅凭借两块极其简单的菱形瓷砖厚菱形 Fat Rhombus与薄菱形 Thin Rhombus菱形的内角全部由黄金分割比$\Phi \frac{1\sqrt{5}}{2} \approx 1.618$与五角星几何严格决定$72^\circ/108^\circ$ 与 $36^\circ/144^\circ$按照特定的匹配规则无缝铺满整个二维平面时令人震撼的几何奇迹发生了整张平面在局部呈现出完美的五次旋转对称性如五角星与十边形结构但在整体上无论你沿着哪个方向平移多远整幅铺砖图案在数学上永远绝不重复非周期性 Aperiodic Tiling彭罗斯镶嵌后来直接启发了物理学家丹·谢赫特曼Dan Shechtman发现了自然界中的“准晶体Quasicrystals”并因此荣获 2011 年诺贝尔化学奖。在生成艺术领域彭罗斯镶嵌是纯粹几何逻辑与神圣几何秩序最完美的结晶。本文将深入推导彭罗斯 P3 菱形镶嵌的Robinson 黄金三角形递归细分算法Deflation Algorithm并在 HTML5 Canvas 中手写一个带有高阶色阶渐变的彭罗斯生成艺术画卷。Robinson 黄金三角形递归细分Deflation代数推导为了在计算机中严密且高效地生成任意大尺寸的彭罗斯镶嵌直接使用“搭积木试凑法”会导致组合爆炸最优雅的算法是将铺砖问题转化为两种 Robinson 黄金等腰三角形的递归分裂细分Deflation┌─────────────────────────────────────────────────────────┐ │ Robinson 黄金三角形分类 │ └────────────────────────────┬────────────────────────────┘ │ ┌──────────────────────────────────────┴──────────────────────────────────────┐ ▼ 黄金大三角形 (Type A / 顶角 108°, 底角 36°) ▼ 黄金小三角形 (Type B / 顶角 36°, 底角 72°) ┌─────────────────────────────────────────────────────────────┐ ┌─────────────────────────────────────────────────────────────┐ │ 细分规则 (Deflation): │ │ 细分规则 (Deflation): │ │ 1 个大三角形 A 裂变分解为: │ │ 1 个小三角形 B 裂变分解为: │ │ - 1 个新的小尺度大三角形 A │ │ - 1 个小尺度大三角形 A │ │ - 1 个新的小尺度小三角形 B │ │ - 1 个小尺度小三角形 B │ └─────────────────────────────────────────────────────────────┘ └─────────────────────────────────────────────────────────────┘细分内分点坐标黄金比例计算公式设三角形三顶点为 $\mathbf{A}, \mathbf{B}, \mathbf{C}$。对于大三角形 A$\angle A 108^\circ, AB AC$在边 $BC$ 上取黄金内分点 $\mathbf{P}$$$\mathbf{P} \mathbf{A} \frac{1}{\Phi} (\mathbf{B} - \mathbf{A})$$三角形分裂为 $\triangle C P A$新的大三角形与 $\triangle C P B$新的小三角形对于小三角形 B$\angle A 36^\circ, AB AC$在边 $AB$ 上取内分点 $\mathbf{Q} \mathbf{A} \frac{1}{\Phi}(\mathbf{B} - \mathbf{A})$分裂为 $\triangle B Q C$大三角形与 $\triangle A Q C$小三角形。经过 $N$ 轮递归细分后两两相邻的黄金三角形自动拼接组合完美自发涌现出厚薄彭罗斯菱形非周期镶嵌纯 TypeScript 彭罗斯三角形递归细分引擎// penrose-tiling-engine.ts export interface Point2D { x: number; y: number; } export type TriangleType 0 | 1; // 0: 黄金大三角形(Type A), 1: 黄金小三角形(Type B) export interface GoldenTriangle { type: TriangleType; a: Point2D; b: Point2D; c: Point2D; } export class PenroseTilingEngine { private static PHI (1 Math.sqrt(5)) / 2; // 黄金比例 ≈ 1.6180339887 // 1. 生成初始的 10 个黄金三角形 (形成初始正十边形轮廓) public static generateInitialSun(cx: number, cy: number, radius: number): GoldenTriangle[] { const triangles: GoldenTriangle[] []; const center { x: cx, y: cy }; for (let i 0; i 10; i) { const angle1 ((2 * i - 1) * Math.PI) / 10; const angle2 ((2 * i 1) * Math.PI) / 10; const p1: Point2D { x: cx radius * Math.cos(angle1), y: cy radius * Math.sin(angle1) }; const p2: Point2D { x: cx radius * Math.cos(angle2), y: cy radius * Math.sin(angle2) }; if (i % 2 0) { triangles.push({ type: 0, a: center, b: p1, c: p2 }); } else { triangles.push({ type: 0, a: center, b: p2, c: p1 }); } } return triangles; } // 2. 核心单轮递归细分 (Deflation Step) public static deflate(triangles: GoldenTriangle[]): GoldenTriangle[] { const nextGeneration: GoldenTriangle[] []; for (const tri of triangles) { const { a, b, c, type } tri; if (type 0) { // 大三角形 A 分解 const p: Point2D { x: a.x (b.x - a.x) / this.PHI, y: a.y (b.y - a.y) / this.PHI, }; nextGeneration.push({ type: 0, a: c, b: p, c: b }); nextGeneration.push({ type: 1, a: p, b: c, c: a }); } else { // 小三角形 B 分解 const q: Point2D { x: b.x (a.x - b.x) / this.PHI, y: b.y (a.y - b.y) / this.PHI, }; const r: Point2D { x: b.x (c.x - b.x) / this.PHI, y: b.y (c.y - b.y) / this.PHI, }; nextGeneration.push({ type: 1, a: r, b: c, c: a }); nextGeneration.push({ type: 0, a: q, b: r, c: b }); nextGeneration.push({ type: 1, a: r, b: q, c: a }); } } return nextGeneration; } }Canvas 先锋彭罗斯镶嵌画卷渲染// penrose-canvas-stage.ts export class PenroseCanvasStage { private canvas: HTMLCanvasElement; private ctx: CanvasRenderingContext2D; constructor(canvas: HTMLCanvasElement) { this.canvas canvas; this.ctx canvas.getContext(2d)!; } public renderTiling(depth 5) { const w this.canvas.width; const h this.canvas.height; const cx w / 2; const cy h / 2; this.ctx.fillStyle #05070d; this.ctx.fillRect(0, 0, w, h); // 1. 初始化正十边形太阳轮廓 let triangles PenroseTilingEngine.generateInitialSun(cx, cy, Math.max(w, h) * 0.75); // 2. 迭代递归细分 depth 次 for (let i 0; i depth; i) { triangles PenroseTilingEngine.deflate(triangles); } // 3. 渲染几何菱形铺砖 this.ctx.lineWidth 1.0; this.ctx.strokeStyle #05070d; // 砖缝黑色描边 for (const tri of triangles) { this.ctx.beginPath(); this.ctx.moveTo(tri.a.x, tri.a.y); this.ctx.lineTo(tri.b.x, tri.b.y); this.ctx.lineTo(tri.c.x, tri.c.y); this.ctx.closePath(); // 根据三角形类型赋予先锋蓝紫撞色 if (tri.type 0) { this.ctx.fillStyle rgba(79, 70, 229, 0.85); // 黄金大三角: 沉稳极夜蓝 } else { this.ctx.fillStyle rgba(236, 72, 153, 0.85); // 黄金小三角: 鲜亮霓虹玫红 } this.ctx.fill(); this.ctx.stroke(); } } }总结彭罗斯非周期镶嵌是纯粹数学在对称性与无限性之间架起的最辉煌桥梁。通过黄金三角形的分裂细分代数模型我们在 Canvas 上以纯代码见证了五次旋转对称与永不重复的非周期秩序相互交织的宇宙奇景为先锋数字生成艺术赋予了源自诺贝尔级几何哲学的至高神圣之美。
网站建设高端定制企业官网
RELATED

相关资讯

更多精彩内容,欢迎继续阅读

较早相关资讯

最新相关资讯

【外设】之大彩串口显示屏 2026/11/17 7:04:08

【外设】之大彩串口显示屏

大彩串口屏初步使用 1 .官网下载 STM32 屏幕 GUI 设计资料 http://www.gz-dc.com/category/typeid/4112 找到 STM32 Keil 工程,移植相关代码因项目而异进行移植,由于项目简单,本人只对用到的指令接口进行修改。 比如:注意事项&…

阅读更多 →
无法下载Windows系统iso文件 2026/11/17 5:42:44

无法下载Windows系统iso文件

当我遇到这个问题的时候,我打开了一个网站: 登录 然后我打算下载的时候: 突然那个官方的连接就可以下载了:

阅读更多 →
【清华代码熊】DeepSeek V4.1 Flash 后训练详解 2026/11/17 19:43:34

【清华代码熊】DeepSeek V4.1 Flash 后训练详解

📌 上期解析了 DeepSeek V4.1 Flash 模型架构改进,本期解析 DeepSeek V4.1 Flash 预训练/后训练技术: 🌟 预训练:45T 文本 多模态混合语料、直接训练 sparse attention(取消 DeepSeek V4 的 dense 冷启动&…

阅读更多 →
Shuffle-R1: Efficient RL framework for Multimodal Large Language Models via Data-centric Dynamic ... 2026/11/17 6:55:04

Shuffle-R1: Efficient RL framework for Multimodal Large Language Models via Data-centric Dynamic ...

文章主要内容和创新点 主要内容 本文聚焦于多模态大语言模型(MLLM)强化学习(RL)训练中的效率问题,提出了一个名为Shuffle-R1的框架。研究发现,当前RL训练存在两个关键缺陷: 优势值坍缩(Advantage Collapsing):批次中大多数优势值集中在零附近,导致有效梯度信号被淹…

阅读更多 →
PRvL: Quantifying the Capabilities and Risks of Large Language Models for PII Redaction 2026/11/17 5:57:47

PRvL: Quantifying the Capabilities and Risks of Large Language Models for PII Redaction

一、文章主要内容总结 本文聚焦于利用大型语言模型(LLMs)实现个人身份信息(PII)脱敏的研究,旨在解决传统脱敏方法(如基于规则的系统、领域特定命名实体识别(NER)模型)泛化能力差、跨格式/跨语境适应性弱的问题。 研究通过全面评估多种LLM架构(包括密集型LLM(D-LLM…

阅读更多 →
LLaVA-RE: Binary Image-Text Relevancy Evaluation with Multimodal Large Language Model 2026/11/17 19:43:32

LLaVA-RE: Binary Image-Text Relevancy Evaluation with Multimodal Large Language Model

文章主要内容和创新点 主要内容 本文聚焦于二进制图像-文本相关性评估任务(判断图像与文本“相关”或“不相关”),针对该任务中文本格式多样、相关性定义随场景变化等挑战,提出了基于多模态大语言模型(MLLM)的解决方案LLaVA-RE。 模型设计:LLaVA-RE基于LLaVA 1.5架构,…

阅读更多 →

今日资讯

本周资讯

本月资讯

看完文章仍有疑问?

联系尧图顾问,获取一对一建站咨询

立即免费咨询 📞 400-888-8888
📞 ✉