---
title: "Point"
description: "A 2D point with x and y coordinates."
canonical_url: "https://www.rosette.dev/docs/api-reference/Point"
markdown_url: "https://www.rosette.dev/docs/api-reference/Point.md"
source_url: "https://github.com/PreFab-Photonics/rosette/blob/f086d7670645fd36c05362d696d442a2b2e74850/www/content/docs/api-reference/Point.mdx"
docs_channel: "main"
docs_revision: "f086d7670645fd36c05362d696d442a2b2e74850"
---

# Point

A 2D point with x and y coordinates.

Points represent positions in the layout plane. They are the fundamental
coordinate type used throughout Rosette for specifying polygon vertices,
port locations, and transform targets. Points are immutable -- all
transformation methods return new Point instances.

```python
p = Point(10, 20)
q = Point.origin()
d = p.distance_to(q)  # 22.36...

# Translate by a vector
moved = p.translate(Vector2(5, 0))  # Point(15, 20)
```

## Attributes



### `x`

```python
x: float
```

X coordinate.





### `y`

```python
y: float
```

Y coordinate.



## Methods



### `__init__`

```python
__init__(x=0.0, y=0.0) -> None
```

Create a new point.



- **`x`** (`float`, default `0.0`)

  X coordinate.





- **`y`** (`float`, default `0.0`)

  Y coordinate.





**Returns:** `None`





### `origin`

```python
origin() -> Point
```

Create a point at the origin `(0, 0)`. This is a static method.

```python
p = Point.origin()  # Point(0.0, 0.0)
```



**Returns:** `Point`





### `distance_to`

```python
distance_to(other) -> float
```

Compute the Euclidean distance to another point.



- **`other`** (`Point`)

  The other point.





**Returns:** `float`

Distance between the two points.





### `translate`

```python
translate(v) -> Point
```

Return a new point translated by a vector.



- **`v`** (`Vector2`)

  Translation vector.





**Returns:** `Point`

A new translated point.





### `rotate`

```python
rotate(angle_deg) -> Point
```

Rotate the point around the origin by the given angle.



- **`angle_deg`** (`float`)

  Rotation angle in degrees (counter-clockwise).





**Returns:** `Point`

A new rotated point.





### `rotate_around`

```python
rotate_around(center, angle_deg) -> Point
```

Rotate the point around an arbitrary center point.



- **`center`** (`Point`)

  Center of rotation.





- **`angle_deg`** (`float`)

  Rotation angle in degrees (counter-clockwise).





**Returns:** `Point`

A new rotated point.



## Supported operations

**Addition**: `point + vector` returns a new `Point` offset by the vector. Equivalent to `point.translate(vector)`.

```python
Point(1, 2) + Vector2(3, 4)  # Point(4, 6)
```

**Subtraction**: `point - point` returns a `Vector2` representing the displacement from the right-hand point to the left-hand point.

```python
Point(5, 7) - Point(1, 2)  # Vector2(4, 5)
```