upxo.geoEntities.bases module

Abstract base classes for UPXO geometric entities.

Usage

from upxo.geoEntities.bases import UPXO_Point, UPXO_Edge

Classes

UPXO_Point : Abstract base class for 2D and 3D point objects. UPXO_Edge : Abstract base class for 2D and 3D edge objects.

Notes

Concrete implementations (e.g., point2d, edge2d) must override all abstract methods. The base classes define the common interface contract only and carry no executable logic.

class upxo.geoEntities.bases.UPXO_Point(x=0.0, y=0.0, pln='ij')[source]

Bases: ABC

Abstract base class for UPXO point entities.

Defines the minimum interface that all concrete 2D and 3D point implementations must satisfy.

x
Type:

float

y
Type:

float

pln

Plane identifier (e.g. 'ij').

Type:

str

f

Reserved for future use.

Type:

object

abstractmethod add(distances, update=True, throw=False, mydecatlen2NUM='taxx')[source]

Translate this point by the given distances.

abstractmethod distance(plist=None)[source]

Calculate the EUclidean distance between self and list of points.

x
y
pln
f
class upxo.geoEntities.bases.UPXO_Edge[source]

Bases: ABC

Abstract base class for UPXO edge (line segment) entities.

Defines the common interface contract for all concrete 2D and 3D edge implementations. Subclasses store their start and end point references as i and j.

i

Start point of the edge.

Type:

object

j

End point of the edge.

Type:

object

abstract property mid

Unique identifier (e.g. Python id) of this edge object.

abstract property ang

Orientation angle of the edge in degrees.

abstract property length

Euclidean length of the edge.

classmethod by_coord(start_point, end_point)[source]

Construct an edge from two coordinate pairs or point objects.

classmethod by_loc_len_ang(*, ref='i', loc=[0, 0, 0], length=1, ang=0, degree=True)[source]

Construct an edge from a reference point, length, and angle.

abstractmethod distance_to_points(*, plist=None)[source]

Calculate distances from this edge to a list of points.

abstractmethod distance_to_edges(*, elist=None, method='ref', refi='mid', refj='mid')[source]

Calculate distances from this edge to a list of other edges.

abstractmethod translate_by(*, vector=None, dist=None, update=False, throw=True)[source]

Translate this edge by a displacement vector or scalar distance.

abstractmethod translate_to(*, ref='i', point=None, update=False, throw=True)[source]

Translate this edge so that the reference endpoint lands on point.

abstractmethod rotate_about(*, axis=None, angle=0, degree=True, update=False, throw=True)[source]

Rotate this edge about an axis by the given angle.

abstractmethod attach_mp(*, mp=None, name=None)[source]

Attach a material-property object to this edge under name.

abstractmethod attach_xtal(*, xtals=None)[source]

Associate crystal objects with this edge.

abstractmethod find_neigh_point_by_distance(*, plist=None, plane='xy', r=0)[source]

Find all points within radius r of this edge.

abstractmethod find_neigh_point_by_count(*, plist=None, n=None, plane='xy')[source]

Find the n nearest points to this edge.

abstractmethod find_neigh_mulpoint_by_distance(*, mplist=None, plane='xy', r=0, tolf=-1)[source]

Find all mulpoint objects within radius r of this edge.

abstractmethod find_neigh_edge_by_distance(*, elist=None, plane='xy', refloc='starting', r=0)[source]

Find all edges whose reference location is within radius r.

abstractmethod find_neigh_muledge_by_distance(*, melist=None, plane='xy', refloc='starting', r=0)[source]

Find all muledge objects within radius r.

abstractmethod find_neigh_xtal_by_distance(*, xlist=None, plane='xy', refloc='starting', r=0)[source]

Find all crystal objects within radius r of this edge.

abstractmethod set_gmsh_props(prop_dict)[source]

Attach GMSH mesh properties to this edge.

abstractmethod make_shapely()[source]

Return a Shapely geometry object for this edge.

abstractmethod make_vtk()[source]

Return a VTK geometry object for this edge.

abstract property coords

Endpoint coordinates as a NumPy array.

abstractmethod array_translation(*, ncopies=10, vector=[[0, 0, 0], [0, 0, 1]], spacing='constant')[source]

Generate an array of translated copies of this edge.

abstractmethod lies_on_which_edge(*, elist=None, consider_ends=True)[source]

Determine which edges from elist this edge lies on.

i
j
abstractmethod lies_in_which_xtal(*, xlist=None, cosider_boundary=True, consider_boundary_ends=True)[source]

Determine which crystal from xlist contains this edge.