Facet#

class planestress.pre.geometry.Facet(pt1: Point, pt2: Point)[source]#

Bases: object

Class describing a facet of a 2D geometry, i.e. an edge.

Parameters:
  • pt1 (Point) – First point in the facet.

  • pt2 (Point) – Second point in the facet.

  • poly_idx – Polygon index.

  • loop_idx – Loop index.

Variables:

idx (int) – Facet index.

Methods

to_shapely_line

Converts the line to a shapely Line object.

to_tuple

Converts the facet to a tuple.

update_point

If the facet contains the point old, replace with new.

zero_length

Tests whether or not a facet is zero length.

Attributes

pt1

pt2

idx

to_tuple() tuple[float, float][source]#

Converts the facet to a tuple.

Raises:

RuntimeError – If a point in the facet hasn’t been assigned an index.

Returns:

Facet in tuple format (pt1_idx, pt2_idx).

Return type:

tuple[float, float]

to_shapely_line() LineString[source]#

Converts the line to a shapely Line object.

Returns:

Facet as a shapely.LineString.

Return type:

LineString

zero_length() bool[source]#

Tests whether or not a facet is zero length.

Returns:

True if the facet has zero length (i.e. pt1 == pt2).

Return type:

bool

update_point(old: Point, new: Point) None[source]#

If the facet contains the point old, replace with new.

Parameters:
  • old (Point) – Old Point to replace.

  • new (Point) – Point to replace old with.