> For the complete documentation index, see [llms.txt](https://primer2.dynamobim.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://primer2.dynamobim.org/ko/8_coding_in_dynamo/8-2_geometry-with-design-script/5-translation-rotation-and-other-transformations.md).

# 전환, 회전 및 기타 변환

3D 공간에서 x, y, z 좌표를 명시적으로 지정하여 특정 형상 객체를 작성할 수 있습니다. 하지만 대부분의 경우 객체 자체 또는 그 기반이 되는 좌표계에 기하 변환을 적용하여 객체를 최종 위치로 이동합니다.

### 이동

가장 간단한 기하학적 변환은 x, y, z 방향으로 지정된 단위 수만큼 객체를 이동하는 전환입니다.

![](https://2667946093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAwmgRXLSBgX48ttnIpHW%2Fuploads%2Fgit-blob-b3fbdeea901cdf5b8430956f3a4f033f5fd3dcda%2FTransformations_01.png?alt=media)

```js
// create a point at x = 1, y = 2, z = 3
p = Point.ByCoordinates(1, 2, 3);

// translate the point 10 units in the x direction,
// -20 in y, and 50 in z
// p2’s new position is x = 11, y = -18, z = 53
p2 = p.Translate(10, -20, 50);
```

### 회전

Dynamo의 모든 객체는 객체 이름 끝에 *.Translate* 메서드를 추가하여 이동할 수 있지만, 더 복잡한 변환을 수행하려면 객체의 기반 좌표계를 새로운 좌표계로 변환해야 합니다. 예를 들어, 객체를 x축을 중심으로 45도 회전하려면 *.Transform* 메서드를 사용하여 회전이 적용되지 않은 기존 좌표계에서 x축을 중심으로 45도 회전한 좌표계로 객체를 변환해야 합니다.

![](https://2667946093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAwmgRXLSBgX48ttnIpHW%2Fuploads%2Fgit-blob-05941a9d4a11a5f82c21c40f925a30c18d2f774f%2FTransformations_02.png?alt=media)

```js
cube = Cuboid.ByLengths(CoordinateSystem.Identity(),
    10, 10, 10);

new_cs = CoordinateSystem.Identity();
new_cs2 = new_cs.Rotate(Point.ByCoordinates(0, 0),
    Vector.ByCoordinates(1,0,0.5), 25);

// get the existing coordinate system of the cube
old_cs = CoordinateSystem.Identity();

cube2 = cube.Transform(old_cs, new_cs2);
```

### 축척

좌표계는 이동 및 회전할 수 있을 뿐만 아니라, 크기가 조정되거나 전단된 상태로 작성할 수도 있습니다. *.Scale* 메서드를 사용하여 좌표계의 크기를 조정할 수 있습니다.

![](https://2667946093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAwmgRXLSBgX48ttnIpHW%2Fuploads%2Fgit-blob-52832a10e557d02ce01b169f5ffe1a589846ac41%2FTransformations_03.png?alt=media)

```js
cube = Cuboid.ByLengths(CoordinateSystem.Identity(),
    10, 10, 10);

new_cs = CoordinateSystem.Identity();
new_cs2 = new_cs.Scale(20);

old_cs = CoordinateSystem.Identity();

cube2 = cube.Transform(old_cs, new_cs2);
```

전단된 좌표계는 직교하지 않는 벡터를 좌표계 생성자에 입력하여 작성합니다.

![](https://2667946093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAwmgRXLSBgX48ttnIpHW%2Fuploads%2Fgit-blob-c2e70c96c963f773934afdd77a41eac0118ab109%2FTransformations_04.png?alt=media)

```js
new_cs = CoordinateSystem.ByOriginVectors(
    Point.ByCoordinates(0, 0, 0),
	Vector.ByCoordinates(-1, -1, 1),
	Vector.ByCoordinates(-0.4, 0, 0));

old_cs = CoordinateSystem.Identity();

cube = Cuboid.ByLengths(CoordinateSystem.Identity(),
    5, 5, 5);

new_curves = cube.Transform(old_cs, new_cs);
```

축척 및 전단은 회전 및 변환보다 비교적 더 복잡한 기하학적 변환이므로 모든 Dynamo 객체가 이러한 변환을 거치는 것은 아닙니다. 다음 표에는 어떤 Dynamo 객체가 비균일하게 스케일링된 좌표계와 전단 좌표계를 사용할 수 있는지 정리되어 있습니다.

| 클래스          | 비균일하게 스케일링된 좌표계 | 전단된 좌표계 |
| ------------ | --------------- | ------- |
| 호            | 아니요             | 아니오     |
| NurbsCurve   | 예               | 예       |
| NurbsSurface | 아니요             | 아니오     |
| 원            | 아니요             | 아니오     |
| 선            | 예               | 예       |
| 평면           | 아니요             | 아니오     |
| 점            | 예               | 예       |
| 폴리곤          | 아니요             | 아니오     |
| 솔리드          | 아니요             | 아니오     |
| 표면           | 아니요             | 아니오     |
| 문자           | 아니요             | 아니요     |
