Module 4 — Transformations và Pattern
Thời lượng: ~5 giờ · Độ khó: Trung bình
Mục tiêu: Nắm toàn bộ các phép biến đổi trong GH và tạo được pattern kiến trúc phức tạp từ logic đơn giản.
4.1 — Transform Components trong GH
Move
Move: Geometry + Translation Vector → Geometry đã dịch chuyển
Tạo mảng theo hướng X:
Series (0, Spacing, Count) → X positions
Construct Point (X, 0, 0) → list of points
Vector 2Pt (Origin, Points) → list of vectors
Move (Geometry, Vectors) → mảng theo X
Rotate
Rotate: Geometry + Angle (radians) + Plane → Geometry đã xoay
Radians vs Degrees:
GH dùng radians!
Pi/2 = 90°, Pi = 180°, 2*Pi = 360°
Chuyển đổi: Radians (angle_degrees) → radians
Hoặc: degree * Pi / 180 trong Expression
Rotate 3D: Geometry + Axis + Angle → xoay quanh trục bất kỳ
Scale
Scale: Geometry + Center + Scale Factor → phóng to/thu nhỏ đều
Scale NU: Geometry + Center + X,Y,Z factors → scale không đều
Mirror
Mirror: Geometry + Plane → đối xứng qua plane
Ví dụ: mirror qua YZ plane (X=0):
YZ Plane component → Mirror
4.2 — Rectangular Grid Pattern
Cách 1: Cross Reference
Series X (0, spacing_x, count_x)
Series Y (0, spacing_y, count_y)
Cross Reference → tất cả cặp (Xi, Yj) → grid points
Construct Point (X, Y, 0) → grid
Cách 2: Rectangular Grid component (nhanh hơn)
Rectangular Grid (Plane, Size X, Size Y, Count X, Count Y)
→ Cells + Points trực tiếp
Từ Grid đến Pattern
Grid Points → Box (tại mỗi điểm, cùng kích thước) → mảng hộp đều nhau
Biến thể: Scale mỗi Box theo index → hiệu ứng gradient
4.3 — Hexagonal Grid Pattern
Hexagonal Grid (Plane, Size, Count X, Count Y)
→ Cells (hexagons) + Centers
Tạo hex panel:
Cells → individual hexagons
Area → centers
Scale (hexagon, 0.9, center) → thu nhỏ 10% → khe hở giữa panels
4.4 — Populate Geometry
Populate 2D: Surface + Count + Seed → random points trên surface
Populate 3D: Box + Count + Seed → random points trong không gian
Populate Geometry: Mesh + Count + Seed → random points trên mesh surface
Ứng dụng: scattered/random placement (cây, cột, điểm phân tích)
4.5 — Orient
Orient là biến đổi mạnh nhất — mapping toàn bộ hệ tọa độ từ mặt phẳng A sang mặt phẳng B:
Orient:
Input: Geometry + Source Plane (A) + Target Plane (B)
→ Tất cả transforms (translate + rotate + scale) cần thiết để mapping A→B
Workflow "panel trên surface":
1. Tạo panel flat tại XY Plane (gốc tọa độ)
2. Divide Surface → Surface Frames (local planes)
3. Orient (Panel, XY Plane, Surface Frame)
→ Mỗi Surface Frame = 1 copy panel orientated đúng hướng
Hình minh họa
[Ảnh: Panel flat tại gốc → Orient theo 16 surface frames trên dome → 16 panels dựng đứng]
4.6 — Array theo Curve
Divide Curve (curve, N) → N+1 points + Parameters
Evaluate Curve (curve, Parameters) → Points + Tangent Vectors
Curve Frame (curve, Parameters) → local Planes
Orient (element, XY Plane, Curve Frames)
→ N copies dọc theo curve, mỗi copy xoay theo hướng curve tại điểm đó
4.7 — Biến Đổi theo Index
Tạo pattern thay đổi theo vị trí:
List Index → Series (0, 1, count) → index values
Remap Numbers (index domain, target domain) → normalized values [0,1]
Hoặc: Expression (x / max_index) → normalized [0,1]
Scale mỗi element với normalized value:
index 0 → scale 0.2 (nhỏ nhất)
index N → scale 1.0 (lớn nhất)
→ Gradient từ nhỏ đến lớn
Bài Tập Module 4 — Facade với Cửa Sổ Xoay
Đề bài: Mặt đứng 10m × 8m với 6×4 = 24 cửa sổ, mỗi cửa sổ xoay theo vị trí.
Setup:
1. Facade surface: Rectangle 10000 × 8000 → ExtrudeSrf 200mm
2. Divide Surface (U=6, V=4) → 24 panel centers + frames
3. Panel cửa sổ tại XY Plane: Rectangle 1200 × 1000mm
Transformation:
4. Series (0, 1, 24) → indices 0→23
5. Remap (domain 0..23, target 0..Pi) → angle 0 → 180° (radians)
6. Rotate (window panel, angle, XY Plane) → từng cửa sổ xoay khác nhau
Orient:
7. Orient (rotated window, XY Plane, Surface Frame)
→ Windows đứng trên mặt đứng, mỗi cái xoay theo index
Kiểm tra:
8. Panel text: "Cửa sổ #{Index}: xoay {Angle}°"
9. Bake → xem trong Rhino
Liên kết kiến thức
Nền tảng cần nắm
Chủ đề liên quan