src.loc.vertex.vertex module

class Vertex(x: float, y: float, v_id: int | None = None)[source]

Bases: object

Represents a vertex, or a point in 2D space, typically a corner of a geometric shape.

x

The x-coordinate of the vertex.

Type:

float

y

The y-coordinate of the vertex.

Type:

float

xy

A list containing the x and y coordinates of the vertex.

Type:

list[float]

v_id

An optional identifier for the vertex.

Type:

int, optional

Parameters:
  • x (float) – The x-coordinate of the vertex upon initialization.

  • y (float) – The y-coordinate of the vertex upon initialization.

  • v_id (int or None, optional) – An optional identifier for the vertex, by default None.

get_xy() list[float][source]

Get the x and y coordinates of the vertex.

Returns:

A list containing the x and y coordinates of the vertex.

Return type:

list[float]

get_y() float[source]

Get the y-coordinate of the vertex.

Returns:

The y-coordinate of the vertex.

Return type:

float

get_x() float[source]

Get the x-coordinate of the vertex.

Returns:

The x-coordinate of the vertex.

Return type:

float

set_x(newx: float) None[source]

Set the x-coordinate of the vertex.

Parameters:

newx (float) – The new x-coordinate to be set for the vertex.

set_y(newy: float) None[source]

Set the y-coordinate of the vertex.

Parameters:

newy (float) – The new y-coordinate to be set for the vertex.

get_vid() int | None[source]

Retrieve the identifier of the vertex, if it exists.

Returns:

The identifier of the vertex, or None if not set.

Return type:

int or None