Skip to content

Commit

Permalink
snake case im more varibles
Browse files Browse the repository at this point in the history
  • Loading branch information
shimwell committed Apr 29, 2024
1 parent 8e2fd7f commit cc185a8
Show file tree
Hide file tree
Showing 7 changed files with 231 additions and 231 deletions.
10 changes: 5 additions & 5 deletions src/geouned/GEOUNED/Conversion/CellDefinition.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def getId(facein, surfaces):
s.Surf,
dtol=tol.pln_distance,
atol=tol.pln_angle,
relTol=tol.relativeTol,
rel_tol=tol.relativeTol,
):
return s.Index

Expand All @@ -53,7 +53,7 @@ def getId(facein, surfaces):
s.Surf,
dtol=tol.cyl_distance,
atol=tol.cyl_angle,
relTol=tol.relativeTol,
rel_tol=tol.relativeTol,
):
return s.Index

Expand All @@ -64,14 +64,14 @@ def getId(facein, surfaces):
s.Surf,
dtol=tol.kne_distance,
atol=tol.kne_angle,
relTol=tol.relativeTol,
rel_tol=tol.relativeTol,
):
return s.Index

elif surfin[0:6] == "Sphere":
for s in surfaces["Sph"]:
if BF.isSameSphere(
facein, s.Surf, tol.sph_distance, relTol=tol.relativeTol
facein, s.Surf, tol.sph_distance, rel_tol=tol.relativeTol
):
return s.Index

Expand All @@ -82,7 +82,7 @@ def getId(facein, surfaces):
s.Surf,
dtol=tol.tor_distance,
atol=tol.tor_angle,
relTol=tol.relativeTol,
rel_tol=tol.relativeTol,
):
return s.Index

Expand Down
2 changes: 1 addition & 1 deletion src/geouned/GEOUNED/Cuboid/translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def getId(face_in, Surfaces):
s.Surf,
dtol=tol.pln_distance,
atol=tol.pln_angle,
relTol=tol.relativeTol,
rel_tol=tol.relativeTol,
):
return s.Index

Expand Down
62 changes: 31 additions & 31 deletions src/geouned/GEOUNED/Utils/BasicFunctions_part1.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,66 +10,66 @@ def isSameValue(v1, v2, tolerance=1e-6):
return abs(v1 - v2) < tolerance


def isOposite(Vector1, Vector2, tolerance=1e-6):
return abs(Vector1.getAngle(-Vector2)) < tolerance
def isOposite(vector_1, vector_2, tolerance=1e-6):
return abs(vector_1.getAngle(-vector_2)) < tolerance


def isParallel(Vector1, Vector2, tolerance=1e-6):
angle = abs(Vector1.getAngle(Vector2))
def isParallel(vector_1, vector_2, tolerance=1e-6):
angle = abs(vector_1.getAngle(vector_2))
return angle < tolerance or isSameValue(angle, math.pi, tolerance)


def isInLine(Point, Dir, Pnt_line, tolerance=1e-6):
r12 = Point - Pnt_line
return isParallel(Dir, r12) or (r12.Length < tolerance)
def isInLine(point, dir, pnt_line, tolerance=1e-6):
r12 = point - pnt_line
return isParallel(dir, r12) or (r12.Length < tolerance)


def isInPoints(point, Points, tolerance=1e-5):
if len(Points) > 0:
for P in Points:
if point.isEqual(P, tolerance):
def isInPoints(point, points, tolerance=1e-5):
if len(points) > 0:
for p in points:
if point.isEqual(p, tolerance):
return True
return False


def isInEdge(Edge1, Edge2, tolerance=1e-8):
Ver1 = Edge1.Vertexes
Ver2 = Edge2.Vertexes
con1 = Ver1[0].Point.isEqual(Ver2[0].Point, tolerance) or Ver1[0].Point.isEqual(
Ver2[1].Point, tolerance
def isInEdge(edge1, edge2, tolerance=1e-8):
ver1 = edge1.Vertexes
ver2 = edge2.Vertexes
con1 = ver1[0].Point.isEqual(ver2[0].Point, tolerance) or ver1[0].Point.isEqual(
ver2[1].Point, tolerance
)
con2 = Ver1[1].Point.isEqual(Ver2[0].Point, tolerance) or Ver1[1].Point.isEqual(
Ver2[1].Point, tolerance
con2 = ver1[1].Point.isEqual(ver2[0].Point, tolerance) or ver1[1].Point.isEqual(
ver2[1].Point, tolerance
)
return con1 and con2


def isInPlane(Point, plane, dtolerance=1e-7):
return abs(Point.distanceToPlane(plane.Surf.Position, plane.Surf.Axis)) < dtolerance
def isInPlane(point, plane, d_tolerance=1e-7):
return abs(point.distanceToPlane(plane.Surf.Position, plane.Surf.Axis)) < d_tolerance


def isInTolerance(val, tol, fuzzyLow, fuzzyHigh):
if abs(val) < fuzzyLow:
def isInTolerance(val, tol, fuzzy_low, fuzzy_high):
if abs(val) < fuzzy_low:
return True, False # 1) isintolerance 2) fuzzy
elif abs(val) < tol:
return True, True
elif abs(val) > fuzzyHigh:
elif abs(val) > fuzzy_high:
return False, False
else:
return False, True


def signPlane(Point, plane):
value = plane.Surf.Axis.dot(Point - plane.Surf.Position)
def signPlane(point, plane):
value = plane.Surf.Axis.dot(point - plane.Surf.Position)
if value >= 0.0:
sign = 1
else:
sign = -1
return sign


def pointsToCoeffs(Points):
p1, p2, p3 = Points[0:3]
def pointsToCoeffs(points):
p1, p2, p3 = points[0:3]
scf = (p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, p3.x, p3.y, p3.z)

# mcnp implementation to convert 3 point plane to
Expand All @@ -95,11 +95,11 @@ def pointsToCoeffs(Points):
xm = 1 / tpp[4 - i]
coeff[4 - i] = tpp[4 - i] * xm

Axis = FreeCAD.Vector(coeff[0:3])
Distance = coeff[3] / Axis.Length
Axis.normalize()
axis = FreeCAD.Vector(coeff[0:3])
distance = coeff[3] / axis.Length
axis.normalize()

return Axis, Distance
return axis, distance


class Plane3PtsParams:
Expand Down
Loading

0 comments on commit cc185a8

Please sign in to comment.