upxo.geoEntities.ring2d module

2D ring (closed loop of edges) geometric entity for UPXO.

Usage

from upxo.geoEntities.ring2d import ring2d

Classes

ring2d : Closed 2D polygon represented as a multi-edge loop with a closing edge.

Notes

A ring2d is formed from an ordered, continuous, non-self-intersecting muledge2d object by adding a closing edge between the last pntb and the first pnta of the multi-edge chain.

class upxo.geoEntities.ring2d.ring2d(me=None, dim=2, lean='ignore')[source]

Bases: object

Closed 2D polygon represented as a multi-edge loop with a closing edge.

A ring2d wraps a continuous, non-self-intersecting muledge2d and adds a synthetic closing edge from the last endpoint back to the first.

Entry points:

  • Bottom-up: from a muledge2d object.

  • Top-down: from a Crystal or Poly-crystal object.

  • Cross-library: from a Shapely ring object.

Usage

from upxo.geoEntities.ring2d import ring2d

EPS = 1e-12
me
dim
ce
ce_pindices
property centroid

Centroid of the ring, computed from the underlying multi-edge.

property centroids

List of edge centroids including the closing edge centroid.

property lengths

List of edge lengths including the closing edge length.

property slopes

List of edge slopes including the closing edge slope.

property length

Total perimeter length of the ring.

property length_mean

Mean edge length of the ring.

property slope_mean

Mean slope, ignoring NaN and infinite values.

property slope_max_hiv

Maximum slope; returns inf if any vertical edge is present.

property slope_max_hi

Maximum finite slope (masked invalid values).

property slope_max_i

Mean of valid slopes (masked invalid values).

property roughness

Roughness measure delegated to the underlying multi-edge.

property angles

Orientation angles of all edges in the ring, including the closing edge.

Returns:

Angles in degrees for each edge, in chain order with the closing edge appended last.

Return type:

list of float

lean
property nodes

Cumulative list of all nodes from all constituent multi-edge segments.