Commit a56dfda8 by lars.quentin 💬

### 📝 a lot of dots

parent a4cffc9e
Pipeline #273075 passed with stages
in 5 minutes and 35 seconds
 ... ... @@ -133,17 +133,17 @@ def test_not_even_boxes_intersect(xs1: List[float], ys1: List[float], xs2: List[ Parameters ---------- xs1: List[float] The lower left point of the minmax containing all points m1 The lower left point of the minmax containing all points m1. ys1: List[float] The lower left point of the minmax containing all points m2 The lower left point of the minmax containing all points m2. xs2: List[float] The upper right point of the minmax containing all points m1 The upper right point of the minmax containing all points m1. ys2: List[float] The upper right point of the minmax containing all points m2 The upper right point of the minmax containing all points m2. m1: List[List[float]] The points for the first bezier curve, enclosed by xs1/xs2 The points for the first bezier curve, enclosed by xs1/xs2. m2: List[List[float]] The points for the second bezier curve, enclosed by ys1/ys2 The points for the second bezier curve, enclosed by ys1/ys2. """ # The first 4 parameters are the boxes b1 = BezierCurveDeCaes(np.array(m1)) ... ... @@ -159,24 +159,24 @@ def test_curves_collision_checks_manually_verfied(xs1: List[float], ys1: List[fl MinMaxBoxes are boxes defined in the form of [x_min, x_max, y_min, y_max, ...]. Thus, in this method we check the non-intersection of two axis parallel boxes. Remember, bezier curves are convex w.r.t. their MinMaxBox Remember, bezier curves are convex w.r.t. their MinMaxBox. Parameters ---------- xs1: List[float] The lower left point of the minmax containing all points m1 The lower left point of the minmax containing all points m1. ys1: List[float] The lower left point of the minmax containing all points m2 The lower left point of the minmax containing all points m2. xs2: List[float] The upper right point of the minmax containing all points m1 The upper right point of the minmax containing all points m1. ys2: List[float] The upper right point of the minmax containing all points m2 The upper right point of the minmax containing all points m2. m1: List[List[float]] The points for the first bezier curve, enclosed by xs1/xs2 The points for the first bezier curve, enclosed by xs1/xs2. m2: List[List[float]] The points for the second bezier curve, enclosed by ys1/ys2 The points for the second bezier curve, enclosed by ys1/ys2. expected: bool Whether they intersect Whether they intersect. """ # The first 4 parameters are the boxes b1 = BezierCurveDeCaes(np.array(m1)) ... ... @@ -197,9 +197,9 @@ def test_single_forward_difference(x: List[float], res: Tuple[int, int]): Parameters ---------- x: List[float] The values for generating the bezier curve of 2D-points (x[i],x[i]) The values for generating the bezier curve of 2D-points (x[i],x[i]). res: Tuple[int, int] The expected value for the first forward difference starting at i=0 (i.e. the first point) The expected value for the first forward difference starting at i=0 (i.e. the first point). """ assert np.all( np.isclose(np.array(res), BezierCurveDeCaes(np.array([x, x])).single_forward_difference(i=0, r=len(x) - 1)) ... ... @@ -215,13 +215,13 @@ def test_derivative(pts: np.ndarray, t: float, r: int, expected: np.ndarray): Parameters ---------- pts: np.ndarray 2d array of shape (2,n) for creating the BezierCurve 2d array of shape (2,n) for creating the BezierCurve. t: float On which point we want to evaluate the derivative On which point we want to evaluate the derivative. r: int Which derivative to evaluate (for example: r=1 => first derivative) Which derivative to evaluate (for example: r=1 => first derivative). expected: np.ndarray The expected value of the r-th derivative, evaluated at point t The expected value of the r-th derivative, evaluated at point t. """ assert pytest.approx(BezierCurveDeCaes(pts).derivative_bezier_curve(t, r), expected) ... ... @@ -241,14 +241,14 @@ def test_barycentric_combinations(m: List[List[float]], n: List[List[float]], al Parameters ---------- m: List[List[float]] The points for the first bezier curve The points for the first bezier curve. n: List[List[float]] The points for the second bezier curve The points for the second bezier curve. alpha: float The weight percentage of the first bezier curve. 0 <= alpha <= 1 Since we have 2 bezier curves, and it has to be an affine combination we know that the second bezier curve is weighted (1 - alpha) weighted (1 - alpha). """ assert 0 <= alpha <= 1 n = np.array(n) ... ... @@ -282,7 +282,7 @@ def test_check_intervals(interval: List[int], xs: Tuple[np.ndarray, int, bool]): Parameters ---------- interval: List[int] The valid interval to evaluate the bezier curve in (usually the unit interval) The valid interval to evaluate the bezier curve in (usually the unit interval). xs: Tuple[np.ndarray, int, float] A 3-tuple of all parameters required to build the bezier curve. First parameters is a numpy array of the points which define the bezier curve. ... ... @@ -302,15 +302,15 @@ def test_check_intervals(interval: List[int], xs: Tuple[np.ndarray, int, bool]): def test_approx_rounds_to_cnt_ts_to_approx_rounds_equals_id(approx_rounds: int, cnt_bezier_points: int): """Checks whether the exact and approximate bezier curves evaluate the approximately same number of points. Actually, this is just a unidirectional identity (g(f(x)) == x but f(g(x)) != x). (To be precise: f(g(x)) == x iff x is an exact power of 2) Actually, this is just a unidirectional identity (g(f(x)) == x but f(g(x)) != x) (To be precise: f(g(x)) == x iff x is an exact power of 2). We approximate bezier curves by subdividing bezier curves with the De Casteljau algorithm. Parameters ---------- approx_rounds: int The number of subdivisions we do The number of subdivisions we do. cnt_bezier_points: int The number of bezier points our (hypothetical) bezier curve has. """ ... ... @@ -326,7 +326,7 @@ def test_intersect_with_x_axis(m: Tuple[List[List[float]], bool], exp: List[List Parameters ---------- m: Tuple[List[List[float]], bool] A tuple of the bezier points and whether they intersect with the x-axis (unused) A tuple of the bezier points and whether they intersect with the x-axis (unused). exp: List[List[float]] A precomputed list of intersecting x values and y values (obviously, the y values are just 0...). """ ... ...
 ... ... @@ -17,11 +17,11 @@ def test_parametrized_for_de_caes(m: List[List[int]], res: List[List[float]], t: Parameters ---------- m: List[List[int]] The bezier points The bezier points. res: List[List[float]] The expected value for a complete execution of the De Casteljau Algorithm The expected value for a complete execution of the De Casteljau Algorithm. t: float On which point in the unit interval to evaluate to On which point in the unit interval to evaluate to. """ assert 0 <= t <= 1 tmp = de_caes(np.array(m, dtype=float), t) ... ... @@ -53,7 +53,7 @@ def test_parametrized_for_subdivision(m: List[List[float]], res: Tuple[List[List Parameters ---------- m: List[List[float]] The bezier points The bezier points. res: Tuple[List[List[float]], List[List[float]]] The 2 new bezier point sets for each side of the subdivision. """ ... ...
 ... ... @@ -19,9 +19,9 @@ def test_random_uniform_distribution(xs: List[Point2D], expected: Set[TupleTrian Parameters ---------- xs: List[Point2D] The points to build the triangulation from The points to build the triangulation from. expected: Set[TupleTriangle] The expected triangulation The expected triangulation. """ d = DelaunayTriangulation2D(radius=10) for pt in xs: ... ...
 ... ... @@ -21,7 +21,7 @@ def test_create_straight_line_functions_for_polygon_2d(pts: List[List[float]]): Parameters ---------- pts: List[List[float]] The (2d) points from which to create the polygon from The (2d) points from which to create the polygon from. """ pts = [np.array([x, y]) for x, y in zip(pts[0], pts[1])] p = Polygon(pts) ... ... @@ -62,7 +62,7 @@ def test_bary_plane_point_2d(pts: List[List[float]], weights: List[float], exp: pts: List[List[float]] A set of points to create the Polygon from. weights: List[float] The weight of each point in the barycentric combination The weight of each point in the barycentric combination. exp: List[float] The new point created by the barycentric combination of the old ones. """ ... ... @@ -84,7 +84,7 @@ def test_bary_plane_point_3d(pts: List[List[float]], weights: List[float], exp: pts: List[List[float]] A set of points to create the Polygon from. weights: List[float] The weight of each point in the barycentric combination The weight of each point in the barycentric combination. exp: List[float] The new point created by the barycentric combination of the old ones. """ ... ... @@ -103,16 +103,16 @@ def test_get_bary_coords_2d(pts: List[List[float]], weights: List[float], exp: L Thus it's inverse gets the weights used for the affine-combination. Let f be the barycentric combination function and xs be the weights. We check that f^(-1)(f(xs)) == xs (think: bijectivity) We check that f^(-1)(f(xs)) == xs (think: bijectivity). Parameters ---------- pts: List[List[float]] A set of points to create the Polygon from. weights: List[float] The weight of each point in the barycentric combination The weight of each point in the barycentric combination. exp: List[float] The new point created by the barycentric combination of the old ones. (not needed here) The new point created by the barycentric combination of the old ones (not needed here). """ pts = [np.array([x, y]) for x, y in zip(pts[0], pts[1])] p = PolygonTriangle(pts) ... ... @@ -128,16 +128,16 @@ def test_get_bary_coords_3d(pts: List[List[float]], weights: List[float], exp: L Thus it's inverse gets the weights used for the affine-combination. Let f be the barycentric combination function and xs be the weights. We check that f^(-1)(f(xs)) == xs (think: bijectivity) We check that f^(-1)(f(xs)) == xs (think: bijectivity). Parameters ---------- pts: List[List[float]] A set of points to create the Polygon from. weights: List[float] The weight of each point in the barycentric combination The weight of each point in the barycentric combination. exp: List[float] The new point created by the barycentric combination of the old ones. (not needed here) The new point created by the barycentric combination of the old ones (not needed here). """ pts = [np.array([x, y, z]) for x, y, z in zip(pts[0], pts[1], pts[2])] p = PolygonTriangle(pts) ... ... @@ -155,11 +155,11 @@ def test_bernstein_polynomial(n: int, i: int, t: float, exp: float): Parameters ---------- n: int The degree of the bernstein polynomial The degree of the bernstein polynomial. i: int Defines which polynomial of degree n we want (just look at the formula dude) Defines which polynomial of degree n we want. t: float On which point we evaulate the bernstein polynomial (unit-interval) On which point we evaulate the bernstein polynomial (unit-interval). exp: float The precomputed value corresponding to t of the i-th of n-th degree. """ ... ...
 ... ... @@ -19,9 +19,9 @@ def test_straight_line_function_equivalent_to_value(a: int, b: int): Parameters ---------- a: int First point defining the line First point defining the line. b: int Second point defining the line Second point defining the line. """ a, b = np.array(a), np.array(b) assert straight_line_point(a, b, 0.5) == create_straight_line_function(a, b)(0.5) ... ... @@ -139,7 +139,7 @@ def test_ratio_is_0_when_a_is_b(): def test_ratio_is_nan_when_b_is_c(): """Checks whether the ratio is nan when ratio(a,b,b). (dividing by zero)""" """Checks whether the ratio is nan when ratio(a,b,b) (dividing by zero).""" a = np.array([4, 3]) b = np.array([8, 5]) c = b ... ... @@ -147,7 +147,7 @@ def test_ratio_is_nan_when_b_is_c(): def test_ratio_is_nan_when_all_points_are_the_same(): """Checks whether the ratio is nan when ratio(a,a,a). (dividing by zero)""" """Checks whether the ratio is nan when ratio(a,a,a) (dividing by zero).""" a = np.array([4, 3]) b = a c = a ... ... @@ -179,7 +179,7 @@ def test_flatten_list_of_lists(xs: List[List[T]], expected: List[T]): Parameters ---------- xs: List[List[T]] Some nested list Some nested list. expected: List[T] One dimension less nested list. """ ... ... @@ -210,10 +210,10 @@ def test_horner(m: List[List[float]], t: float, expected: Tuple[float, float]): Parameters ---------- m: List[List[float]] Bezier Points Bezier Points. t: float Where to evaluate it. expected: Tuple[float, float] The expected result of the horner-based De Casteljau Algorithm The expected result of the horner-based De Casteljau Algorithm. """ assert horner(np.array(m), t) == expected
 ... ... @@ -17,7 +17,7 @@ def test_random_uniform_distribution(seed: List[Tuple[float, float]], mean: Tupl seed: List[Tuple[float, float]] The uniformly distributed random values. mean: Tuple[float, float] The mean of all random values (needed for centering the delaunay triangulation) The mean of all random values (needed for centering the delaunay triangulation). expected: Dict[Tuple[float, float], Deque[TriangleNode]] The expected voronoi regions of each point. """ ... ...
 ... ... @@ -15,11 +15,11 @@ def arrayize(xss: Testcases[Points[Point]]) -> Testcases[List[np.ndarray]]: Parameters ---------- xss: Testcases[Points[Point]] The testcases to convert The testcases to convert. Returns ------- Testcases[List[np.ndarray]] The testcases in numpy-form The testcases in numpy-form. """ return [[np.array(x) for x in xs] for xs in xss]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!