[Bf-extensions-cvs] [b1cec919] master: Cleanup: fix types in source code

Brecht Van Lommel noreply at git.blender.org
Wed Jan 5 15:47:12 CET 2022


Commit: b1cec919ec7d255c29d31bc21c91d98e0d118182
Author: Brecht Van Lommel
Date:   Wed Jan 5 15:26:39 2022 +0100
Branches: master
https://developer.blender.org/rBAb1cec919ec7d255c29d31bc21c91d98e0d118182

Cleanup: fix types in source code

Contributed by luzpaz.

Differential Revision: https://developer.blender.org/D5801

===================================================================

M	amaranth/scene/debug.py
M	curve_tools/internal.py
M	materials_library_vx/categories.txt
M	mesh_f2.py
M	mesh_snap_utilities_line/common_classes.py
M	mesh_snap_utilities_line/op_line.py
M	node_wrangler.py

===================================================================

diff --git a/amaranth/scene/debug.py b/amaranth/scene/debug.py
index 6d9486be..7154a119 100755
--- a/amaranth/scene/debug.py
+++ b/amaranth/scene/debug.py
@@ -801,7 +801,7 @@ class AMTH_SCENE_OT_list_users_for_x(Operator):
 
 
 class AMTH_SCENE_OT_list_users_debug_clear(Operator):
-    """Clear the list bellow"""
+    """Clear the list below"""
     bl_idname = "scene.amth_list_users_debug_clear"
     bl_label = "Clear Debug Panel lists"
 
@@ -992,7 +992,7 @@ class AMTH_SCENE_PT_scene_debug(Panel):
                     AMTH_store_data.count_images, "IMAGE_DATA"
                     )
         if AMTH_store_data.count_image_node_unlinked != 0:
-            self.draw_miss_link(col, "image", "node", "nodes", "with no output conected",
+            self.draw_miss_link(col, "image", "node", "nodes", "with no output connected",
                     AMTH_store_data.count_image_node_unlinked, "NODE"
                     )
 
diff --git a/curve_tools/internal.py b/curve_tools/internal.py
index 149c31d9..0e51fa8f 100644
--- a/curve_tools/internal.py
+++ b/curve_tools/internal.py
@@ -32,7 +32,7 @@ units = [
     ('in', 'Inch', '0.0254', 8)
 ]
 
-param_tollerance = 0.0001
+param_tolerance = 0.0001
 AABB = namedtuple('AxisAlignedBoundingBox', 'center dimensions')
 Plane = namedtuple('Plane', 'normal distance')
 Circle = namedtuple('Circle', 'orientation center radius')
@@ -62,7 +62,7 @@ def circleOfTriangle(a, b, c):
     orientation.col[0] = orientation.col[1].xyz.cross(orientation.col[2].xyz)
     return Circle(orientation=orientation, center=center, radius=radius)
 
-def circleOfBezier(points, tollerance=0.000001, samples=16):
+def circleOfBezier(points, tolerance=0.000001, samples=16):
     circle = circleOfTriangle(points[0], bezierPointAt(points, 0.5), points[3])
     if circle == None:
         return None
@@ -70,7 +70,7 @@ def circleOfBezier(points, tollerance=0.000001, samples=16):
     for t in range(0, samples):
         variance += ((circle.center-bezierPointAt(points, (t+1)/(samples-1))).length/circle.radius-1) ** 2
     variance /= samples
-    return None if variance > tollerance else circle
+    return None if variance > tolerance else circle
 
 def areaOfPolygon(vertices):
     area = 0
@@ -86,25 +86,25 @@ def linePlaneIntersection(origin, dir, plane):
     det = dir at plane.normal
     return float('nan') if det == 0 else (plane.distance-origin at plane.normal)/det
 
-def nearestPointOfLines(originA, dirA, originB, dirB, tollerance=0.0):
+def nearestPointOfLines(originA, dirA, originB, dirB, tolerance=0.0):
     # https://en.wikipedia.org/wiki/Skew_lines#Nearest_Points
     normal = dirA.cross(dirB)
     normalA = dirA.cross(normal)
     normalB = dirB.cross(normal)
     divisorA = dirA at normalB
     divisorB = dirB at normalA
-    if abs(divisorA) <= tollerance or abs(divisorB) <= tollerance:
+    if abs(divisorA) <= tolerance or abs(divisorB) <= tolerance:
         return (float('nan'), float('nan'), None, None)
     else:
         paramA = (originB-originA)@normalB/divisorA
         paramB = (originA-originB)@normalA/divisorB
         return (paramA, paramB, originA+dirA*paramA, originB+dirB*paramB)
 
-def lineSegmentLineSegmentIntersection(beginA, endA, beginB, endB, tollerance=0.001):
+def lineSegmentLineSegmentIntersection(beginA, endA, beginB, endB, tolerance=0.001):
     dirA = endA-beginA
     dirB = endB-beginB
     paramA, paramB, pointA, pointB = nearestPointOfLines(beginA, dirA, beginB, dirB)
-    if math.isnan(paramA) or (pointA-pointB).length > tollerance or \
+    if math.isnan(paramA) or (pointA-pointB).length > tolerance or \
        paramA < 0 or paramA > 1 or paramB < 0 or paramB > 1:
         return None
     return (paramA, paramB, pointA, pointB)
@@ -120,15 +120,15 @@ def aabbOfPoints(points):
                 max[i] = point[i]
     return AABB(center=(max+min)*0.5, dimensions=(max-min)*0.5)
 
-def aabbIntersectionTest(a, b, tollerance=0.0):
+def aabbIntersectionTest(a, b, tolerance=0.0):
     for i in range(0, 3):
-        if abs(a.center[i]-b.center[i]) > a.dimensions[i]+b.dimensions[i]+tollerance:
+        if abs(a.center[i]-b.center[i]) > a.dimensions[i]+b.dimensions[i]+tolerance:
             return False
     return True
 
-def isPointInAABB(point, aabb, tollerance=0.0, ignore_axis=None):
+def isPointInAABB(point, aabb, tolerance=0.0, ignore_axis=None):
     for i in range(0, 3):
-        if i != ignore_axis and (point[i] < aabb.center[i]-aabb.dimensions[i]-tollerance or point[i] > aabb.center[i]+aabb.dimensions[i]+tollerance):
+        if i != ignore_axis and (point[i] < aabb.center[i]-aabb.dimensions[i]-tolerance or point[i] > aabb.center[i]+aabb.dimensions[i]+tolerance):
             return False
     return True
 
@@ -181,14 +181,14 @@ def bezierLength(points, beginT=0, endT=1, samples=1024):
 # https://en.wikipedia.org/wiki/Root_of_unity
 # cubic_roots_of_unity = [cmath.rect(1, i/3*2*math.pi) for i in range(0, 3)]
 cubic_roots_of_unity = [complex(1, 0), complex(-1, math.sqrt(3))*0.5, complex(-1, -math.sqrt(3))*0.5]
-def bezierRoots(dists, tollerance=0.0001):
+def bezierRoots(dists, tolerance=0.0001):
     # https://en.wikipedia.org/wiki/Cubic_function
     # y(t) = a*t^3 +b*t^2 +c*t^1 +d*t^0
     a = 3*(dists[1]-dists[2])+dists[3]-dists[0]
     b = 3*(dists[0]-2*dists[1]+dists[2])
     c = 3*(dists[1]-dists[0])
     d = dists[0]
-    if abs(a) > tollerance: # Cubic
+    if abs(a) > tolerance: # Cubic
         E2 = a*c
         E3 = a*a*d
         A = (2*b*b-9*E2)*b+27*E3
@@ -198,25 +198,25 @@ def bezierRoots(dists, tollerance=0.0001):
         for root in cubic_roots_of_unity:
             root *= C
             root = -1/(3*a)*(b+root+B/root)
-            if abs(root.imag) < tollerance and root.real > -param_tollerance and root.real < 1.0+param_tollerance:
+            if abs(root.imag) < tolerance and root.real > -param_tolerance and root.real < 1.0+param_tolerance:
                 roots.append(max(0.0, min(root.real, 1.0)))
         # Remove doubles
         roots.sort()
         for index in range(len(roots)-1, 0, -1):
-            if abs(roots[index-1]-roots[index]) < param_tollerance:
+            if abs(roots[index-1]-roots[index]) < param_tolerance:
                 roots.pop(index)
         return roots
-    elif abs(b) > tollerance: # Quadratic
+    elif abs(b) > tolerance: # Quadratic
         disc = c*c-4*b*d
         if disc < 0:
             return []
         disc = math.sqrt(disc)
         return [(-c-disc)/(2*b), (-c+disc)/(2*b)]
-    elif abs(c) > tollerance: # Linear
+    elif abs(c) > tolerance: # Linear
         root = -d/c
         return [root] if root >= 0.0 and root <= 1.0 else []
     else: # Constant / Parallel
-        return [] if abs(d) > tollerance else float('inf')
+        return [] if abs(d) > tolerance else float('inf')
 
 def xRaySplineIntersectionTest(spline, origin):
     spline_points = spline.bezier_points if spline.type == 'BEZIER' else spline.points
@@ -229,7 +229,7 @@ def xRaySplineIntersectionTest(spline, origin):
         prev = intersections[index-1]
         current = intersections[index]
         if prev[1] == current[0] and \
-           prev[2] > 1.0-param_tollerance and current[2] < param_tollerance and \
+           prev[2] > 1.0-param_tolerance and current[2] < param_tolerance and \
            ((prev[3] < 0 and current[3] < 0) or (prev[3] > 0 and current[3] > 0)):
             intersections.pop(index)
 
@@ -284,8 +284,8 @@ def xRaySplineIntersectionTest(spline, origin):
 def isPointInSpline(point, spline):
     return spline.use_cyclic_u and len(xRaySplineIntersectionTest(spline, point))%2 == 1
 
-def isSegmentLinear(points, tollerance=0.0001):
-    return 1.0-(points[1]-points[0]).normalized()@(points[3]-points[2]).normalized() < tollerance
+def isSegmentLinear(points, tolerance=0.0001):
+    return 1.0-(points[1]-points[0]).normalized()@(points[3]-points[2]).normalized() < tolerance
 
 def bezierSegmentPoints(begin, end):
     return [begin.co, begin.handle_right, end.handle_left, end.co]
@@ -321,8 +321,8 @@ def bezierSliceFromTo(points, minParam, maxParam):
     paramDiff = maxParam-minParam
     return [fromP, fromP+fromT*paramDiff, toP-toT*paramDiff, toP]
 
-def bezierIntersectionBroadPhase(solutions, pointsA, pointsB, aMin=0.0, aMax=1.0, bMin=0.0, bMax=1.0, depth=8, tollerance=0.001):
-    if aabbIntersectionTest(aabbOfPoints(bezierSliceFromTo(pointsA, aMin, aMax)), aabbOfPoints(bezierSliceFromTo(pointsB, bMin, bMax)), tollerance) == False:
+def bezierIntersectionBroadPhase(solutions, pointsA, pointsB, aMin=0.0, aMax=1.0, bMin=0.0, bMax=1.0, depth=8, tolerance=0.001):
+    if aabbIntersectionTest(aabbOfPoints(bezierSliceFromTo(pointsA, aMin, aMax)), aabbOfPoints(bezierSliceFromTo(pointsB, bMin, bMax)), tolerance) == False:
         return
     if depth == 0:
         solutions.append([aMin, aMax, bMin, bMax])
@@ -330,17 +330,17 @@ def bezierIntersectionBroadPhase(solutions, pointsA, pointsB, aMin=0.0, aMax=1.0
     depth -= 1
     aMid = (aMin+aMax)*0.5
     bMid = (bMin+bMax)*0.5
-    bezierIntersectionBroadPhase(solutions, pointsA, pointsB, aMin, aMid, bMin, bMid, depth, tollerance)
-    bezierIntersectionBroadPhase(solutions, pointsA, pointsB, aMin, aMid, bMid, bMax, depth, tollerance)
-    bezierIntersectionBroadPhase(solutions, pointsA, pointsB, aMid, aMax, bMin, bMid, depth, tollerance)
-    bezierIntersectionBroadPhase(solutions, pointsA, pointsB, aMid, aMax, bMid, bMax, depth, tollerance)
+    bezierIntersectionBroadPhase(solutions, pointsA, pointsB, aMin, aMid, bMin, bMid, depth, tolerance)
+    bezierIntersectionBroadPhase(solutions, pointsA, pointsB, aMin, aMid, bMid, bMax, depth, tolerance)
+    bezierIntersectionBroadPhase(solutions, pointsA, pointsB, aMid, aMax, bMin, bMid, depth, tolerance)
+    bezierIntersectionBroadPhase(solutions, pointsA, pointsB, aMid, aMax, bMid, bMax, depth, tolerance)
 
-def bezierIntersectionNarrowPhase(broadPhase, pointsA, pointsB, tollerance=0.000001):
+def bezierIntersectionNarrowPhase(broadPhase, pointsA, pointsB, tolerance=0.000001):
     aMin = broadPhase[0]
     aMax = broadPhase[1]
     bMin = broadPhase[2]
     bMax = broadPhase[3]
-    while (aMax-aMin > tollerance) or (bMax-bMin > tollerance):
+    while

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list