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

Notes

The source muledge2d is expected to be ordered, continuous, and free from self-intersections before the closing edge is added.

Unused elsewhere in UPXO – not currently imported by any other module. The actively-used ring implementation is upxo.geoEntities.mulsline2d.ring2d (a same-named but unrelated class built on MSline2d segments rather than muledge2d); mind the name collision when importing.

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

Centroid of the ring.

Returns:

Centroid point delegated to the underlying muledge2d object.

Return type:

Point2d

property centroids

Centroids of all ring edges.

Returns:

Edge centroids from the source multi-edge with the closing-edge centroid appended.

Return type:

list

property lengths

Lengths of all ring edges.

Returns:

Edge lengths from the source multi-edge with the closing-edge length appended.

Return type:

list of float

property slopes

Slopes of all ring edges.

Returns:

Edge slopes from the source multi-edge with the closing-edge slope appended.

Return type:

list of float

property length

Total perimeter length of the ring.

Returns:

Sum of all source-edge lengths and the closing-edge length.

Return type:

float

property length_mean

Mean edge length of the ring.

Returns:

Arithmetic mean of all ring-edge lengths.

Return type:

float

property slope_mean

Mean slope, ignoring NaN and infinite values.

Returns:

Mean of masked-valid edge slopes.

Return type:

float

property slope_max_hiv

Maximum slope with vertical-edge handling.

Returns:

inf if any edge has infinite slope; otherwise the maximum slope value.

Return type:

float

property slope_max_hi

Masked finite slope statistic.

Returns:

Mean of slope values after masking invalid values.

Return type:

float

property slope_max_i

Mean of valid slopes.

Returns:

Mean of slope values after masking invalid values.

Return type:

float

property roughness

Roughness measure delegated to the underlying multi-edge.

Returns:

Roughness value returned by self.me.roughness.

Return type:

float

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 nodes from all constituent multi-edge segments.

Returns:

Nodes collected from the underlying multi-edge representation.

Return type:

list