FEM.Utils package#
Utilities
Submodules#
FEM.Utils.polygonal module#
Polygonal help functions
- FEM.Utils.polygonal.angleBetweenAngles(start: float, end: float, mid: float) bool #
Evaluates if a angle is between 2 angles
- Parameters
start (float) – Start angle
end (float) – End angle
mid (float) – Angle to be evaluated
- Returns
Tru if mid is between start-end
- Return type
bool
- FEM.Utils.polygonal.clip(x: float, mi: float, ma: float) float #
Clip 1D
- Parameters
x (float) – Point x
mi (float) – min
ma (float) – max
- Returns
idk
- Return type
float
- FEM.Utils.polygonal.dist(a: list, b: list) float #
Calculate the distancie between 2 points
- Parameters
a (list) – point a
b (list) – point b
- Returns
Distance between a and b
- Return type
float
- FEM.Utils.polygonal.enmalladoFernando(lx: float, ly: float, nex: int, ney: int) numpy.ndarray #
Crea un enmallado 2D de un rectangulo
- Parameters
lx (floar) – Base del rectángulo
ly (float) – Altura del rectámgulo
nex (int) – Numero de elementos en el eje x
ney (int) – Numero de elementos en el eje y
- Returns
coordinates matrix (np.ndarray) and element dictionary (list)
- Return type
np.ndarray
- FEM.Utils.polygonal.generatePolygon(ctrX: float = 10, ctrY: float = 10, aveRadius: float = 5, irregularity: float = 0.5, spikeyness: float = 0.5, numVerts: float = 6) list #
Generate a random polygon.
- Parameters
ctrX (float, optional) – X centroid. Defaults to 10.
ctrY (float, optional) – Y centroid. Defaults to 10.
aveRadius (float, optional) – Average radious. Defaults to 5.
irregularity (float, optional) – Irregularity. Defaults to 0.5.
spikeyness (float, optional) – Spikeyness. Defaults to 0.5.
numVerts (float, optional) – Number of vertices. Defaults to 6.
- Returns
Poligon coordinates matrix.
- Return type
list
- FEM.Utils.polygonal.giveCoordsCircle(O: list, r: float, sa: float = 0, a: float = 6.283185307179586, n: int = 10, isFillet: bool = False) Tuple[list, list] #
Calculates the coordinates of a circle
- Parameters
O (list) – Center coordinates of circle
r (float) – Circle radius
sa (float) – Start angle. Defaults to 0
a (float) – End angle. Defaults to \(2\pi\)
n (int, optional) – Number of coords to calculate. Defaults to 10.
isFillet (bool, optional) – If the circle will be used as fillet. Defaults to False.
- Returns
Circle coordinates and regions
- Return type
list and list
- FEM.Utils.polygonal.isBetween(a: list, b: list, c: list, tol: float = 1e-05) bool #
Test if a point is between a line in a given tolerance. Works in 2D and 3D.
- Parameters
a (list) – Start point of line
b (list) – End point of line
c (list) – Point to be tested between line
tol (float) – Tolerance. Defaults to 1*10**-5
- Returns
True if point is in line
- Return type
bool
- FEM.Utils.polygonal.roundCorner(P1: list, P2: list, P: list, r: float) tuple #
Calculates the origin, start angle and sweep angle of a given corner with a given radius Source: https://stackoverflow.com/questions/24771828/algorithm-for-creating-rounded-corners-in-a-polygon
- Parameters
P1 (list) – First point
P2 (list) – Second Point
P (list) – Center point
r (float) – Radius of corner
- Returns
Circle center coordinates, start angle, sweep angle
- Return type
tuple