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:
ABCAbstract base class for UPXO point entities.
Defines the minimum interface that all concrete 2D and 3D point implementations must satisfy.
Notes
Concrete subclasses must provide all geometric operations declared by this abstract interface.
- abstractmethod add(distances, update=True, throw=False, mydecatlen2NUM='taxx')[source]
Translate this point by the given distances.
- Parameters:
distances (object) – Translation distance specification accepted by the concrete class.
update (bool, optional) – Whether to update this object in place.
throw (bool, optional) – Whether to return generated point objects.
mydecatlen2NUM (str, optional) – Data-type handling mode used by concrete implementations.
- Returns:
Return value defined by the concrete point class.
- Return type:
- abstractmethod distance(plist=None)[source]
Calculate Euclidean distances from this point to other points.
- x
- y
- pln
- f
- class upxo.geoEntities.bases.UPXO_Edge[source]
Bases:
ABCAbstract 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
iandj.Notes
Concrete subclasses are responsible for deciding whether calculations are performed in 2D, 3D, or projected coordinates.
- abstract property mid
Unique identifier of this edge object.
- Returns:
Identifier supplied by the concrete edge class.
- Return type:
- abstract property ang
Orientation angle of the edge.
- Returns:
Edge orientation angle in degrees.
- Return type:
- 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.
- Parameters:
- Returns:
Concrete edge instance.
- Return type:
- 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.
- Parameters:
- Returns:
Distance result supplied by the concrete edge class.
- Return type:
- abstractmethod translate_by(*, vector=None, dist=None, update=False, throw=True)[source]
Translate this edge by a displacement vector or scalar distance.
- Parameters:
- Returns:
Return value supplied by the concrete edge class.
- Return type:
- abstractmethod translate_to(*, ref='i', point=None, update=False, throw=True)[source]
Translate this edge so the reference endpoint lands on
point.- Parameters:
- Returns:
Return value supplied by the concrete edge class.
- Return type:
- abstractmethod rotate_about(*, axis=None, angle=0, degree=True, update=False, throw=True)[source]
Rotate this edge about an axis by the given angle.
- Parameters:
- Returns:
Return value supplied by the concrete edge class.
- Return type:
- abstractmethod attach_mp(*, mp=None, name=None)[source]
Attach a material-property object to this edge under
name.
- abstractmethod find_neigh_point_by_distance(*, plist=None, plane='xy', r=0)[source]
Find all points within radius
rof this edge.
- abstractmethod find_neigh_point_by_count(*, plist=None, n=None, plane='xy')[source]
Find the
nnearest 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
rof this edge.- Parameters:
- Returns:
Neighbor result supplied by the concrete edge class.
- Return type:
- 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.- Parameters:
- Returns:
Neighbor result supplied by the concrete edge class.
- Return type:
- abstractmethod find_neigh_muledge_by_distance(*, melist=None, plane='xy', refloc='starting', r=0)[source]
Find all muledge objects within radius
r.- Parameters:
- Returns:
Neighbor result supplied by the concrete edge class.
- Return type:
- abstractmethod find_neigh_xtal_by_distance(*, xlist=None, plane='xy', refloc='starting', r=0)[source]
Find all crystal objects within radius
rof this edge.- Parameters:
- Returns:
Neighbor result supplied by the concrete edge class.
- Return type:
- abstractmethod set_gmsh_props(prop_dict)[source]
Attach GMSH mesh properties to this edge.
- Parameters:
prop_dict (dict) – GMSH property dictionary.
- abstractmethod make_shapely()[source]
Return a Shapely geometry object for this edge.
- Returns:
Shapely geometry supplied by the concrete edge class.
- Return type:
- abstractmethod make_vtk()[source]
Return a VTK geometry object for this edge.
- Returns:
VTK geometry supplied by the concrete edge class.
- Return type:
- abstract property coords
Endpoint coordinates as a NumPy array.
- Returns:
Endpoint coordinate array supplied by the concrete edge class.
- Return type:
- 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
elistthis edge lies on.
- i
- j