← 返回函数库

r

Transformations Scope 已实现

CityEngine 官方语法

r(rx, ry, rz)

参数说明

参数类型默认值说明
rx, ry, rzfloat绕 scope X/Y/Z 轴的旋转角度(度)。

描述

旋转当前形状的 scope。r 是 rotateScope 的缩写形式(但官方中 r 与 rotateScope 略有不同,r 旋转 scope 和几何体,rotateScope 仅旋转 scope 轴)。在 CGA.js 中,r 实现为旋转几何体和 scope。

角度单位为度数,不是弧度。旋转顺序为 X → Y → Z。

官方示例

绕 Y 轴旋转 45°:

Mass --> r(0, 45, 0) Rotated

实现说明

CGA.js 中的 r 实现基于 CityEngine 2025.1 官方文档。

🎨 3D 预览 — 旋转

@StartRule\nLot --> primitiveCube(4, 4, 4)\n        r(0, 45, 0)\n        color(1, 0.5, 0.5)