diff --git a/examples/show_microstructures.py b/examples/show_microstructures.py index 35d6d22b8..14d74dc04 100644 --- a/examples/show_microstructures.py +++ b/examples/show_microstructures.py @@ -346,13 +346,13 @@ def foo(x): generator.parametrization_function = foo inverse_microstructure = generator.create( - closing_face="z", seperator_distance=0.4, center_expansion=1.3 + closing_face="z", separator_distance=0.4, center_expansion=1.3 ) # Plot the results _, showables_inverse = generator.show( closing_face="z", - seperator_distance=0.4, + separator_distance=0.4, center_expansion=1.3, title="Parametrized Inverse Microstructure", control_points=False, @@ -365,7 +365,7 @@ def foo(x): # Corresponding Structure generator.microtile = splinepy.microstructure.tiles.get("Cross3D") microstructure = generator.create( - closing_face="z", seperator_distance=0.4, center_expansion=1.3 + closing_face="z", separator_distance=0.4, center_expansion=1.3 ) _, showables = generator.show( closing_face="z", diff --git a/splinepy/microstructure/microstructure.py b/splinepy/microstructure/microstructure.py index 366935651..298df64be 100644 --- a/splinepy/microstructure/microstructure.py +++ b/splinepy/microstructure/microstructure.py @@ -9,7 +9,7 @@ class Microstructure(_SplinepyBase): - """Helper class to facilitatae the construction of microstructures.""" + """Helper class to facilitate the construction of microstructures.""" def __init__( self, @@ -18,7 +18,7 @@ def __init__( microtile=None, parametrization_function=None, ): - """Helper class to facilitatae the construction of microstructures. + """Helper class to facilitate the construction of microstructures. Parameters ---------- @@ -427,8 +427,8 @@ def _compute_tiling_prerequisites( def create( self, closing_face=None, - knot_span_wise=None, - macro_sensitivities=None, + knot_span_wise=True, + macro_sensitivities=False, **kwargs, ): """Create a Microstructure. @@ -455,11 +455,12 @@ def create( if not self._sanity_check(): raise ValueError("Not enough information provided, abort") - # Set default values - if knot_span_wise is None: - knot_span_wise = True - if macro_sensitivities is None: - macro_sensitivities = False + assert isinstance( + knot_span_wise, bool + ), "knot_span_wise must be a bool" + assert isinstance( + macro_sensitivities, bool + ), "macro_senstivities must be a bool" # check if user wants closed structure if closing_face is not None: @@ -533,7 +534,7 @@ def create( if macro_sensitivities or parameter_sensitivities: spline_list_derivs = [ [] - for i in range( + for _ in range( n_parameter_sensitivities + n_macro_sensitivities ) ] diff --git a/splinepy/microstructure/tiles/__init__.py b/splinepy/microstructure/tiles/__init__.py index 3b35a1f5c..f1b703a04 100644 --- a/splinepy/microstructure/tiles/__init__.py +++ b/splinepy/microstructure/tiles/__init__.py @@ -8,6 +8,7 @@ armadillo, chi, cross_2d, + cross_3d, cross_3d_linear, cube_void, double_lattice, @@ -42,6 +43,7 @@ "chi", "cross_2d", "cube_void", + "cross_3d", "cross_3d_linear", "double_lattice", "ellips_v_oid", diff --git a/splinepy/microstructure/tiles/armadillo.py b/splinepy/microstructure/tiles/armadillo.py index e7f39aa66..8e4712d99 100644 --- a/splinepy/microstructure/tiles/armadillo.py +++ b/splinepy/microstructure/tiles/armadillo.py @@ -20,11 +20,25 @@ class Armadillo(_TileBase): _dim = 3 _evaluation_points = _np.array([[0.5, 0.5, 0.5]]) _n_info_per_eval_point = 1 + _sensitivities_implemented = True + _closure_directions = [ + "x_min", + "x_max", + "y_min", + "y_max", + "z_min", + "z_max", + ] + _parameter_bounds = [[0.0, 0.5]] + _parameters_shape = (1, 1) + _default_parameter_value = 0.2 + + _CONTACT_LENGTH_BOUNDS = [0.0, 0.99] def _closing_tile( self, parameters=None, - parameter_sensitivities=None, # TODO + parameter_sensitivities=None, contact_length=0.3, closure=None, **kwargs, # noqa ARG002 @@ -58,4104 +72,5017 @@ def _closing_tile( if closure is None: raise ValueError("No closing direction given") - if not isinstance(contact_length, float): - raise ValueError("Invalid Type for radius") + self._check_custom_parameter( + contact_length, "contact length", self._CONTACT_LENGTH_BOUNDS + ) - if not ((contact_length > 0) and (contact_length < 0.99)): - raise ValueError("The length of a side must be in (0.01, 0.99)") + parameters, n_derivatives, derivatives = self._process_input( + parameters=parameters, + parameter_sensitivities=parameter_sensitivities, + ) - if parameters is None: - self._logd("Setting parameters to default values (0.2)") - parameters = _np.array( - _np.ones( - (len(self._evaluation_points), self._n_info_per_eval_point) + splines = [] + for i_derivative in range(n_derivatives + 1): + if i_derivative == 0: + v_wall_thickness = parameters[0, 0] + v_zero = 0.0 + v_one_half = 0.5 + v_one = 1.0 + v_half_contact_length = contact_length * 0.5 + v_inner_half_contact_length = contact_length * v_wall_thickness + else: + v_wall_thickness = parameter_sensitivities[ + 0, 0, i_derivative - 1 + ] + v_zero = 0.0 + v_one_half = 0.0 + v_one = 0.0 + v_half_contact_length = 0.0 + v_inner_half_contact_length = contact_length * v_wall_thickness + + spline_list = [] + + if closure == "x_min": + # set points: + right = _np.array( + [ + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + -v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + -v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + ] ) - * 0.2 - ) - self.check_params(parameters) + connection_front_right = _np.array( + [ + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + ] + ) - if parameter_sensitivities is not None: - raise NotImplementedError( - "Derivatives are not implemented for this tile yet" - ) + front = _np.array( + [ + [ + v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + ] + ) - if not (_np.all(parameters > 0) and _np.all(parameters < 0.5)): - raise ValueError( - "The thickness of the wall must be in (0.01 and 0.49)" - ) + connection_back_left = _np.array( + [ + [ + -v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + v_zero, + v_one, + ], + [ + -v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_zero, + v_zero, + v_zero, + ], + [ + -v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_zero, + v_one_half - v_half_contact_length, + ], + ] + ) - v_wall_thickness = parameters[0, 0] - spline_list = [] - v_zero = 0.0 - v_one_half = 0.5 - v_one = 1.0 - v_half_contact_length = contact_length * 0.5 - v_inner_half_contact_length = contact_length * parameters[0, 0] + left = _np.array( + [ + [ + v_zero, + v_one, + v_one, + ], + [ + -v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + v_zero, + v_one, + ], + [ + -v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_zero, + v_one, + v_zero, + ], + [ + -v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + v_zero, + v_zero, + ], + [ + -v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + ] + ) - if closure == "x_min": - # set points: - right = _np.array( - [ - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - -v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one, - -v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one, - v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - ] - ) + connection_front_left = _np.array( + [ + [ + v_zero, + v_one, + v_one, + ], + [ + -v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + v_one, + v_zero, + ], + [ + -v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + ] + ) - connection_front_right = _np.array( - [ - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one, - v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - ] - ) + back = _np.array( + [ + [ + v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_zero, + v_one_half - v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_zero, + v_one_half - v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + ] + ) - front = _np.array( - [ - [ - v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - ] - ) + connection_back_right = _np.array( + [ + [ + v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_zero, + v_one_half - v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + -v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + -v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + ] + ) - connection_back_left = _np.array( - [ - [ - -v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - v_zero, - v_one, - ], - [ - -v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_zero, - v_zero, - v_zero, - ], - [ - -v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_zero, - v_one_half - v_half_contact_length, - ], - ] - ) + bottom = _np.array( + [ + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + ] + ) - left = _np.array( - [ - [ - v_zero, - v_one, - v_one, - ], - [ - -v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - v_zero, - v_one, - ], - [ - -v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_zero, - v_one, - v_zero, - ], - [ - -v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - v_zero, - v_zero, - ], - [ - -v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - ] - ) + top = _np.array( + [ + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + ] + ) - connection_front_left = _np.array( - [ - [ - v_zero, - v_one, - v_one, - ], - [ - -v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - v_one, - v_zero, - ], - [ - -v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - ] - ) + connection_front_bottom = _np.array( + [ + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_inner_half_contact_length + v_one_half, + v_one_half + v_wall_thickness, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_one_half + v_wall_thickness, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + ] + ) - back = _np.array( - [ - [ - v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_zero, - v_one_half - v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_zero, - v_one_half - v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - ] - ) + connection_front_top = _np.array( + [ + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + v_one_half + v_wall_thickness, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_one_half + v_wall_thickness, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + ] + ) - connection_back_right = _np.array( - [ - [ - v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_zero, - v_one_half - v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - -v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one, - -v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - ] - ) + connection_back_bottom = _np.array( + [ + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half + v_half_contact_length, + v_zero, + v_one_half - v_half_contact_length, + ], + [ + v_one_half - v_half_contact_length, + v_zero, + v_one_half - v_half_contact_length, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, + v_one_half - v_inner_half_contact_length, + ], + ] + ) - bottom = _np.array( - [ - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - ] - ) + connection_back_top = _np.array( + [ + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + ], + ] + ) - top = _np.array( - [ - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - ] - ) + connection_top_right = _np.array( + [ + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one, + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + ], + [ + v_one, + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + ], + [ + v_one_half + v_wall_thickness, + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one_half + v_wall_thickness, + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + ] + ) - connection_front_bottom = _np.array( - [ - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_inner_half_contact_length + v_one_half, - v_one_half + v_wall_thickness, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_one_half + v_wall_thickness, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - ] - ) + connection_top_left = _np.array( + [ + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + [ + v_zero, + v_one, + v_one, + ], + [ + v_zero, + v_zero, + v_one, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one_half - v_wall_thickness, + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + ] + ) - connection_front_top = _np.array( - [ - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - v_one_half + v_wall_thickness, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_one_half + v_wall_thickness, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - ] - ) - - connection_back_bottom = _np.array( - [ - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_half_contact_length, - v_zero, - v_one_half - v_half_contact_length, - ], - [ - v_one_half - v_half_contact_length, - v_zero, - v_one_half - v_half_contact_length, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - ], - ] - ) - - connection_back_top = _np.array( - [ - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half + v_inner_half_contact_length, - ], - ] - ) - - connection_top_right = _np.array( - [ - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one, - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - ], - [ - v_one, - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - ], - [ - v_one_half + v_wall_thickness, - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one_half + v_wall_thickness, - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - ], - ] - ) - - connection_top_left = _np.array( - [ - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - [ - v_zero, - v_one, - v_one, - ], - [ - v_zero, - v_zero, - v_one, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_wall_thickness, - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - ], - ] - ) - - connection_bottom_left = _np.array( - [ - [ - v_zero, - v_one, - v_zero, - ], - [ - v_zero, - v_zero, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_wall_thickness, - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - ] - ) - - connection_bottom_right = _np.array( - [ - [ - v_one, - v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - v_one, - -v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - ] - ) - - elif closure == "x_max": - # set points: - right = _np.array( - [ - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - v_zero, - v_one, - ], - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one, - v_zero, - v_zero, - ], - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - v_one, - v_one, - ], - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one, - v_one, - v_zero, - ], - ] - ) - - connection_front_right = _np.array( - [ - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - v_one, - v_one, - ], - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one, - v_one, - v_zero, - ], - [ - v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - ] - ) - - front = _np.array( - [ - [ - v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - ] - ) - - connection_back_left = _np.array( - [ - [ - -v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - -v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_zero, - -v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_zero, - v_one_half - v_half_contact_length, - ], - ] - ) - - left = _np.array( - [ - [ - v_zero, - -v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - -v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_zero, - v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - ] - ) - - connection_front_left = _np.array( - [ - [ - v_zero, - v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - ] - ) - - back = _np.array( - [ - [ - v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_zero, - v_one_half - v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_zero, - v_one_half - v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - ] - ) - - connection_back_right = _np.array( - [ - [ - v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_zero, - v_one_half - v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - v_zero, - v_one, - ], - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one, - v_zero, - v_zero, - ], - ] - ) - - bottom = _np.array( - [ - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - ] - ) - - top = _np.array( - [ - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - ] - ) - - connection_front_bottom = _np.array( - [ - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_inner_half_contact_length + v_one_half, - v_one_half + v_wall_thickness, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_one_half + v_wall_thickness, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - ] - ) - - connection_front_top = _np.array( - [ - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - v_one_half + v_wall_thickness, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_one_half + v_wall_thickness, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - ] - ) - - connection_back_bottom = _np.array( - [ - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_half_contact_length, - v_zero, - v_one_half - v_half_contact_length, - ], - [ - v_one_half - v_half_contact_length, - v_zero, - v_one_half - v_half_contact_length, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - ], - ] - ) - - connection_back_top = _np.array( - [ - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half + v_inner_half_contact_length, - ], - ] - ) - - connection_top_right = _np.array( - [ - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one, - v_one, - v_one, - ], - [ - v_one, - v_zero, - v_one, - ], - [ - v_one_half + v_wall_thickness, - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one_half + v_wall_thickness, - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - ], - ] - ) - - connection_top_left = _np.array( - [ - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - [ - v_zero, - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - ], - [ - v_zero, - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_wall_thickness, - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - ], - ] - ) - - connection_bottom_left = _np.array( - [ - [ - v_zero, - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - ], - [ - v_zero, - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_wall_thickness, - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - ] - ) - - connection_bottom_right = _np.array( - [ - [ - v_one, - v_one, - v_zero, - ], - [ - v_one, - v_zero, - v_zero, - ], - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - ] - ) - - elif closure == "y_min": - # set points: - right = _np.array( - [ - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - -v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one, - -v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one, - v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - ] - ) - - connection_front_right = _np.array( - [ - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one, - v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - ] - ) - - front = _np.array( - [ - [ - v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - ] - ) - - connection_back_left = _np.array( - [ - [ - -v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - -v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_zero, - -v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - v_zero, - v_one, - ], - [ - -v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_zero, - v_zero, - v_zero, - ], - ] - ) - - left = _np.array( - [ - [ - v_zero, - -v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - -v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_zero, - v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - ] - ) - - connection_front_left = _np.array( - [ - [ - v_zero, - v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - ] - ) - - back = _np.array( - [ - [ - v_one, - v_zero, - v_one, - ], - [ - v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - v_zero, - v_zero, - ], - [ - v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_zero, - v_zero, - v_one, - ], - [ - -v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - v_zero, - v_zero, - ], - [ - -v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - ] - ) - - connection_back_right = _np.array( - [ - [ - v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - v_zero, - v_one, - ], - [ - v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one, - v_zero, - v_zero, - ], - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - -v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one, - -v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - ] - ) - - bottom = _np.array( - [ - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - ] - ) - - top = _np.array( - [ - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - ] - ) - - connection_front_bottom = _np.array( - [ - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_inner_half_contact_length + v_one_half, - v_one_half + v_wall_thickness, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_one_half + v_wall_thickness, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - ] - ) - - connection_front_top = _np.array( - [ - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - v_one_half + v_wall_thickness, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_one_half + v_wall_thickness, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - ] - ) - - connection_back_bottom = _np.array( - [ - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one, - v_zero, - v_zero, - ], - [ - v_zero, - v_zero, - v_zero, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - ], - ] - ) - - connection_back_top = _np.array( - [ - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one, - v_zero, - v_one, - ], - [ - v_zero, - v_zero, - v_one, - ], - [ - v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half + v_inner_half_contact_length, - ], - ] - ) - - connection_top_right = _np.array( - [ - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one, - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - ], - [ - v_one, - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - ], - [ - v_one_half + v_wall_thickness, - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one_half + v_wall_thickness, - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - ], - ] - ) - - connection_top_left = _np.array( - [ - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - [ - v_zero, - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - ], - [ - v_zero, - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_wall_thickness, - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - ], - ] - ) - - connection_bottom_left = _np.array( - [ - [ - v_zero, - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - ], - [ - v_zero, - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_wall_thickness, - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - ] - ) - - connection_bottom_right = _np.array( - [ - [ - v_one, - v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - v_one, - -v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - ] - ) - - elif closure == "y_max": - # set points: - # set points: - right = _np.array( - [ - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - -v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one, - -v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one, - v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - ] - ) - - connection_front_right = _np.array( - [ - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one, - v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - v_one, - v_one, - ], - [ - v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one, - v_one, - v_zero, - ], - ] - ) - - front = _np.array( - [ - [ - v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - v_one, - v_one, - ], - [ - v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one, - v_one, - v_zero, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - v_one, - v_one, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_zero, - v_one, - v_zero, - ], - ] - ) - - connection_back_left = _np.array( - [ - [ - -v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - -v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_zero, - -v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_zero, - v_one_half - v_half_contact_length, - ], - ] - ) - - left = _np.array( - [ - [ - v_zero, - -v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - -v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_zero, - v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - ] - ) - - connection_top_left = _np.array( - [ - [ - v_zero, - v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_zero, - v_one, - v_one, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - v_one, - v_zero, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - ] - ) - - back = _np.array( - [ - [ - v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_zero, - v_one_half - v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_zero, - v_one_half - v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - ] - ) + connection_bottom_left = _np.array( + [ + [ + v_zero, + v_one, + v_zero, + ], + [ + v_zero, + v_zero, + v_zero, + ], + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one_half - v_wall_thickness, + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + ] + ) - connection_back_right = _np.array( - [ - [ - v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_zero, - v_one_half - v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - -v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one, - -v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - ] - ) + connection_bottom_right = _np.array( + [ + [ + v_one, + v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + v_one, + -v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + ] + ) - bottom = _np.array( - [ - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - ] - ) + elif closure == "x_max": + # set points: + right = _np.array( + [ + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + v_zero, + v_one, + ], + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + v_zero, + v_zero, + ], + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + v_one, + v_one, + ], + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + v_one, + v_zero, + ], + ] + ) - top = _np.array( - [ - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - ] - ) + connection_front_right = _np.array( + [ + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + v_one, + v_one, + ], + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + v_one, + v_zero, + ], + [ + v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + ] + ) - connection_front_bottom = _np.array( - [ - [ - v_one, - v_one, - v_zero, - ], - [ - v_zero, - v_one, - v_zero, - ], - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_inner_half_contact_length + v_one_half, - v_one_half + v_wall_thickness, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_one_half + v_wall_thickness, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - ] - ) + front = _np.array( + [ + [ + v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + ] + ) - connection_front_top = _np.array( - [ - [ - v_one, - v_one, - v_one, - ], - [ - v_zero, - v_one, - v_one, - ], - [ - v_inner_half_contact_length + v_one_half, - v_one_half + v_wall_thickness, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_one_half + v_wall_thickness, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - ] - ) + connection_back_left = _np.array( + [ + [ + -v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + -v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_zero, + -v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_zero, + v_one_half - v_half_contact_length, + ], + ] + ) - connection_back_bottom = _np.array( - [ - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_half_contact_length, - v_zero, - v_one_half - v_half_contact_length, - ], - [ - v_one_half - v_half_contact_length, - v_zero, - v_one_half - v_half_contact_length, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - ], - ] - ) + left = _np.array( + [ + [ + v_zero, + -v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + -v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_zero, + v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + ] + ) - connection_back_top = _np.array( - [ - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half + v_inner_half_contact_length, - ], - ] - ) + connection_front_left = _np.array( + [ + [ + v_zero, + v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + ] + ) - connection_top_right = _np.array( - [ - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one, - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - ], - [ - v_one, - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - ], - [ - v_one_half + v_wall_thickness, - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one_half + v_wall_thickness, - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - ], - ] - ) + back = _np.array( + [ + [ + v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_zero, + v_one_half - v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_zero, + v_one_half - v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + ] + ) - connection_front_left = _np.array( - [ - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - [ - v_zero, - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - ], - [ - v_zero, - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_wall_thickness, - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - ], - ] - ) + connection_back_right = _np.array( + [ + [ + v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_zero, + v_one_half - v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + v_zero, + v_one, + ], + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + v_zero, + v_zero, + ], + ] + ) + + bottom = _np.array( + [ + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + ] + ) + + top = _np.array( + [ + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + ] + ) + + connection_front_bottom = _np.array( + [ + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_inner_half_contact_length + v_one_half, + v_one_half + v_wall_thickness, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_one_half + v_wall_thickness, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + ] + ) + + connection_front_top = _np.array( + [ + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + v_one_half + v_wall_thickness, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_one_half + v_wall_thickness, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + ] + ) + + connection_back_bottom = _np.array( + [ + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half + v_half_contact_length, + v_zero, + v_one_half - v_half_contact_length, + ], + [ + v_one_half - v_half_contact_length, + v_zero, + v_one_half - v_half_contact_length, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, + v_one_half - v_inner_half_contact_length, + ], + ] + ) + + connection_back_top = _np.array( + [ + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + ], + ] + ) + + connection_top_right = _np.array( + [ + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one, + v_one, + v_one, + ], + [ + v_one, + v_zero, + v_one, + ], + [ + v_one_half + v_wall_thickness, + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one_half + v_wall_thickness, + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + ] + ) + + connection_top_left = _np.array( + [ + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + [ + v_zero, + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + ], + [ + v_zero, + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one_half - v_wall_thickness, + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + ] + ) + + connection_bottom_left = _np.array( + [ + [ + v_zero, + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + ], + [ + v_zero, + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + ], + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one_half - v_wall_thickness, + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + ] + ) + + connection_bottom_right = _np.array( + [ + [ + v_one, + v_one, + v_zero, + ], + [ + v_one, + v_zero, + v_zero, + ], + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + ] + ) + + elif closure == "y_min": + # set points: + right = _np.array( + [ + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + -v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + -v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + ] + ) + + connection_front_right = _np.array( + [ + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + ] + ) + + front = _np.array( + [ + [ + v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + ] + ) + + connection_back_left = _np.array( + [ + [ + -v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + -v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_zero, + -v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + v_zero, + v_one, + ], + [ + -v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_zero, + v_zero, + v_zero, + ], + ] + ) + + left = _np.array( + [ + [ + v_zero, + -v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + -v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_zero, + v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + ] + ) + + connection_front_left = _np.array( + [ + [ + v_zero, + v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + ] + ) - connection_bottom_left = _np.array( - [ - [ - v_zero, - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - ], - [ - v_zero, - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_wall_thickness, - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - ] - ) + back = _np.array( + [ + [ + v_one, + v_zero, + v_one, + ], + [ + v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + v_zero, + v_zero, + ], + [ + v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_zero, + v_zero, + v_one, + ], + [ + -v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + v_zero, + v_zero, + ], + [ + -v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + ] + ) - connection_bottom_right = _np.array( - [ - [ - v_one, - v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - v_one, - -v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - ] - ) + connection_back_right = _np.array( + [ + [ + v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + v_zero, + v_one, + ], + [ + v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + v_zero, + v_zero, + ], + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + -v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + -v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + ] + ) - elif closure == "z_max": - # set points: - right = _np.array( - [ - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - -v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one, - -v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one, - v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - ] - ) + bottom = _np.array( + [ + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + ] + ) - connection_front_right = _np.array( - [ - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one, - v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - ] - ) + top = _np.array( + [ + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + ] + ) - front = _np.array( - [ - [ - v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - ] - ) + connection_front_bottom = _np.array( + [ + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_inner_half_contact_length + v_one_half, + v_one_half + v_wall_thickness, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_one_half + v_wall_thickness, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + ] + ) + + connection_front_top = _np.array( + [ + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + v_one_half + v_wall_thickness, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_one_half + v_wall_thickness, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + ] + ) + + connection_back_bottom = _np.array( + [ + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one, + v_zero, + v_zero, + ], + [ + v_zero, + v_zero, + v_zero, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, + v_one_half - v_inner_half_contact_length, + ], + ] + ) + + connection_back_top = _np.array( + [ + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one, + v_zero, + v_one, + ], + [ + v_zero, + v_zero, + v_one, + ], + [ + v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + ], + ] + ) + + connection_top_right = _np.array( + [ + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one, + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + ], + [ + v_one, + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + ], + [ + v_one_half + v_wall_thickness, + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one_half + v_wall_thickness, + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + ] + ) + + connection_top_left = _np.array( + [ + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + [ + v_zero, + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + ], + [ + v_zero, + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one_half - v_wall_thickness, + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + ] + ) + + connection_bottom_left = _np.array( + [ + [ + v_zero, + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + ], + [ + v_zero, + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + ], + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one_half - v_wall_thickness, + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + ] + ) + + connection_bottom_right = _np.array( + [ + [ + v_one, + v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + v_one, + -v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + ] + ) + + elif closure == "y_max": + # set points: + # set points: + right = _np.array( + [ + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + -v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + -v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + ] + ) + + connection_front_right = _np.array( + [ + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + v_one, + v_one, + ], + [ + v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + v_one, + v_zero, + ], + ] + ) + + front = _np.array( + [ + [ + v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + v_one, + v_one, + ], + [ + v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + v_one, + v_zero, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + v_one, + v_one, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_zero, + v_one, + v_zero, + ], + ] + ) + + connection_back_left = _np.array( + [ + [ + -v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + -v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_zero, + -v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_zero, + v_one_half - v_half_contact_length, + ], + ] + ) + + left = _np.array( + [ + [ + v_zero, + -v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + -v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_zero, + v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + ] + ) + + connection_top_left = _np.array( + [ + [ + v_zero, + v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_zero, + v_one, + v_one, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + v_one, + v_zero, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + ] + ) + + back = _np.array( + [ + [ + v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_zero, + v_one_half - v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_zero, + v_one_half - v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + ] + ) + + connection_back_right = _np.array( + [ + [ + v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_zero, + v_one_half - v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + -v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + -v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + ] + ) - connection_back_left = _np.array( - [ - [ - -v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - -v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_zero, - -v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_zero, - v_one_half - v_half_contact_length, - ], - ] - ) + bottom = _np.array( + [ + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + ] + ) - left = _np.array( - [ - [ - v_zero, - -v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - -v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_zero, - v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - ] - ) + top = _np.array( + [ + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + ] + ) - connection_front_left = _np.array( - [ - [ - v_zero, - v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - ] - ) + connection_front_bottom = _np.array( + [ + [ + v_one, + v_one, + v_zero, + ], + [ + v_zero, + v_one, + v_zero, + ], + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_inner_half_contact_length + v_one_half, + v_one_half + v_wall_thickness, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_one_half + v_wall_thickness, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + ] + ) - back = _np.array( - [ - [ - v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_zero, - v_one_half - v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_zero, - v_one_half - v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - ] - ) + connection_front_top = _np.array( + [ + [ + v_one, + v_one, + v_one, + ], + [ + v_zero, + v_one, + v_one, + ], + [ + v_inner_half_contact_length + v_one_half, + v_one_half + v_wall_thickness, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_one_half + v_wall_thickness, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + ] + ) - connection_back_right = _np.array( - [ - [ - v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_zero, - v_one_half - v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - -v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one, - -v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - ] - ) + connection_back_bottom = _np.array( + [ + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half + v_half_contact_length, + v_zero, + v_one_half - v_half_contact_length, + ], + [ + v_one_half - v_half_contact_length, + v_zero, + v_one_half - v_half_contact_length, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, + v_one_half - v_inner_half_contact_length, + ], + ] + ) + + connection_back_top = _np.array( + [ + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + ], + ] + ) + + connection_top_right = _np.array( + [ + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one, + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + ], + [ + v_one, + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + ], + [ + v_one_half + v_wall_thickness, + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one_half + v_wall_thickness, + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + ] + ) + + connection_front_left = _np.array( + [ + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + [ + v_zero, + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + ], + [ + v_zero, + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one_half - v_wall_thickness, + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + ] + ) + + connection_bottom_left = _np.array( + [ + [ + v_zero, + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + ], + [ + v_zero, + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + ], + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one_half - v_wall_thickness, + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + ] + ) + + connection_bottom_right = _np.array( + [ + [ + v_one, + v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + v_one, + -v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + ] + ) + + elif closure == "z_max": + # set points: + right = _np.array( + [ + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + -v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + -v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + ] + ) + + connection_front_right = _np.array( + [ + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + ] + ) + + front = _np.array( + [ + [ + v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + ] + ) + + connection_back_left = _np.array( + [ + [ + -v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + -v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_zero, + -v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_zero, + v_one_half - v_half_contact_length, + ], + ] + ) + + left = _np.array( + [ + [ + v_zero, + -v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + -v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_zero, + v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + ] + ) + + connection_front_left = _np.array( + [ + [ + v_zero, + v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + ] + ) + + back = _np.array( + [ + [ + v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_zero, + v_one_half - v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_zero, + v_one_half - v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + ] + ) + + connection_back_right = _np.array( + [ + [ + v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_zero, + v_one_half - v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + -v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + -v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + ] + ) + + bottom = _np.array( + [ + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + ] + ) + + top = _np.array( + [ + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one, + v_one, + v_one, + ], + [ + v_zero, + v_one, + v_one, + ], + [ + v_one, + v_zero, + v_one, + ], + [ + v_zero, + v_zero, + v_one, + ], + ] + ) - bottom = _np.array( - [ - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - ] - ) + connection_front_bottom = _np.array( + [ + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_inner_half_contact_length + v_one_half, + v_one_half + v_wall_thickness, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_one_half + v_wall_thickness, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + ] + ) - top = _np.array( - [ - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one, - v_one, - v_one, - ], - [ - v_zero, - v_one, - v_one, - ], - [ - v_one, - v_zero, - v_one, - ], - [ - v_zero, - v_zero, - v_one, - ], - ] - ) + connection_front_top = _np.array( + [ + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + v_one_half + v_wall_thickness, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_one_half + v_wall_thickness, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + v_one, + v_one, + ], + [ + v_zero, + v_one, + v_one, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + ] + ) - connection_front_bottom = _np.array( - [ - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_inner_half_contact_length + v_one_half, - v_one_half + v_wall_thickness, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_one_half + v_wall_thickness, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - ] - ) + connection_back_bottom = _np.array( + [ + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half + v_half_contact_length, + v_zero, + v_one_half - v_half_contact_length, + ], + [ + v_one_half - v_half_contact_length, + v_zero, + v_one_half - v_half_contact_length, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, + v_one_half - v_inner_half_contact_length, + ], + ] + ) - connection_front_top = _np.array( - [ - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - v_one_half + v_wall_thickness, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_one_half + v_wall_thickness, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - v_one, - v_one, - ], - [ - v_zero, - v_one, - v_one, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - ] - ) + connection_back_top = _np.array( + [ + [ + v_one, + v_zero, + v_one, + ], + [ + v_zero, + v_zero, + v_one, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + ], + ] + ) - connection_back_bottom = _np.array( - [ - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_half_contact_length, - v_zero, - v_one_half - v_half_contact_length, - ], - [ - v_one_half - v_half_contact_length, - v_zero, - v_one_half - v_half_contact_length, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - ], - ] - ) + connection_top_right = _np.array( + [ + [ + v_one, + v_one, + v_one, + ], + [ + v_one, + v_zero, + v_one, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one, + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + ], + [ + v_one, + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + ], + [ + v_one_half + v_wall_thickness, + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one_half + v_wall_thickness, + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + ] + ) + + connection_top_left = _np.array( + [ + [ + v_zero, + v_one, + v_one, + ], + [ + v_zero, + v_zero, + v_one, + ], + [ + v_zero, + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + ], + [ + v_zero, + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one_half - v_wall_thickness, + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + ] + ) + + connection_bottom_left = _np.array( + [ + [ + v_zero, + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + ], + [ + v_zero, + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + ], + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one_half - v_wall_thickness, + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + ] + ) + + connection_bottom_right = _np.array( + [ + [ + v_one, + v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + v_one, + -v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + ] + ) + + elif closure == "z_min": + # set points: + # set points: + right = _np.array( + [ + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + -v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + -v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + ] + ) + + connection_front_right = _np.array( + [ + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + ] + ) + + front = _np.array( + [ + [ + v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + ] + ) + + connection_back_left = _np.array( + [ + [ + -v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + -v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_zero, + -v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_zero, + v_one_half - v_half_contact_length, + ], + ] + ) + + left = _np.array( + [ + [ + v_zero, + -v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + -v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_zero, + v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + ] + ) + + connection_front_left = _np.array( + [ + [ + v_zero, + v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_zero, + v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + -v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + ] + ) + + back = _np.array( + [ + [ + v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_zero, + v_one_half - v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_zero, + v_one_half - v_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + ] + ) + + connection_back_right = _np.array( + [ + [ + v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + -v_wall_thickness + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_half_contact_length + v_one_half, + v_zero, + v_one_half - v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one, + -v_half_contact_length + v_one_half, + v_one_half + v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + -v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + ] + ) + + bottom = _np.array( + [ + [ + v_one, + v_one, + v_zero, + ], + [ + v_zero, + v_one, + v_zero, + ], + [ + v_one, + v_zero, + v_zero, + ], + [ + v_zero, + v_zero, + v_zero, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + ] + ) + + top = _np.array( + [ + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + ] + ) + + connection_front_bottom = _np.array( + [ + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half - v_half_contact_length, + ], + [ + v_one, + v_one, + v_zero, + ], + [ + v_zero, + v_one, + v_zero, + ], + [ + v_inner_half_contact_length + v_one_half, + v_one_half + v_wall_thickness, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_one_half + v_wall_thickness, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + ] + ) + + connection_front_top = _np.array( + [ + [ + v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_one, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + v_one_half + v_wall_thickness, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_one_half + v_wall_thickness, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + ] + ) + + connection_back_bottom = _np.array( + [ + [ + v_one, + v_zero, + v_zero, + ], + [ + v_zero, + v_zero, + v_zero, + ], + [ + v_one_half + v_half_contact_length, + v_zero, + v_one_half - v_half_contact_length, + ], + [ + v_one_half - v_half_contact_length, + v_zero, + v_one_half - v_half_contact_length, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, + v_one_half - v_inner_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, + v_one_half - v_inner_half_contact_length, + ], + ] + ) - connection_back_top = _np.array( - [ - [ - v_one, - v_zero, - v_one, - ], - [ - v_zero, - v_zero, - v_one, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half + v_inner_half_contact_length, - ], - ] - ) + connection_back_top = _np.array( + [ + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + ], + ] + ) - connection_top_right = _np.array( - [ - [ - v_one, - v_one, - v_one, - ], - [ - v_one, - v_zero, - v_one, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one, - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - ], - [ - v_one, - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - ], - [ - v_one_half + v_wall_thickness, - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one_half + v_wall_thickness, - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - ], - ] - ) + connection_top_right = _np.array( + [ + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one, + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + ], + [ + v_one, + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + ], + [ + v_one_half + v_wall_thickness, + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one_half + v_wall_thickness, + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + ] + ) - connection_top_left = _np.array( - [ - [ - v_zero, - v_one, - v_one, - ], - [ - v_zero, - v_zero, - v_one, - ], - [ - v_zero, - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - ], - [ - v_zero, - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_wall_thickness, - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - ], - ] - ) + connection_top_left = _np.array( + [ + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + [ + v_zero, + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + ], + [ + v_zero, + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one_half - v_wall_thickness, + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + ] + ) - connection_bottom_left = _np.array( - [ - [ - v_zero, - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - ], - [ - v_zero, - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_wall_thickness, - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - ] - ) + connection_bottom_left = _np.array( + [ + [ + v_zero, + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + ], + [ + v_zero, + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + ], + [ + v_zero, + v_one, + v_zero, + ], + [ + v_zero, + v_zero, + v_zero, + ], + [ + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one_half - v_wall_thickness, + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + ] + ) - connection_bottom_right = _np.array( - [ - [ - v_one, - v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - v_one, - -v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - ] + connection_bottom_right = _np.array( + [ + [ + v_one, + v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + v_one, + -v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one, + v_one, + v_zero, + ], + [ + v_one, + v_zero, + v_zero, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + ] + ) + + for control_points in [ + right, + connection_front_right, + front, + connection_back_left, + left, + connection_front_left, + back, + connection_back_right, + bottom, + top, + connection_front_bottom, + connection_front_top, + connection_back_bottom, + connection_back_top, + connection_top_right, + connection_top_left, + connection_bottom_left, + connection_bottom_right, + ]: + spline_list.append( + _Bezier(degrees=[1, 1, 1], control_points=control_points) + ) + + if i_derivative == 0: + splines = spline_list.copy() + else: + derivatives.append(spline_list) + + return (splines, derivatives) + + def create_tile( + self, + parameters=None, + parameter_sensitivities=None, # TODO + contact_length=0.3, + closure=None, + **kwargs, # noqa ARG002 + ): + """Create a microtile based on the parameters that describe the wall + thicknesses. + + Thickness parameters are used to describe the inner radius of the + outward facing branches + + Parameters + ---------- + parameters : np.array + One evaluation point with one parameter is used. This parameter + describes the thickness of the wall. The parameters must be a + two-dimensional np.array, where the value must be between 0.01 + and 0.49 + parameter_sensitivities: np.ndarray + Describes the parameter sensitivities with respect to some design + variable. In case the design variables directly apply to the + parameter itself, they evaluate as delta_ij + contact_length : float + the length of the wall that contacts the other microstructure + closure : str + parametric dimension that needs to be closed, given in the form + "x_min", "x_max", etc. + + Returns + ------- + microtile_list : list(splines) + derivative_list : list / None + """ + + self._check_custom_parameter( + contact_length, "contact length", self._CONTACT_LENGTH_BOUNDS + ) + + parameters, n_derivatives, derivatives = self._process_input( + parameters=parameters, + parameter_sensitivities=parameter_sensitivities, + ) + + if closure is not None: + return self._closing_tile( + parameters=parameters, + parameter_sensitivities=parameter_sensitivities, + contact_length=contact_length, + closure=closure, + **kwargs, ) - elif closure == "z_min": - # set points: + splines = [] + for i_derivative in range(n_derivatives + 1): + if i_derivative == 0: + v_wall_thickness = parameters[0, 0] + v_zero = 0.0 + v_one_half = 0.5 + v_one = 1.0 + v_half_contact_length = contact_length * 0.5 + v_inner_half_contact_length = contact_length * v_wall_thickness + else: + v_wall_thickness = parameter_sensitivities[ + 0, 0, i_derivative - 1 + ] + v_zero = 0.0 + v_one_half = 0.0 + v_one = 0.0 + v_half_contact_length = 0.0 + v_inner_half_contact_length = contact_length * v_wall_thickness + + spline_list = [] + # set points: right = _np.array( [ @@ -4520,23 +5447,23 @@ def _closing_tile( bottom = _np.array( [ [ - v_one, - v_one, + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, v_zero, ], [ - v_zero, - v_one, + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, v_zero, ], [ - v_one, - v_zero, + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, v_zero, ], [ - v_zero, - v_zero, + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, v_zero, ], [ @@ -4620,13 +5547,13 @@ def _closing_tile( v_one_half - v_half_contact_length, ], [ - v_one, - v_one, + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, v_zero, ], [ - v_zero, - v_one, + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, v_zero, ], [ @@ -4699,1286 +5626,301 @@ def _closing_tile( connection_back_bottom = _np.array( [ - [ - v_one, - v_zero, - v_zero, - ], - [ - v_zero, - v_zero, - v_zero, - ], [ v_one_half + v_half_contact_length, - v_zero, - v_one_half - v_half_contact_length, - ], - [ v_one_half - v_half_contact_length, v_zero, - v_one_half - v_half_contact_length, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - ], - ] - ) - - connection_back_top = _np.array( - [ - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, ], [ v_one_half - v_half_contact_length, v_one_half - v_half_contact_length, - v_one, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, v_zero, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half + v_inner_half_contact_length, - ], - ] - ) - - connection_top_right = _np.array( - [ - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one, - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - ], - [ - v_one, - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, ], [ - v_one_half + v_wall_thickness, - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one_half + v_wall_thickness, - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - ], - ] - ) - - connection_top_left = _np.array( - [ - [ - v_one_half - v_half_contact_length, v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - [ - v_zero, - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - ], - [ v_zero, v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_wall_thickness, - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, ], - ] - ) - - connection_bottom_left = _np.array( - [ [ - v_zero, - v_one_half + v_half_contact_length, v_one_half - v_half_contact_length, - ], - [ v_zero, v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - ], - [ - v_zero, - v_one, - v_zero, - ], - [ - v_zero, - v_zero, - v_zero, ], [ - v_one_half - v_wall_thickness, v_one_half + v_inner_half_contact_length, v_one_half - v_inner_half_contact_length, - ], - [ - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, v_one_half - v_wall_thickness, ], [ v_one_half - v_inner_half_contact_length, v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - ] - ) - - connection_bottom_right = _np.array( - [ - [ - v_one, - v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - v_one, - -v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, + v_one_half - v_wall_thickness, ], [ - v_wall_thickness + v_one_half, v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, v_one_half - v_inner_half_contact_length, ], [ - v_wall_thickness + v_one_half, -v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, v_one_half - v_inner_half_contact_length, ], + ] + ) + + connection_back_top = _np.array( + [ [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, v_one, - v_one, - v_zero, ], [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, v_one, - v_zero, - v_zero, ], [ v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, ], [ - v_one_half + v_inner_half_contact_length, v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - ] - ) - - spline_list.append( - _Bezier(degrees=[1, 1, 1], control_points=connection_bottom_left) - ) - - spline_list.append( - _Bezier(degrees=[1, 1, 1], control_points=connection_bottom_right) - ) - - spline_list.append( - _Bezier(degrees=[1, 1, 1], control_points=connection_back_bottom) - ) - - spline_list.append( - _Bezier(degrees=[1, 1, 1], control_points=connection_front_bottom) - ) - spline_list.append( - _Bezier(degrees=[1, 1, 1], control_points=connection_front_top) - ) - - spline_list.append( - _Bezier(degrees=[1, 1, 1], control_points=connection_back_top) - ) - - spline_list.append( - _Bezier(degrees=[1, 1, 1], control_points=connection_top_right) - ) - - spline_list.append( - _Bezier(degrees=[1, 1, 1], control_points=connection_front_left) - ) - - spline_list.append(_Bezier(degrees=[1, 1, 1], control_points=right)) - - spline_list.append( - _Bezier(degrees=[1, 1, 1], control_points=connection_front_right) - ) - - spline_list.append(_Bezier(degrees=[1, 1, 1], control_points=back)) - - spline_list.append( - _Bezier(degrees=[1, 1, 1], control_points=connection_back_left) - ) - - spline_list.append(_Bezier(degrees=[1, 1, 1], control_points=left)) - - spline_list.append( - _Bezier(degrees=[1, 1, 1], control_points=connection_top_left) - ) - - spline_list.append(_Bezier(degrees=[1, 1, 1], control_points=front)) - - spline_list.append( - _Bezier(degrees=[1, 1, 1], control_points=connection_back_right) - ) - - spline_list.append(_Bezier(degrees=[1, 1, 1], control_points=bottom)) - - spline_list.append(_Bezier(degrees=[1, 1, 1], control_points=top)) - - return (spline_list, None) - - def create_tile( - self, - parameters=None, - parameter_sensitivities=None, # TODO - contact_length=0.3, - closure=None, - **kwargs, # noqa ARG002 - ): - """Create a microtile based on the parameters that describe the wall - thicknesses. - - Thickness parameters are used to describe the inner radius of the - outward facing branches - - Parameters - ---------- - parameters : np.array - One evaluation point with one parameter is used. This parameter - describes the thickness of the wall. The parameters must be a - two-dimensional np.array, where the value must be between 0.01 - and 0.49 - parameter_sensitivities: np.ndarray - Describes the parameter sensitivities with respect to some design - variable. In case the design variables directly apply to the - parameter itself, they evaluate as delta_ij - contact_length : float - the length of the wall that contacts the other microstructure - closure : str - parametric dimension that needs to be closed, given in the form - "x_min", "x_max", etc. - - Returns - ------- - microtile_list : list(splines) - derivative_list : list / None - """ - - if not isinstance(contact_length, float): - raise ValueError("Invalid Type for radius") - - if not ((contact_length > 0) and (contact_length < 0.99)): - raise ValueError("The length of a side must be in (0.01, 0.99)") - - if parameters is None: - self._logd("Setting parameters to default values (0.2)") - parameters = _np.array( - _np.ones( - (len(self._evaluation_points), self._n_info_per_eval_point) - ) - * 0.2 - ) - - self.check_params(parameters) - - if parameter_sensitivities is not None: - raise NotImplementedError( - "Derivatives are not implemented for this tile yet" - ) - - if not (_np.all(parameters > 0) and _np.all(parameters < 0.5)): - raise ValueError( - "The thickness of the wall must be in (0.01 and 0.49)" - ) - - if closure is not None: - return self._closing_tile( - parameters=parameters, - parameter_sensitivities=parameter_sensitivities, - contact_length=contact_length, - closure=closure, - **kwargs, - ) - - v_wall_thickness = parameters[0, 0] - v_zero = 0.0 - v_one_half = 0.5 - v_one = 1.0 - v_half_contact_length = contact_length * 0.5 - v_half_contact_length = contact_length * 0.5 - v_inner_half_contact_length = contact_length * parameters[0, 0] - - spline_list = [] - - # set points: - right = _np.array( - [ - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - -v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one, - -v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one, - v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - ] - ) - - connection_front_right = _np.array( - [ - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one, - v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - ] - ) - - front = _np.array( - [ - [ - v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - ] - ) - - connection_back_left = _np.array( - [ - [ - -v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - -v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_zero, - -v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_zero, - v_one_half - v_half_contact_length, - ], - ] - ) - - left = _np.array( - [ - [ - v_zero, - -v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - -v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_zero, - v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - ] - ) - - connection_front_left = _np.array( - [ - [ - v_zero, - v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_zero, - v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - -v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - ] - ) - - back = _np.array( - [ - [ - v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_zero, - v_one_half - v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_zero, - v_one_half - v_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - ] - ) - - connection_back_right = _np.array( - [ - [ - v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - -v_wall_thickness + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_half_contact_length + v_one_half, - v_zero, - v_one_half - v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one, - -v_half_contact_length + v_one_half, - v_one_half + v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one, - -v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - ] - ) - - bottom = _np.array( - [ - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - ] - ) - - top = _np.array( - [ - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - ] - ) - - connection_front_bottom = _np.array( - [ - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half - v_half_contact_length, - ], - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_inner_half_contact_length + v_one_half, - v_one_half + v_wall_thickness, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_one_half + v_wall_thickness, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - ] - ) - - connection_front_top = _np.array( - [ - [ - v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_one, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - v_one_half + v_wall_thickness, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_one_half + v_wall_thickness, - v_one_half + v_inner_half_contact_length, - ], - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - ] - ) - - connection_back_bottom = _np.array( - [ - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_half_contact_length, - v_zero, - v_one_half - v_half_contact_length, - ], - [ - v_one_half - v_half_contact_length, - v_zero, - v_one_half - v_half_contact_length, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - [ - v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - ], - ] - ) - - connection_back_top = _np.array( - [ - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - -v_half_contact_length + v_one_half, - v_zero, - v_one_half + v_half_contact_length, - ], - [ - v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half + v_inner_half_contact_length, - ], - [ - -v_inner_half_contact_length + v_one_half, - v_one_half - v_wall_thickness, - v_one_half + v_inner_half_contact_length, - ], - ] - ) + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + -v_half_contact_length + v_one_half, + v_zero, + v_one_half + v_half_contact_length, + ], + [ + v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + ], + [ + -v_inner_half_contact_length + v_one_half, + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + ], + ] + ) - connection_top_right = _np.array( - [ - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one, - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - ], - [ - v_one, - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - ], - [ - v_one_half + v_wall_thickness, - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - ], + connection_top_right = _np.array( [ - v_one_half + v_wall_thickness, - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - ], - ] - ) + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one, + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + ], + [ + v_one, + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + ], + [ + v_one_half + v_wall_thickness, + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one_half + v_wall_thickness, + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + ] + ) - connection_top_left = _np.array( - [ - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_one, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_one, - ], - [ - v_zero, - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - ], - [ - v_zero, - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half + v_wall_thickness, - ], - [ - v_one_half - v_wall_thickness, - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - ], + connection_top_left = _np.array( [ - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - ], - ] - ) + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_one, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_one, + ], + [ + v_zero, + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + ], + [ + v_zero, + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half + v_wall_thickness, + ], + [ + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + [ + v_one_half - v_wall_thickness, + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + ], + ] + ) - connection_bottom_left = _np.array( - [ - [ - v_zero, - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - ], - [ - v_zero, - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - ], - [ - v_one_half - v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half - v_wall_thickness, - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one_half - v_wall_thickness, - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one_half - v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], + connection_bottom_left = _np.array( [ - v_one_half - v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - ] - ) + [ + v_zero, + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + ], + [ + v_zero, + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + ], + [ + v_one_half - v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half - v_wall_thickness, + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one_half - v_wall_thickness, + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half - v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + ] + ) - connection_bottom_right = _np.array( - [ - [ - v_one, - v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - v_one, - -v_half_contact_length + v_one_half, - v_one_half - v_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_wall_thickness + v_one_half, - -v_inner_half_contact_length + v_one_half, - v_one_half - v_inner_half_contact_length, - ], - [ - v_one_half + v_half_contact_length, - v_one_half + v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_half_contact_length, - v_one_half - v_half_contact_length, - v_zero, - ], - [ - v_one_half + v_inner_half_contact_length, - v_one_half + v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], + connection_bottom_right = _np.array( [ - v_one_half + v_inner_half_contact_length, - v_one_half - v_inner_half_contact_length, - v_one_half - v_wall_thickness, - ], - ] - ) - - spline_list.append(_Bezier(degrees=[1, 1, 1], control_points=right)) - - spline_list.append( - _Bezier(degrees=[1, 1, 1], control_points=connection_front_right) - ) - - spline_list.append(_Bezier(degrees=[1, 1, 1], control_points=back)) - - spline_list.append( - _Bezier(degrees=[1, 1, 1], control_points=connection_back_left) - ) - - spline_list.append(_Bezier(degrees=[1, 1, 1], control_points=left)) - - spline_list.append( - _Bezier(degrees=[1, 1, 1], control_points=connection_front_left) - ) - - spline_list.append(_Bezier(degrees=[1, 1, 1], control_points=front)) - - spline_list.append( - _Bezier(degrees=[1, 1, 1], control_points=connection_back_right) - ) - - spline_list.append(_Bezier(degrees=[1, 1, 1], control_points=bottom)) - - spline_list.append(_Bezier(degrees=[1, 1, 1], control_points=top)) - - spline_list.append( - _Bezier(degrees=[1, 1, 1], control_points=connection_front_top) - ) - - spline_list.append( - _Bezier(degrees=[1, 1, 1], control_points=connection_front_bottom) - ) - - spline_list.append( - _Bezier(degrees=[1, 1, 1], control_points=connection_back_bottom) - ) - - spline_list.append( - _Bezier(degrees=[1, 1, 1], control_points=connection_back_top) - ) - - spline_list.append( - _Bezier(degrees=[1, 1, 1], control_points=connection_top_right) - ) + [ + v_one, + v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + v_one, + -v_half_contact_length + v_one_half, + v_one_half - v_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_wall_thickness + v_one_half, + -v_inner_half_contact_length + v_one_half, + v_one_half - v_inner_half_contact_length, + ], + [ + v_one_half + v_half_contact_length, + v_one_half + v_half_contact_length, + v_zero, + ], + [ + v_one_half + v_half_contact_length, + v_one_half - v_half_contact_length, + v_zero, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half + v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + [ + v_one_half + v_inner_half_contact_length, + v_one_half - v_inner_half_contact_length, + v_one_half - v_wall_thickness, + ], + ] + ) - spline_list.append( - _Bezier(degrees=[1, 1, 1], control_points=connection_top_left) - ) + for control_points in [ + right, + connection_front_right, + front, + connection_back_left, + left, + connection_front_left, + back, + connection_back_right, + bottom, + top, + connection_front_bottom, + connection_front_top, + connection_back_bottom, + connection_back_top, + connection_top_right, + connection_top_left, + connection_bottom_left, + connection_bottom_right, + ]: + spline_list.append( + _Bezier(degrees=[1, 1, 1], control_points=control_points) + ) - spline_list.append( - _Bezier(degrees=[1, 1, 1], control_points=connection_bottom_left) - ) - spline_list.append( - _Bezier(degrees=[1, 1, 1], control_points=connection_bottom_right) - ) + if i_derivative == 0: + splines = spline_list.copy() + else: + derivatives.append(spline_list) - return (spline_list, None) + return (splines, derivatives) diff --git a/splinepy/microstructure/tiles/chi.py b/splinepy/microstructure/tiles/chi.py index b8430d0dc..4a48132dd 100644 --- a/splinepy/microstructure/tiles/chi.py +++ b/splinepy/microstructure/tiles/chi.py @@ -16,8 +16,12 @@ class Chi(_TileBase): _dim = 2 _para_dim = 1 - _evaluation_points = _np.array([[0.5, 0.5]]) + _evaluation_points = _np.array([[0.5]]) _n_info_per_eval_point = 1 + _sensitivities_implemented = True + _parameter_bounds = [[-_np.pi / 2, _np.pi / 2]] + _parameters_shape = (1, 1) + _default_parameter_value = _np.pi / 8 def create_tile( self, @@ -41,28 +45,10 @@ def create_tile( microtile_list : list(splines) """ - # set to default if nothing is given - if parameters is None: - self._logd( - "Tile request is not parametrized, setting default Pi/8" - ) - parameters = _np.array([[_np.pi / 8]]) - else: - if not ( - _np.all(parameters >= -_np.pi * 0.5) - and _np.all(parameters < _np.pi * 0.5) - ): - raise ValueError("The parameter must be in -Pi/2 and Pi/2") - pass - self.check_params(parameters) - - # Check if user requests derivative splines - if self.check_param_derivatives(parameter_sensitivities): - n_derivatives = parameter_sensitivities.shape[2] - derivatives = [] - else: - n_derivatives = 0 - derivatives = None + parameters, n_derivatives, derivatives = self._process_input( + parameters=parameters, + parameter_sensitivities=parameter_sensitivities, + ) splines = [] for i_derivative in range(n_derivatives + 1): @@ -75,12 +61,13 @@ def create_tile( s = r * _np.sin(alpha) c = r * _np.cos(alpha) else: - alpha = parameter_sensitivities[0, 0, i_derivative - 1] + alpha = parameters[0, 0] + _np.pi / 4 + dalpha = float(parameter_sensitivities[0, 0, i_derivative - 1]) v_one_half = 0.0 v_zero = 0.0 r = _np.sqrt(0.125) - s = r * _np.cos(alpha) - c = -r * _np.sin(alpha) + s = dalpha * r * _np.cos(alpha) + c = dalpha * -r * _np.sin(alpha) # Init return value spline_list = [] diff --git a/splinepy/microstructure/tiles/cross_2d.py b/splinepy/microstructure/tiles/cross_2d.py index 083d0c65a..990db61f2 100644 --- a/splinepy/microstructure/tiles/cross_2d.py +++ b/splinepy/microstructure/tiles/cross_2d.py @@ -26,6 +26,23 @@ class Cross2D(_TileBase): ] ) _n_info_per_eval_point = 1 + _sensitivities_implemented = True + _closure_directions = ["x_min", "x_max", "y_min", "y_max"] + _parameters_shape = (4, 1) + _default_parameter_value = 0.2 + + # Default value of center_expansion + _center_expansion = 1.0 + + # Dynamical computation of parameter bounds depending on center expansion + @property + def _parameter_bounds(self): + max_radius = min(0.5, (0.5 / self._center_expansion)) + return [[0.0, max_radius]] * 4 + + _BOUNDARY_WIDTH_BOUNDS = [0.0, 0.5] + _FILLING_HEIGHT_BOUNDS = [0.0, 1.0] + _CENTER_EXPANSION_BOUNDS = [0.5, 1.5] def _closing_tile( self, @@ -66,36 +83,17 @@ def _closing_tile( if closure is None: raise ValueError("No closing direction given") - if parameters is None: - self._logd("Tile request is not parametrized, setting default 0.2") - parameters = _np.array( - _np.ones( - (len(self._evaluation_points), self._n_info_per_eval_point) - ) - * 0.2 - ) - - self.check_params(parameters) - - if not (_np.all(parameters > 0) and _np.all(parameters < 0.5)): - raise ValueError("Thickness out of range (0, .5)") - - if not (0.0 < float(boundary_width) < 0.5): - raise ValueError("Boundary Width is out of range") - - if not (0.0 < float(filling_height) < 1.0): - raise ValueError("Filling must be in (0,1)") + parameters, n_derivatives, derivatives = self._process_input( + parameters=parameters, + parameter_sensitivities=parameter_sensitivities, + ) - # Check if user requests derivative splines - if parameter_sensitivities is not None: - # Check format - self.check_param_derivatives(parameter_sensitivities) - - n_derivatives = parameter_sensitivities.shape[2] - derivatives = [] - else: - n_derivatives = 0 - derivatives = None + self._check_custom_parameter( + boundary_width, "boundary width", self._BOUNDARY_WIDTH_BOUNDS + ) + self._check_custom_parameter( + filling_height, "filling height", self._FILLING_HEIGHT_BOUNDS + ) splines = [] for i_derivative in range(n_derivatives + 1): @@ -414,41 +412,16 @@ def create_tile( derivative_list : list / None """ - if not isinstance(center_expansion, float): - raise ValueError("Invalid Type") - - if not ((center_expansion > 0.5) and (center_expansion < 1.5)): - raise ValueError("Center Expansion must be in (.5,1.5)") - - max_radius = min(0.5, (0.5 / center_expansion)) - - # set to default if nothing is given - if parameters is None: - self._logd("Setting branch thickness to default 0.2") - parameters = _np.array( - _np.ones( - (len(self._evaluation_points), self._n_info_per_eval_point) - ) - * 0.2 - ) - - self.check_params(parameters) - - if not (_np.all(parameters > 0) and _np.all(parameters < max_radius)): - raise ValueError(f"Thickness out of range (0, {max_radius})") - - self.check_param_derivatives(parameter_sensitivities) + self._check_custom_parameter( + center_expansion, "center expansion", self._CENTER_EXPANSION_BOUNDS + ) - # Check if user requests derivative splines - if parameter_sensitivities is not None: - # Check format - self.check_param_derivatives(parameter_sensitivities) + self._center_expansion = center_expansion - n_derivatives = parameter_sensitivities.shape[2] - derivatives = [] - else: - n_derivatives = 0 - derivatives = None + parameters, n_derivatives, derivatives = self._process_input( + parameters=parameters, + parameter_sensitivities=parameter_sensitivities, + ) # Closure requested, pass to function if closure is not None: diff --git a/splinepy/microstructure/tiles/cross_3d.py b/splinepy/microstructure/tiles/cross_3d.py index 8752c9881..95fe347b0 100644 --- a/splinepy/microstructure/tiles/cross_3d.py +++ b/splinepy/microstructure/tiles/cross_3d.py @@ -28,6 +28,23 @@ class Cross3D(_TileBase): ] ) _n_info_per_eval_point = 1 + _sensitivities_implemented = True + _closure_directions = ["z_min", "z_max"] + _parameters_shape = (6, 1) + _default_parameter_value = 0.2 + + # Default value of center_expansion + _center_expansion = 1.0 + + # Dynamical computation of parameter bounds depending on center expansion + @property + def _parameter_bounds(self): + max_radius = min(0.5, (0.5 / self._center_expansion)) + return [[0.0, max_radius]] * 6 + + _BOUNDARY_WIDTH_BOUNDS = [0.0, 0.5] + _FILLING_HEIGHT_BOUNDS = [0.0, 1.0] + _CENTER_EXPANSION_BOUNDS = [0.5, 1.5] def _closing_tile( self, @@ -68,32 +85,17 @@ def _closing_tile( if closure is None: raise ValueError("No closing direction given") - if parameters is None: - self._logd("Tile request is not parametrized, setting default 0.2") - parameters = _np.array( - _np.ones( - (len(self._evaluation_points), self._n_info_per_eval_point) - ) - * 0.2 - ) + parameters, n_derivatives, derivatives = self._process_input( + parameters=parameters, + parameter_sensitivities=parameter_sensitivities, + ) - if not (_np.all(parameters > 0) and _np.all(parameters < 0.5)): - raise ValueError("Thickness out of range (0, .5)") - - # Check if user requests derivative splines - if parameter_sensitivities is not None: - self.check_param_derivatives(parameter_sensitivities) - n_derivatives = parameter_sensitivities.shape[2] - derivatives = [] - else: - n_derivatives = 0 - derivatives = None - - if not (0.0 < float(boundary_width) < 0.5): - raise ValueError("Boundary Width is out of range") - - if not (0.0 < float(filling_height) < 1.0): - raise ValueError("Filling must be in (0,1)") + self._check_custom_parameter( + boundary_width, "boundary width", self._BOUNDARY_WIDTH_BOUNDS + ) + self._check_custom_parameter( + filling_height, "filling height", self._FILLING_HEIGHT_BOUNDS + ) splines = [] for i_derivative in range(n_derivatives + 1): @@ -518,45 +520,23 @@ def create_tile( derivative_list : list / None """ - if not isinstance(center_expansion, float): - raise ValueError("Invalid Type") + self._check_custom_parameter( + center_expansion, "center expansion", self._CENTER_EXPANSION_BOUNDS + ) - if not ((center_expansion > 0.5) and (center_expansion < 1.5)): - raise ValueError("Center Expansion must be in (.5,1.5)") + self._center_expansion = center_expansion - # Max radius, so there is no tanglement in the crosstile - max_radius = min(0.5, (0.5 / center_expansion)) - - # set to default if nothing is given - if parameters is None: - self._logd("Setting branch thickness to default 0.2") - parameters = ( - _np.ones( - ( - self._evaluation_points.shape[0], - self._n_info_per_eval_point, - ) - ) - * 0.2 - ) - - # Check for type and consistency - self.check_params(parameters) - if _np.any(parameters <= 0) or _np.any(parameters > max_radius): - raise ValueError( - f"Radii must be in (0,{max_radius}) for " - f"center_expansion {center_expansion}" - ) - - if parameter_sensitivities is not None: - self.check_param_derivatives(parameter_sensitivities) - n_derivatives = parameter_sensitivities.shape[2] - derivatives = [] - else: - n_derivatives = 0 - derivatives = None + parameters, n_derivatives, derivatives = self._process_input( + parameters=parameters, + parameter_sensitivities=parameter_sensitivities, + ) if closure is not None: + if closure not in self._closure_directions: + raise NotImplementedError( + f"Closure '{closure}' not implemented. Supported closures are: " + + f"{self._closure_directions}" + ) return self._closing_tile( parameters=parameters, parameter_sensitivities=parameter_sensitivities, diff --git a/splinepy/microstructure/tiles/cross_3d_linear.py b/splinepy/microstructure/tiles/cross_3d_linear.py index 3e5901371..c41697857 100644 --- a/splinepy/microstructure/tiles/cross_3d_linear.py +++ b/splinepy/microstructure/tiles/cross_3d_linear.py @@ -28,6 +28,23 @@ class Cross3DLinear(_TileBase): ] ) _n_info_per_eval_point = 1 + _sensitivities_implemented = True + _closure_directions = ["z_min", "z_max"] + _parameters_shape = (6, 1) + _default_parameter_value = 0.2 + + # Default value of center_expansion + _center_expansion = 1.0 + + # Dynamical computation of parameter bounds depending on center expansion + @property + def _parameter_bounds(self): + max_radius = min(0.5, (0.5 / self._center_expansion)) + return [[0.0, max_radius]] * 6 + + _BOUNDARY_WIDTH_BOUNDS = [0.0, 0.5] + _FILLING_HEIGHT_BOUNDS = [0.0, 1.0] + _CENTER_EXPANSION_BOUNDS = [0.5, 1.5] def _closing_tile( self, @@ -68,32 +85,17 @@ def _closing_tile( if closure is None: raise ValueError("No closing direction given") - if parameters is None: - self._logd("Tile request is not parametrized, setting default 0.2") - parameters = _np.array( - _np.ones( - (len(self._evaluation_points), self._n_info_per_eval_point) - ) - * 0.2 - ) - - if not (_np.all(parameters > 0) and _np.all(parameters < 0.5)): - raise ValueError("Thickness out of range (0, .5)") - - # Check if user requests derivative splines - if parameter_sensitivities is not None: - self.check_param_derivatives(parameter_sensitivities) - n_derivatives = parameter_sensitivities.shape[2] - derivatives = [] - else: - n_derivatives = 0 - derivatives = None - - if not (0.0 < float(boundary_width) < 0.5): - raise ValueError("Boundary Width is out of range") + parameters, n_derivatives, derivatives = self._process_input( + parameters=parameters, + parameter_sensitivities=parameter_sensitivities, + ) - if not (0.0 < float(filling_height) < 1.0): - raise ValueError("Filling must be in (0,1)") + self._check_custom_parameter( + boundary_width, "boundary width", self._BOUNDARY_WIDTH_BOUNDS + ) + self._check_custom_parameter( + filling_height, "filling height", self._FILLING_HEIGHT_BOUNDS + ) splines = [] for i_derivative in range(n_derivatives + 1): @@ -474,43 +476,16 @@ def create_tile( derivative_list : list / None """ - if not isinstance(center_expansion, float): - raise ValueError("Invalid Type") + self._check_custom_parameter( + center_expansion, "center expansion", self._CENTER_EXPANSION_BOUNDS + ) - if not ((center_expansion > 0.5) and (center_expansion < 1.5)): - raise ValueError("Center Expansion must be in (.5,1.5)") - - # Max radius, so there is no tanglement in the crosstile - max_radius = min(0.5, (0.5 / center_expansion)) - - # set to default if nothing is given - if parameters is None: - self._logd("Setting branch thickness to default 0.2") - parameters = ( - _np.ones( - ( - self._evaluation_points.shape[0], - self._n_info_per_eval_point, - ) - ) - * 0.2 - ) - - # Check for type and consistency - self.check_params(parameters) - if _np.any(parameters <= 0) or _np.any(parameters > max_radius): - raise ValueError( - f"Radii must be in (0,{max_radius}) for " - f"center_expansion {center_expansion}" - ) + self._center_expansion = center_expansion - if parameter_sensitivities is not None: - self.check_param_derivatives(parameter_sensitivities) - n_derivatives = parameter_sensitivities.shape[2] - derivatives = [] - else: - n_derivatives = 0 - derivatives = None + parameters, n_derivatives, derivatives = self._process_input( + parameters=parameters, + parameter_sensitivities=parameter_sensitivities, + ) if closure is not None: return self._closing_tile( diff --git a/splinepy/microstructure/tiles/cube_void.py b/splinepy/microstructure/tiles/cube_void.py index be4f1ab3a..0ac29e965 100644 --- a/splinepy/microstructure/tiles/cube_void.py +++ b/splinepy/microstructure/tiles/cube_void.py @@ -25,6 +25,17 @@ class CubeVoid(_TileBase): _para_dim = 3 _evaluation_points = _np.array([[0.5, 0.5, 0.5]]) _n_info_per_eval_point = 4 + _sensitivities_implemented = True + # TODO: clever parameter bounds and checks if given parametrization would + # still lie in unit cube + _parameter_bounds = [ + [0.0, 1.0], + [0.0, 1.0], + [-_np.pi / 2, _np.pi / 2], + [-_np.pi / 2, _np.pi / 2], + ] + _parameters_shape = (1, 4) + _default_parameter_value = _np.array([[0.5, 0.5, 0.0, 0.0]]) # Aux values _sphere_ctps = _np.array( @@ -54,7 +65,7 @@ def _rotation_matrix_y(self, angle): def _rotation_matrix_y_deriv(self, angle): cc, ss = _np.cos(angle), _np.sin(angle) - return _np.array([[-ss, 0, -cc], [0, 1, 0], [cc, 0, -ss]]) + return _np.array([[-ss, 0, -cc], [0, 0, 0], [cc, 0, -ss]]) def create_tile( self, @@ -90,21 +101,16 @@ def create_tile( microtile_list : list(splines) derivatives : list> / None """ # set to default if nothing is given - if parameters is None: - parameters = _np.array([0.5, 0.5, 0, 0]).reshape(1, 1, 4) + + parameters, n_derivatives, derivatives = self._process_input( + parameters=parameters, + parameter_sensitivities=parameter_sensitivities, + ) # Create center ellipsoid # RotY * RotX * DIAG(r_x, r_yz) * T_base [r_x, r_yz, rot_x, rot_y] = parameters.flatten() - # Check if user requests derivative splines - if self.check_param_derivatives(parameter_sensitivities): - n_derivatives = parameter_sensitivities.shape[2] - derivatives = [] - else: - n_derivatives = 0 - derivatives = None - # Prepare auxiliary matrices and values diag = _np.diag([r_x, r_yz, r_yz]) rotMx = self._rotation_matrix_x(rot_x) diff --git a/splinepy/microstructure/tiles/double_lattice.py b/splinepy/microstructure/tiles/double_lattice.py index ad8f6e803..eda6cd5d8 100644 --- a/splinepy/microstructure/tiles/double_lattice.py +++ b/splinepy/microstructure/tiles/double_lattice.py @@ -20,6 +20,12 @@ class DoubleLattice(_TileBase): _para_dim = 2 _evaluation_points = _np.array([[0.5, 0.5]]) _n_info_per_eval_point = 2 + _sensitivities_implemented = True + _parameter_bounds = [[0.0, 1 / (2 * (1 + _np.sqrt(2)))]] * 2 + _parameters_shape = (1, 2) + _default_parameter_value = 0.1 + + _CONTACT_LENGTH_BOUNDS = [0.0, 1.0] def create_tile( self, @@ -44,38 +50,20 @@ def create_tile( correlates with thickness of branches and entouring wall contact_length : double required for conformity between tiles, sets the length of the center - block on the tiles boundary + block on the tile's boundary Returns ------- microtile_list : list(splines) """ - if not isinstance(contact_length, float): - raise ValueError("Invalid Type") - if not ((contact_length > 0.0) and (contact_length < 1.0)): - raise ValueError("Contact length must be in (0.,1.)") - - # set to default if nothing is given - if parameters is None: - self._logd("Tile request is not parametrized, setting default 0.2") - parameters = _np.ones((1, 2)) * 0.1 - if not ( - _np.all(parameters > 0) - and _np.all(parameters < 0.5 / (1 + _np.sqrt(2))) - ): - raise ValueError( - "Parameters must be between 0.01 and 0.5/(1+sqrt(2))=0.207" - ) - - self.check_params(parameters) - - # Check if user requests derivative splines - if self.check_param_derivatives(parameter_sensitivities): - n_derivatives = parameter_sensitivities.shape[2] - derivatives = [] - else: - n_derivatives = 0 - derivatives = None + self._check_custom_parameter( + contact_length, "contact length", self._CONTACT_LENGTH_BOUNDS + ) + + parameters, n_derivatives, derivatives = self._process_input( + parameters=parameters, + parameter_sensitivities=parameter_sensitivities, + ) splines = [] for i_derivative in range(n_derivatives + 1): diff --git a/splinepy/microstructure/tiles/ellips_v_oid.py b/splinepy/microstructure/tiles/ellips_v_oid.py index 4b6e7bf23..37d12c669 100644 --- a/splinepy/microstructure/tiles/ellips_v_oid.py +++ b/splinepy/microstructure/tiles/ellips_v_oid.py @@ -7,6 +7,9 @@ class EllipsVoid(_TileBase): """Void in form of an ellipsoid set into a unit cell. + TODO: Currently this tile is skipped for testing, since the control points easily + lie outside of the unit cube, even though the tile itself lies within it + The Ellips(v)oid :D Parametrization acts on the elipsoid's orientation as well as on its @@ -27,6 +30,18 @@ class EllipsVoid(_TileBase): _para_dim = 3 _evaluation_points = _np.array([[0.5, 0.5, 0.5]]) _n_info_per_eval_point = 4 + _sensitivities_implemented = True + # TODO: clever parameter bounds and checks if given parametrization would + # still lie in unit cube + # Due to ellipsoid, control points very easily lie outside unit cube + _parameter_bounds = [ + [0.0, 1.0], + [0.0, 1.0], + [-_np.pi / 2, _np.pi / 2], + [-_np.pi / 2, _np.pi / 2], + ] + _parameters_shape = (1, 4) + _default_parameter_value = _np.array([[0.5, 0.5, 0, 0]]) # Aux values _c0 = 0.5 / 3**0.5 @@ -80,7 +95,7 @@ def _rotation_matrix_y(self, angle): def _rotation_matrix_y_deriv(self, angle): cc, ss = _np.cos(angle), _np.sin(angle) - return _np.array([[-ss, 0, -cc], [0, 1, 0], [cc, 0, -ss]]) + return _np.array([[-ss, 0, -cc], [0, 0, 0], [cc, 0, -ss]]) def create_tile( self, @@ -116,21 +131,15 @@ def create_tile( microtile_list : list(splines) derivatives: list> / None """ # set to default if nothing is given - if parameters is None: - parameters = _np.array([0.5, 0.5, 0, 0]).reshape(1, 1, 4) + parameters, n_derivatives, derivatives = self._process_input( + parameters=parameters, + parameter_sensitivities=parameter_sensitivities, + ) # Create center ellipsoid # RotY * RotX * DIAG(r_x, r_yz) * T_base [r_x, r_yz, rot_x, rot_y] = parameters.flatten() - # Check if user requests derivative splines - if self.check_param_derivatives(parameter_sensitivities): - n_derivatives = parameter_sensitivities.shape[2] - derivatives = [] - else: - n_derivatives = 0 - derivatives = None - # Prepare auxiliary matrices and values diag = _np.diag([r_x, r_yz, r_yz]) rotMx = self._rotation_matrix_x(rot_x) diff --git a/splinepy/microstructure/tiles/hollow_cube.py b/splinepy/microstructure/tiles/hollow_cube.py index cd8cc300a..58d2ba5f8 100644 --- a/splinepy/microstructure/tiles/hollow_cube.py +++ b/splinepy/microstructure/tiles/hollow_cube.py @@ -28,6 +28,10 @@ class HollowCube(_TileBase): ] ) _n_info_per_eval_point = 1 + _sensitivities_implemented = True + _parameter_bounds = [[0.0, 0.5]] * 7 + _parameters_shape = (7, 1) + _default_parameter_value = 0.2 def create_tile( self, @@ -54,35 +58,10 @@ def create_tile( microtile_list : list(splines) """ - if parameters is None: - self._logd("Setting parameters to default value (0.2)") - parameters = ( - _np.ones( - (len(self._evaluation_points), self._n_info_per_eval_point) - ).reshape(-1, 1) - * 0.2 - ) - - self.check_params(parameters) - - if not ( - _np.all(parameters[:, :2] > 0.0) - and _np.all(parameters[:, :2] < 0.5) - ): - raise ValueError("The wall thickness must be in (0.0 and 0.5)") - - if not _np.all( - (parameters[:, 2:] > _np.deg2rad(-30)) - and (parameters[:, 2:] < _np.deg2rad(30)) - ): - raise ValueError("Rotation is only allowed between +-30 deg") - - if self.check_param_derivatives(parameter_sensitivities): - n_derivatives = parameter_sensitivities.shape[2] - derivatives = [] - else: - n_derivatives = 0 - derivatives = None + parameters, n_derivatives, derivatives = self._process_input( + parameters=parameters, + parameter_sensitivities=parameter_sensitivities, + ) splines = [] diff --git a/splinepy/microstructure/tiles/hollow_octagon.py b/splinepy/microstructure/tiles/hollow_octagon.py index 20a628e17..c099e65c0 100644 --- a/splinepy/microstructure/tiles/hollow_octagon.py +++ b/splinepy/microstructure/tiles/hollow_octagon.py @@ -18,11 +18,18 @@ class HollowOctagon(_TileBase): _para_dim = 2 _evaluation_points = _np.array([[0.5, 0.5]]) _n_info_per_eval_point = 1 + _sensitivities_implemented = True + _closure_directions = ["x_min", "x_max", "y_min", "y_max"] + _parameter_bounds = [[0.0, 0.5]] + _parameters_shape = (1, 1) + _default_parameter_value = 0.2 + + _CONTACT_LENGTH_BOUNDS = [0.0, 0.99] def _closing_tile( self, parameters=None, - parameter_sensitivities=None, # TODO + parameter_sensitivities=None, contact_length=0.2, closure=None, ): @@ -51,262 +58,418 @@ def _closing_tile( if closure is None: raise ValueError("No closing direction given") - if parameters is None: - self._log("Tile request is not parametrized, setting default 0.2") - parameters = _np.array( - _np.ones( - (len(self._evaluation_points), self._n_info_per_eval_point) + parameters, n_derivatives, derivatives = self._process_input( + parameters=parameters, + parameter_sensitivities=parameter_sensitivities, + ) + + v_h_void = parameters[0, 0] + + splines = [] + for i_derivative in range(n_derivatives + 1): + if i_derivative == 0: + v_zero = 0.0 + v_one_half = 0.5 + v_one = 1.0 + v_outer_c_h = contact_length * 0.5 + v_inner_c_h = contact_length * v_h_void + else: + v_zero = 0.0 + v_one_half = 0.0 + v_one = 0.0 + v_h_void = parameter_sensitivities[0, 0, i_derivative - 1] + v_outer_c_h = 0.0 + v_inner_c_h = contact_length * v_h_void + + spline_list = [] + + if closure == "x_min": + # set points: + right = _np.array( + [ + [v_h_void + v_one_half, -v_inner_c_h + v_one_half], + [v_one, -v_outer_c_h + v_one_half], + [v_h_void + v_one_half, v_inner_c_h + v_one_half], + [v_one, v_outer_c_h + v_one_half], + ] ) - * 0.2 - ) - if not (_np.all(parameters > 0) and _np.all(parameters < 0.5)): - raise ValueError( - "The thickness of the wall must be in (0.01 and 0.49)" - ) + right_top = _np.array( + [ + [v_h_void + v_one_half, v_inner_c_h + v_one_half], + [v_one, v_outer_c_h + v_one_half], + [v_inner_c_h + v_one_half, v_h_void + v_one_half], + [v_outer_c_h + v_one_half, v_one], + ] + ) - self.check_params(parameters) + top = _np.array( + [ + [v_inner_c_h + v_one_half, v_h_void + v_one_half], + [v_outer_c_h + v_one_half, v_one], + [-v_inner_c_h + v_one_half, v_h_void + v_one_half], + [-v_outer_c_h + v_one_half, v_one], + ] + ) - if parameter_sensitivities is not None: - raise NotImplementedError( - "Derivatives are not implemented for this tile yet" - ) + bottom_left = _np.array( + [ + [-v_h_void + v_one_half, -v_inner_c_h + v_one_half], + [v_zero, v_zero], + [-v_inner_c_h + v_one_half, -v_h_void + v_one_half], + [-v_outer_c_h + v_one_half, v_zero], + ] + ) - v_h_void = parameters[0, 0] - if not ((v_h_void > 0.01) and (v_h_void < 0.5)): - raise ValueError( - "The thickness of the wall must be in (0.01 and 0.49)" - ) + left = _np.array( + [ + [v_zero, v_zero], + [-v_h_void + v_one_half, -v_inner_c_h + v_one_half], + [v_zero, v_one], + [-v_h_void + v_one_half, v_inner_c_h + v_one_half], + ] + ) - spline_list = [] - v_zero = 0.0 - v_one_half = 0.5 - v_one = 1.0 - v_outer_c_h = contact_length * 0.5 - v_inner_c_h = contact_length * parameters[0, 0] + top_left = _np.array( + [ + [v_zero, v_one], + [-v_h_void + v_one_half, v_inner_c_h + v_one_half], + [-v_outer_c_h + v_one_half, v_one], + [-v_inner_c_h + v_one_half, v_h_void + v_one_half], + ] + ) - if closure == "x_min": - # set points: - right = _np.array( - [ - [v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_one, -v_outer_c_h + v_one_half], - [v_h_void + v_one_half, v_inner_c_h + v_one_half], - [v_one, v_outer_c_h + v_one_half], - ] - ) + bottom = _np.array( + [ + [v_outer_c_h + v_one_half, v_zero], + [v_inner_c_h + v_one_half, -v_h_void + v_one_half], + [-v_outer_c_h + v_one_half, v_zero], + [-v_inner_c_h + v_one_half, -v_h_void + v_one_half], + ] + ) - right_top = _np.array( - [ - [v_h_void + v_one_half, v_inner_c_h + v_one_half], - [v_one, v_outer_c_h + v_one_half], - [v_inner_c_h + v_one_half, v_h_void + v_one_half], - [v_outer_c_h + v_one_half, v_one], - ] - ) + bottom_right = _np.array( + [ + [v_inner_c_h + v_one_half, -v_h_void + v_one_half], + [v_outer_c_h + v_one_half, v_zero], + [v_h_void + v_one_half, -v_inner_c_h + v_one_half], + [v_one, -v_outer_c_h + v_one_half], + ] + ) - top = _np.array( - [ - [v_inner_c_h + v_one_half, v_h_void + v_one_half], - [v_outer_c_h + v_one_half, v_one], - [-v_inner_c_h + v_one_half, v_h_void + v_one_half], - [-v_outer_c_h + v_one_half, v_one], - ] - ) + elif closure == "x_max": + right = _np.array( + [ + [v_h_void + v_one_half, -v_inner_c_h + v_one_half], + [v_one, v_zero], + [v_h_void + v_one_half, v_inner_c_h + v_one_half], + [v_one, v_one], + ] + ) - bottom_left = _np.array( - [ - [-v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_zero, v_zero], - [-v_inner_c_h + v_one_half, -v_h_void + v_one_half], - [-v_outer_c_h + v_one_half, v_zero], - ] - ) + right_top = _np.array( + [ + [v_h_void + v_one_half, v_inner_c_h + v_one_half], + [v_one, v_one], + [v_inner_c_h + v_one_half, v_h_void + v_one_half], + [v_outer_c_h + v_one_half, v_one], + ] + ) - left = _np.array( - [ - [v_zero, v_zero], - [-v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_zero, v_one], - [-v_h_void + v_one_half, v_inner_c_h + v_one_half], - ] - ) + top = _np.array( + [ + [v_inner_c_h + v_one_half, v_h_void + v_one_half], + [v_outer_c_h + v_one_half, v_one], + [-v_inner_c_h + v_one_half, v_h_void + v_one_half], + [-v_outer_c_h + v_one_half, v_one], + ] + ) - top_left = _np.array( - [ - [v_zero, v_one], - [-v_h_void + v_one_half, v_inner_c_h + v_one_half], - [-v_outer_c_h + v_one_half, v_one], - [-v_inner_c_h + v_one_half, v_h_void + v_one_half], - ] - ) + bottom_left = _np.array( + [ + [-v_h_void + v_one_half, -v_inner_c_h + v_one_half], + [v_zero, -v_outer_c_h + v_one_half], + [-v_inner_c_h + v_one_half, -v_h_void + v_one_half], + [-v_outer_c_h + v_one_half, v_zero], + ] + ) - bottom = _np.array( - [ - [v_outer_c_h + v_one_half, v_zero], - [v_inner_c_h + v_one_half, -v_h_void + v_one_half], - [-v_outer_c_h + v_one_half, v_zero], - [-v_inner_c_h + v_one_half, -v_h_void + v_one_half], - ] - ) + left = _np.array( + [ + [v_zero, -v_outer_c_h + v_one_half], + [-v_h_void + v_one_half, -v_inner_c_h + v_one_half], + [v_zero, v_outer_c_h + v_one_half], + [-v_h_void + v_one_half, v_inner_c_h + v_one_half], + ] + ) - bottom_right = _np.array( - [ - [v_inner_c_h + v_one_half, -v_h_void + v_one_half], - [v_outer_c_h + v_one_half, v_zero], - [v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_one, -v_outer_c_h + v_one_half], - ] - ) + top_left = _np.array( + [ + [v_zero, v_outer_c_h + v_one_half], + [-v_h_void + v_one_half, v_inner_c_h + v_one_half], + [-v_outer_c_h + v_one_half, v_one], + [-v_inner_c_h + v_one_half, v_h_void + v_one_half], + ] + ) - elif closure == "x_max": - right = _np.array( - [ - [v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_one, v_zero], - [v_h_void + v_one_half, v_inner_c_h + v_one_half], - [v_one, v_one], - ] - ) + bottom = _np.array( + [ + [v_outer_c_h + v_one_half, v_zero], + [v_inner_c_h + v_one_half, -v_h_void + v_one_half], + [-v_outer_c_h + v_one_half, v_zero], + [-v_inner_c_h + v_one_half, -v_h_void + v_one_half], + ] + ) - right_top = _np.array( - [ - [v_h_void + v_one_half, v_inner_c_h + v_one_half], - [v_one, v_one], - [v_inner_c_h + v_one_half, v_h_void + v_one_half], - [v_outer_c_h + v_one_half, v_one], - ] - ) + bottom_right = _np.array( + [ + [v_inner_c_h + v_one_half, -v_h_void + v_one_half], + [v_outer_c_h + v_one_half, v_zero], + [v_h_void + v_one_half, -v_inner_c_h + v_one_half], + [v_one, v_zero], + ] + ) - top = _np.array( - [ - [v_inner_c_h + v_one_half, v_h_void + v_one_half], - [v_outer_c_h + v_one_half, v_one], - [-v_inner_c_h + v_one_half, v_h_void + v_one_half], - [-v_outer_c_h + v_one_half, v_one], - ] - ) + elif closure == "y_min": + # set points: + right = _np.array( + [ + [v_h_void + v_one_half, -v_inner_c_h + v_one_half], + [v_one, -v_outer_c_h + v_one_half], + [v_h_void + v_one_half, v_inner_c_h + v_one_half], + [v_one, v_outer_c_h + v_one_half], + ] + ) - bottom_left = _np.array( - [ - [-v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_zero, -v_outer_c_h + v_one_half], - [-v_inner_c_h + v_one_half, -v_h_void + v_one_half], - [-v_outer_c_h + v_one_half, v_zero], - ] - ) + right_top = _np.array( + [ + [v_h_void + v_one_half, v_inner_c_h + v_one_half], + [v_one, v_outer_c_h + v_one_half], + [v_inner_c_h + v_one_half, v_h_void + v_one_half], + [v_outer_c_h + v_one_half, v_one], + ] + ) - left = _np.array( - [ - [v_zero, -v_outer_c_h + v_one_half], - [-v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_zero, v_outer_c_h + v_one_half], - [-v_h_void + v_one_half, v_inner_c_h + v_one_half], - ] - ) + top = _np.array( + [ + [v_inner_c_h + v_one_half, v_h_void + v_one_half], + [v_outer_c_h + v_one_half, v_one], + [-v_inner_c_h + v_one_half, v_h_void + v_one_half], + [-v_outer_c_h + v_one_half, v_one], + ] + ) - top_left = _np.array( - [ - [v_zero, v_outer_c_h + v_one_half], - [-v_h_void + v_one_half, v_inner_c_h + v_one_half], - [-v_outer_c_h + v_one_half, v_one], - [-v_inner_c_h + v_one_half, v_h_void + v_one_half], - ] - ) + bottom_left = _np.array( + [ + [-v_h_void + v_one_half, -v_inner_c_h + v_one_half], + [v_zero, -v_outer_c_h + v_one_half], + [-v_inner_c_h + v_one_half, -v_h_void + v_one_half], + [v_zero, v_zero], + ] + ) - bottom = _np.array( - [ - [v_outer_c_h + v_one_half, v_zero], - [v_inner_c_h + v_one_half, -v_h_void + v_one_half], - [-v_outer_c_h + v_one_half, v_zero], - [-v_inner_c_h + v_one_half, -v_h_void + v_one_half], - ] - ) + left = _np.array( + [ + [v_zero, -v_outer_c_h + v_one_half], + [-v_h_void + v_one_half, -v_inner_c_h + v_one_half], + [v_zero, v_outer_c_h + v_one_half], + [-v_h_void + v_one_half, v_inner_c_h + v_one_half], + ] + ) - bottom_right = _np.array( - [ - [v_inner_c_h + v_one_half, -v_h_void + v_one_half], - [v_outer_c_h + v_one_half, v_zero], - [v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_one, v_zero], - ] - ) + top_left = _np.array( + [ + [v_zero, v_outer_c_h + v_one_half], + [-v_h_void + v_one_half, v_inner_c_h + v_one_half], + [-v_outer_c_h + v_one_half, v_one], + [-v_inner_c_h + v_one_half, v_h_void + v_one_half], + ] + ) - elif closure == "y_min": - # set points: - right = _np.array( - [ - [v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_one, -v_outer_c_h + v_one_half], - [v_h_void + v_one_half, v_inner_c_h + v_one_half], - [v_one, v_outer_c_h + v_one_half], - ] - ) + bottom = _np.array( + [ + [v_one, v_zero], + [v_inner_c_h + v_one_half, -v_h_void + v_one_half], + [v_zero, v_zero], + [-v_inner_c_h + v_one_half, -v_h_void + v_one_half], + ] + ) - right_top = _np.array( - [ - [v_h_void + v_one_half, v_inner_c_h + v_one_half], - [v_one, v_outer_c_h + v_one_half], - [v_inner_c_h + v_one_half, v_h_void + v_one_half], - [v_outer_c_h + v_one_half, v_one], - ] - ) + bottom_right = _np.array( + [ + [v_inner_c_h + v_one_half, -v_h_void + v_one_half], + [v_one, v_zero], + [v_h_void + v_one_half, -v_inner_c_h + v_one_half], + [v_one, -v_outer_c_h + v_one_half], + ] + ) - top = _np.array( - [ - [v_inner_c_h + v_one_half, v_h_void + v_one_half], - [v_outer_c_h + v_one_half, v_one], - [-v_inner_c_h + v_one_half, v_h_void + v_one_half], - [-v_outer_c_h + v_one_half, v_one], - ] - ) + elif closure == "y_max": + # set points: + right = _np.array( + [ + [v_h_void + v_one_half, -v_inner_c_h + v_one_half], + [v_one, -v_outer_c_h + v_one_half], + [v_h_void + v_one_half, v_inner_c_h + v_one_half], + [v_one, v_outer_c_h + v_one_half], + ] + ) - bottom_left = _np.array( - [ - [-v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_zero, -v_outer_c_h + v_one_half], - [-v_inner_c_h + v_one_half, -v_h_void + v_one_half], - [v_zero, v_zero], - ] - ) + right_top = _np.array( + [ + [v_h_void + v_one_half, v_inner_c_h + v_one_half], + [v_one, v_outer_c_h + v_one_half], + [v_inner_c_h + v_one_half, v_h_void + v_one_half], + [v_one, v_one], + ] + ) - left = _np.array( - [ - [v_zero, -v_outer_c_h + v_one_half], - [-v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_zero, v_outer_c_h + v_one_half], - [-v_h_void + v_one_half, v_inner_c_h + v_one_half], - ] - ) + top = _np.array( + [ + [v_inner_c_h + v_one_half, v_h_void + v_one_half], + [v_one, v_one], + [-v_inner_c_h + v_one_half, v_h_void + v_one_half], + [v_zero, v_one], + ] + ) - top_left = _np.array( - [ - [v_zero, v_outer_c_h + v_one_half], - [-v_h_void + v_one_half, v_inner_c_h + v_one_half], - [-v_outer_c_h + v_one_half, v_one], - [-v_inner_c_h + v_one_half, v_h_void + v_one_half], - ] - ) + bottom_left = _np.array( + [ + [-v_h_void + v_one_half, -v_inner_c_h + v_one_half], + [v_zero, -v_outer_c_h + v_one_half], + [-v_inner_c_h + v_one_half, -v_h_void + v_one_half], + [-v_outer_c_h + v_one_half, v_zero], + ] + ) - bottom = _np.array( - [ - [v_one, v_zero], - [v_inner_c_h + v_one_half, -v_h_void + v_one_half], - [v_zero, v_zero], - [-v_inner_c_h + v_one_half, -v_h_void + v_one_half], - ] - ) + left = _np.array( + [ + [v_zero, -v_outer_c_h + v_one_half], + [-v_h_void + v_one_half, -v_inner_c_h + v_one_half], + [v_zero, v_outer_c_h + v_one_half], + [-v_h_void + v_one_half, v_inner_c_h + v_one_half], + ] + ) - bottom_right = _np.array( - [ - [v_inner_c_h + v_one_half, -v_h_void + v_one_half], - [v_one, v_zero], - [v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_one, -v_outer_c_h + v_one_half], - ] + top_left = _np.array( + [ + [v_zero, v_outer_c_h + v_one_half], + [-v_h_void + v_one_half, v_inner_c_h + v_one_half], + [v_zero, v_one], + [-v_inner_c_h + v_one_half, v_h_void + v_one_half], + ] + ) + + bottom = _np.array( + [ + [v_outer_c_h + v_one_half, v_zero], + [v_inner_c_h + v_one_half, -v_h_void + v_one_half], + [-v_outer_c_h + v_one_half, v_zero], + [-v_inner_c_h + v_one_half, -v_h_void + v_one_half], + ] + ) + + bottom_right = _np.array( + [ + [v_inner_c_h + v_one_half, -v_h_void + v_one_half], + [v_outer_c_h + v_one_half, v_zero], + [v_h_void + v_one_half, -v_inner_c_h + v_one_half], + [v_one, -v_outer_c_h + v_one_half], + ] + ) + + for control_points in [ + right, + right_top, + bottom, + bottom_left, + left, + top_left, + top, + bottom_right, + ]: + spline_list.append( + _Bezier(degrees=[1, 1], control_points=control_points) + ) + + if i_derivative == 0: + splines = spline_list.copy() + else: + derivatives.append(spline_list) + + return (splines, derivatives) + + def create_tile( + self, + parameters=None, + parameter_sensitivities=None, + contact_length=0.2, + closure=None, + **kwargs, # noqa ARG002 + ): + """Create a microtile based on the parameters that describe the wall + thicknesses. + + Thickness parameters are used to describe the inner radius of the + outward facing branches + + Parameters + ---------- + parameters : np.array(1, 1) + One evaluation point with one parameter is used. This parameter + specifies the distance from the center to the inner edge, where + the value must be between non-inclusive (0, 0.5). + parameter_sensitivities: np.ndarray + Describes the parameter sensitivities with respect to some design + variable. In case the design variables directly apply to the + parameter itself, they evaluate as delta_ij + contact_length : float + the length of the wall that contacts the other microstructure + closure : str + parametric dimension that needs to be closed, given in the form + "x_min", "x_max", etc. + + Returns + ------- + microtile_list : list(splines) + derivatives: list> / None + """ + self._check_custom_parameter( + contact_length, "contact length", self._CONTACT_LENGTH_BOUNDS + ) + + parameters, n_derivatives, derivatives = self._process_input( + parameters=parameters, + parameter_sensitivities=parameter_sensitivities, + ) + + if closure is not None: + return self._closing_tile( + parameters=parameters, + parameter_sensitivities=parameter_sensitivities, + contact_length=contact_length, + closure=closure, ) - elif closure == "y_max": + splines = [] + for i_derivative in range(n_derivatives + 1): + if i_derivative == 0: + v_zero = 0.0 + v_one_half = 0.5 + v_one = 1.0 + v_h_void = parameters[0, 0] + v_outer_c_h = contact_length * 0.5 + v_inner_c_h = contact_length * v_h_void + else: + v_zero = 0.0 + v_one_half = 0.0 + v_one = 0.0 + v_h_void = parameter_sensitivities[0, 0, i_derivative - 1] + v_outer_c_h = 0.0 + v_inner_c_h = contact_length * v_h_void + + spline_list = [] + # set points: right = _np.array( [ @@ -322,16 +485,16 @@ def _closing_tile( [v_h_void + v_one_half, v_inner_c_h + v_one_half], [v_one, v_outer_c_h + v_one_half], [v_inner_c_h + v_one_half, v_h_void + v_one_half], - [v_one, v_one], + [v_outer_c_h + v_one_half, v_one], ] ) top = _np.array( [ [v_inner_c_h + v_one_half, v_h_void + v_one_half], - [v_one, v_one], + [v_outer_c_h + v_one_half, v_one], [-v_inner_c_h + v_one_half, v_h_void + v_one_half], - [v_zero, v_one], + [-v_outer_c_h + v_one_half, v_one], ] ) @@ -357,7 +520,7 @@ def _closing_tile( [ [v_zero, v_outer_c_h + v_one_half], [-v_h_void + v_one_half, v_inner_c_h + v_one_half], - [v_zero, v_one], + [-v_outer_c_h + v_one_half, v_one], [-v_inner_c_h + v_one_half, v_h_void + v_one_half], ] ) @@ -380,195 +543,23 @@ def _closing_tile( ] ) - spline_list.append(_Bezier(degrees=[1, 1], control_points=right)) - - spline_list.append(_Bezier(degrees=[1, 1], control_points=right_top)) - - spline_list.append(_Bezier(degrees=[1, 1], control_points=bottom)) - - spline_list.append(_Bezier(degrees=[1, 1], control_points=bottom_left)) - - spline_list.append(_Bezier(degrees=[1, 1], control_points=left)) - - spline_list.append(_Bezier(degrees=[1, 1], control_points=top_left)) - - spline_list.append(_Bezier(degrees=[1, 1], control_points=top)) - - spline_list.append( - _Bezier(degrees=[1, 1], control_points=bottom_right) - ) - - return (spline_list, None) - - def create_tile( - self, - parameters=None, - parameter_sensitivities=None, # TODO - contact_length=0.2, - closure=None, - **kwargs, # noqa ARG002 - ): - """Create a microtile based on the parameters that describe the wall - thicknesses. - - Thickness parameters are used to describe the inner radius of the - outward facing branches - - Parameters - ---------- - parameters : np.array(1, 1) - One evaluation point with one parameter is used. This parameter - specifies the distance from the center to the inner edge, where - the value must be between non-inclusive (0, 0.5). - parameter_sensitivities: np.ndarray - Describes the parameter sensitivities with respect to some design - variable. In case the design variables directly apply to the - parameter itself, they evaluate as delta_ij - contact_length : float - the length of the wall that contacts the other microstructure - closure : str - parametric dimension that needs to be closed, given in the form - "x_min", "x_max", etc. - - Returns - ------- - microtile_list : list(splines) - derivatives: list> / None - """ - - if not isinstance(contact_length, float): - raise ValueError("Invalid Type for radius") - - if not ((contact_length > 0) and (contact_length < 0.99)): - raise ValueError("The length of a side must be in (0.01, 0.99)") - - if parameters is None: - self._logd("Setting parameters to default values (0.2)") - parameters = _np.array( - _np.ones( - (len(self._evaluation_points), self._n_info_per_eval_point) + for control_points in [ + right, + right_top, + bottom, + bottom_left, + left, + top_left, + top, + bottom_right, + ]: + spline_list.append( + _Bezier(degrees=[1, 1], control_points=control_points) ) - * 0.2 - ) - - if parameter_sensitivities is not None: - raise NotImplementedError( - "Derivatives are not implemented for this tile yet" - ) - - self.check_params(parameters) - - v_h_void = parameters[0, 0] - if not (_np.all(parameters > 0) and _np.all(parameters < 0.5)): - raise ValueError( - "The thickness of the wall must be in (0.01 and 0.49)" - ) - - if closure is not None: - return self._closing_tile( - parameters=parameters, - parameter_sensitivities=parameter_sensitivities, # TODO - contact_length=contact_length, - closure=closure, - ) - - v_zero = 0.0 - v_one_half = 0.5 - v_one = 1.0 - v_outer_c_h = contact_length * 0.5 - v_inner_c_h = contact_length * parameters[0, 0] - - spline_list = [] - - # set points: - right = _np.array( - [ - [v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_one, -v_outer_c_h + v_one_half], - [v_h_void + v_one_half, v_inner_c_h + v_one_half], - [v_one, v_outer_c_h + v_one_half], - ] - ) - right_top = _np.array( - [ - [v_h_void + v_one_half, v_inner_c_h + v_one_half], - [v_one, v_outer_c_h + v_one_half], - [v_inner_c_h + v_one_half, v_h_void + v_one_half], - [v_outer_c_h + v_one_half, v_one], - ] - ) - - top = _np.array( - [ - [v_inner_c_h + v_one_half, v_h_void + v_one_half], - [v_outer_c_h + v_one_half, v_one], - [-v_inner_c_h + v_one_half, v_h_void + v_one_half], - [-v_outer_c_h + v_one_half, v_one], - ] - ) - - bottom_left = _np.array( - [ - [-v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_zero, -v_outer_c_h + v_one_half], - [-v_inner_c_h + v_one_half, -v_h_void + v_one_half], - [-v_outer_c_h + v_one_half, v_zero], - ] - ) - - left = _np.array( - [ - [v_zero, -v_outer_c_h + v_one_half], - [-v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_zero, v_outer_c_h + v_one_half], - [-v_h_void + v_one_half, v_inner_c_h + v_one_half], - ] - ) - - top_left = _np.array( - [ - [v_zero, v_outer_c_h + v_one_half], - [-v_h_void + v_one_half, v_inner_c_h + v_one_half], - [-v_outer_c_h + v_one_half, v_one], - [-v_inner_c_h + v_one_half, v_h_void + v_one_half], - ] - ) - - bottom = _np.array( - [ - [v_outer_c_h + v_one_half, v_zero], - [v_inner_c_h + v_one_half, -v_h_void + v_one_half], - [-v_outer_c_h + v_one_half, v_zero], - [-v_inner_c_h + v_one_half, -v_h_void + v_one_half], - ] - ) - - bottom_right = _np.array( - [ - [v_inner_c_h + v_one_half, -v_h_void + v_one_half], - [v_outer_c_h + v_one_half, v_zero], - [v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_one, -v_outer_c_h + v_one_half], - ] - ) - - spline_list.append(_Bezier(degrees=[1, 1], control_points=right)) - - spline_list.append(_Bezier(degrees=[1, 1], control_points=right_top)) - - spline_list.append(_Bezier(degrees=[1, 1], control_points=bottom)) - - spline_list.append(_Bezier(degrees=[1, 1], control_points=bottom_left)) - - spline_list.append(_Bezier(degrees=[1, 1], control_points=left)) - - spline_list.append(_Bezier(degrees=[1, 1], control_points=top_left)) - - spline_list.append(_Bezier(degrees=[1, 1], control_points=top)) - - spline_list.append( - _Bezier(degrees=[1, 1], control_points=bottom_right) - ) + if i_derivative == 0: + splines = spline_list.copy() + else: + derivatives.append(spline_list) - return (spline_list, None) + return (splines, derivatives) diff --git a/splinepy/microstructure/tiles/hollow_octagon_extrude.py b/splinepy/microstructure/tiles/hollow_octagon_extrude.py index 82e738d23..4d63972ac 100644 --- a/splinepy/microstructure/tiles/hollow_octagon_extrude.py +++ b/splinepy/microstructure/tiles/hollow_octagon_extrude.py @@ -18,12 +18,20 @@ class HollowOctagonExtrude(_TileBase): _para_dim = 3 _evaluation_points = _np.array([[0.5, 0.5, 0.5]]) _n_info_per_eval_point = 1 + _sensitivities_implemented = True + _closure_directions = ["x_min", "x_max", "y_min", "y_max"] + _parameter_bounds = [[0.0, 0.5]] + _parameters_shape = (1, 1) + _default_parameter_value = 0.2 + + _CONTACT_LENGTH_BOUNDS = [0.0, 0.99] def create_tile( self, parameters=None, - parameter_sensitivities=None, # TODO + parameter_sensitivities=None, contact_length=0.2, + closure=None, **kwargs, # noqa ARG002 ): """Create a microtile based on the parameters that describe the wall @@ -50,175 +58,190 @@ def create_tile( derivatives: list> / None """ - if not isinstance(contact_length, float): - raise ValueError("Invalid Type for radius") - - if not ((contact_length > 0) and (contact_length < 0.99)): - raise ValueError("The length of a side must be in (0.01, 0.99)") - - if parameters is None: - self._logd("Setting parameters to default values (0.2)") - parameters = _np.array( - _np.ones( - (len(self._evaluation_points), self._n_info_per_eval_point) - ) - * 0.2 - ) - - if parameter_sensitivities is not None: - raise NotImplementedError( - "Derivatives are not implemented for this tile yet" - ) - - self.check_params(parameters) - - v_h_void = parameters[0, 0] - if not ((v_h_void > 0.01) and (v_h_void < 0.5)): - raise ValueError( - "The thickness of the wall must be in (0.01 and 0.49)" - ) - - v_zero = 0.0 - v_one_half = 0.5 - v_one = 1.0 - v_outer_c_h = contact_length * 0.5 - v_inner_c_h = contact_length * parameters[0, 0] - - spline_list = [] - - # set points: - right = _np.array( - [ - [v_h_void + v_one_half, -v_inner_c_h + v_one_half, v_zero], - [v_one, -v_outer_c_h + v_one_half, 0.0], - [v_h_void + v_one_half, v_inner_c_h + v_one_half, 0.0], - [v_one, v_outer_c_h + v_one_half, 0.0], - [v_h_void + v_one_half, -v_inner_c_h + v_one_half, v_one], - [v_one, -v_outer_c_h + v_one_half, v_one], - [v_h_void + v_one_half, v_inner_c_h + v_one_half, v_one], - [v_one, v_outer_c_h + v_one_half, v_one], - ] - ) - - right_top = _np.array( - [ - [v_h_void + v_one_half, v_inner_c_h + v_one_half, v_zero], - [v_one, v_outer_c_h + v_one_half, v_zero], - [v_inner_c_h + v_one_half, v_h_void + v_one_half, v_zero], - [v_outer_c_h + v_one_half, v_one, v_zero], - [v_h_void + v_one_half, v_inner_c_h + v_one_half, v_one], - [v_one, v_outer_c_h + v_one_half, v_one], - [v_inner_c_h + v_one_half, v_h_void + v_one_half, v_one], - [v_outer_c_h + v_one_half, v_one, v_one], - ] + self._check_custom_parameter( + contact_length, "contact length", self._CONTACT_LENGTH_BOUNDS ) - - top = _np.array( - [ - [v_inner_c_h + v_one_half, v_h_void + v_one_half, v_zero], - [v_outer_c_h + v_one_half, v_one, v_zero], - [-v_inner_c_h + v_one_half, v_h_void + v_one_half, v_zero], - [-v_outer_c_h + v_one_half, v_one, v_zero], - [v_inner_c_h + v_one_half, v_h_void + v_one_half, v_one], - [v_outer_c_h + v_one_half, v_one, v_one], - [-v_inner_c_h + v_one_half, v_h_void + v_one_half, v_one], - [-v_outer_c_h + v_one_half, v_one, v_one], - ] + # Process input + parameters, n_derivatives, derivatives = self._process_input( + parameters=parameters, + parameter_sensitivities=parameter_sensitivities, ) - bottom_left = _np.array( - [ - [-v_h_void + v_one_half, -v_inner_c_h + v_one_half, v_zero], - [v_zero, -v_outer_c_h + v_one_half, v_zero], - [-v_inner_c_h + v_one_half, -v_h_void + v_one_half, v_zero], - [-v_outer_c_h + v_one_half, v_zero, v_zero], - [-v_h_void + v_one_half, -v_inner_c_h + v_one_half, v_one], - [v_zero, -v_outer_c_h + v_one_half, v_one], - [-v_inner_c_h + v_one_half, -v_h_void + v_one_half, v_one], - [-v_outer_c_h + v_one_half, v_zero, v_one], - ] - ) + v_h_void = parameters[0, 0] - left = _np.array( - [ - [v_zero, -v_outer_c_h + v_one_half, v_zero], - [-v_h_void + v_one_half, -v_inner_c_h + v_one_half, v_zero], - [v_zero, v_outer_c_h + v_one_half, v_zero], - [-v_h_void + v_one_half, v_inner_c_h + v_one_half, v_zero], - [v_zero, -v_outer_c_h + v_one_half, v_one], - [-v_h_void + v_one_half, -v_inner_c_h + v_one_half, v_one], - [v_zero, v_outer_c_h + v_one_half, v_one], - [-v_h_void + v_one_half, v_inner_c_h + v_one_half, v_one], - ] - ) + if closure is not None: + return self._closing_tile( + parameters=parameters, + parameter_sensitivities=parameter_sensitivities, + closure=closure, + contact_length=contact_length, + **kwargs, + ) - top_left = _np.array( - [ - [v_zero, v_outer_c_h + v_one_half, v_zero], - [-v_h_void + v_one_half, v_inner_c_h + v_one_half, v_zero], - [-v_outer_c_h + v_one_half, v_one, v_zero], - [-v_inner_c_h + v_one_half, v_h_void + v_one_half, v_zero], - [v_zero, v_outer_c_h + v_one_half, v_one], - [-v_h_void + v_one_half, v_inner_c_h + v_one_half, v_one], - [-v_outer_c_h + v_one_half, v_one, v_one], - [-v_inner_c_h + v_one_half, v_h_void + v_one_half, v_one], - ] - ) + splines = [] + for i_derivative in range(n_derivatives + 1): + if i_derivative == 0: + v_zero = 0.0 + v_one_half = 0.5 + v_one = 1.0 + v_outer_c_h = contact_length * 0.5 + v_inner_c_h = contact_length * v_h_void + else: + v_zero = 0.0 + v_one_half = 0.0 + v_one = 0.0 + v_h_void = parameter_sensitivities[0, 0, i_derivative - 1] + v_outer_c_h = 0.0 + v_inner_c_h = contact_length * v_h_void + + spline_list = [] - bottom = _np.array( - [ - [v_outer_c_h + v_one_half, v_zero, v_zero], - [v_inner_c_h + v_one_half, -v_h_void + v_one_half, v_zero], - [-v_outer_c_h + v_one_half, v_zero, v_zero], - [-v_inner_c_h + v_one_half, -v_h_void + v_one_half, v_zero], - [v_outer_c_h + v_one_half, v_zero, v_one], - [v_inner_c_h + v_one_half, -v_h_void + v_one_half, v_one], - [-v_outer_c_h + v_one_half, v_zero, v_one], - [-v_inner_c_h + v_one_half, -v_h_void + v_one_half, v_one], - ] - ) + # set points: + right = _np.array( + [ + [v_h_void + v_one_half, -v_inner_c_h + v_one_half, v_zero], + [v_one, -v_outer_c_h + v_one_half, v_zero], + [v_h_void + v_one_half, v_inner_c_h + v_one_half, v_zero], + [v_one, v_outer_c_h + v_one_half, v_zero], + [v_h_void + v_one_half, -v_inner_c_h + v_one_half, v_one], + [v_one, -v_outer_c_h + v_one_half, v_one], + [v_h_void + v_one_half, v_inner_c_h + v_one_half, v_one], + [v_one, v_outer_c_h + v_one_half, v_one], + ] + ) - bottom_right = _np.array( - [ - [v_inner_c_h + v_one_half, -v_h_void + v_one_half, v_zero], - [v_outer_c_h + v_one_half, v_zero, v_zero], - [v_h_void + v_one_half, -v_inner_c_h + v_one_half, v_zero], - [v_one, -v_outer_c_h + v_one_half, v_zero], - [v_inner_c_h + v_one_half, -v_h_void + v_one_half, v_one], - [v_outer_c_h + v_one_half, v_zero, v_one], - [v_h_void + v_one_half, -v_inner_c_h + v_one_half, v_one], - [v_one, -v_outer_c_h + v_one_half, v_one], - ] - ) + right_top = _np.array( + [ + [v_h_void + v_one_half, v_inner_c_h + v_one_half, v_zero], + [v_one, v_outer_c_h + v_one_half, v_zero], + [v_inner_c_h + v_one_half, v_h_void + v_one_half, v_zero], + [v_outer_c_h + v_one_half, v_one, v_zero], + [v_h_void + v_one_half, v_inner_c_h + v_one_half, v_one], + [v_one, v_outer_c_h + v_one_half, v_one], + [v_inner_c_h + v_one_half, v_h_void + v_one_half, v_one], + [v_outer_c_h + v_one_half, v_one, v_one], + ] + ) - spline_list.append(_Bezier(degrees=[1, 1, 1], control_points=right)) + top = _np.array( + [ + [v_inner_c_h + v_one_half, v_h_void + v_one_half, v_zero], + [v_outer_c_h + v_one_half, v_one, v_zero], + [-v_inner_c_h + v_one_half, v_h_void + v_one_half, v_zero], + [-v_outer_c_h + v_one_half, v_one, v_zero], + [v_inner_c_h + v_one_half, v_h_void + v_one_half, v_one], + [v_outer_c_h + v_one_half, v_one, v_one], + [-v_inner_c_h + v_one_half, v_h_void + v_one_half, v_one], + [-v_outer_c_h + v_one_half, v_one, v_one], + ] + ) - spline_list.append( - _Bezier(degrees=[1, 1, 1], control_points=right_top) - ) + bottom_left = _np.array( + [ + [ + -v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_zero, + ], + [v_zero, -v_outer_c_h + v_one_half, v_zero], + [ + -v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_zero, + ], + [-v_outer_c_h + v_one_half, v_zero, v_zero], + [-v_h_void + v_one_half, -v_inner_c_h + v_one_half, v_one], + [v_zero, -v_outer_c_h + v_one_half, v_one], + [-v_inner_c_h + v_one_half, -v_h_void + v_one_half, v_one], + [-v_outer_c_h + v_one_half, v_zero, v_one], + ] + ) - spline_list.append(_Bezier(degrees=[1, 1, 1], control_points=bottom)) + left = _np.array( + [ + [v_zero, -v_outer_c_h + v_one_half, v_zero], + [ + -v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_zero, + ], + [v_zero, v_outer_c_h + v_one_half, v_zero], + [-v_h_void + v_one_half, v_inner_c_h + v_one_half, v_zero], + [v_zero, -v_outer_c_h + v_one_half, v_one], + [-v_h_void + v_one_half, -v_inner_c_h + v_one_half, v_one], + [v_zero, v_outer_c_h + v_one_half, v_one], + [-v_h_void + v_one_half, v_inner_c_h + v_one_half, v_one], + ] + ) - spline_list.append( - _Bezier(degrees=[1, 1, 1], control_points=bottom_left) - ) + top_left = _np.array( + [ + [v_zero, v_outer_c_h + v_one_half, v_zero], + [-v_h_void + v_one_half, v_inner_c_h + v_one_half, v_zero], + [-v_outer_c_h + v_one_half, v_one, v_zero], + [-v_inner_c_h + v_one_half, v_h_void + v_one_half, v_zero], + [v_zero, v_outer_c_h + v_one_half, v_one], + [-v_h_void + v_one_half, v_inner_c_h + v_one_half, v_one], + [-v_outer_c_h + v_one_half, v_one, v_one], + [-v_inner_c_h + v_one_half, v_h_void + v_one_half, v_one], + ] + ) - spline_list.append(_Bezier(degrees=[1, 1, 1], control_points=left)) + bottom = _np.array( + [ + [v_outer_c_h + v_one_half, v_zero, v_zero], + [v_inner_c_h + v_one_half, -v_h_void + v_one_half, v_zero], + [-v_outer_c_h + v_one_half, v_zero, v_zero], + [ + -v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_zero, + ], + [v_outer_c_h + v_one_half, v_zero, v_one], + [v_inner_c_h + v_one_half, -v_h_void + v_one_half, v_one], + [-v_outer_c_h + v_one_half, v_zero, v_one], + [-v_inner_c_h + v_one_half, -v_h_void + v_one_half, v_one], + ] + ) - spline_list.append(_Bezier(degrees=[1, 1, 1], control_points=top_left)) + bottom_right = _np.array( + [ + [v_inner_c_h + v_one_half, -v_h_void + v_one_half, v_zero], + [v_outer_c_h + v_one_half, v_zero, v_zero], + [v_h_void + v_one_half, -v_inner_c_h + v_one_half, v_zero], + [v_one, -v_outer_c_h + v_one_half, v_zero], + [v_inner_c_h + v_one_half, -v_h_void + v_one_half, v_one], + [v_outer_c_h + v_one_half, v_zero, v_one], + [v_h_void + v_one_half, -v_inner_c_h + v_one_half, v_one], + [v_one, -v_outer_c_h + v_one_half, v_one], + ] + ) - spline_list.append(_Bezier(degrees=[1, 1, 1], control_points=top)) + for control_points in [ + right, + right_top, + top, + bottom_left, + left, + top_left, + bottom, + bottom_right, + ]: + spline_list.append( + _Bezier(degrees=[1, 1, 1], control_points=control_points) + ) - spline_list.append( - _Bezier(degrees=[1, 1, 1], control_points=bottom_right) - ) + if i_derivative == 0: + splines = spline_list.copy() + else: + derivatives.append(spline_list) - return (spline_list, None) + return (splines, derivatives) - def closing_tile( + def _closing_tile( self, parameters=None, - parameter_sensitivities=None, # TODO + parameter_sensitivities=None, contact_length=0.2, closure=None, ): @@ -250,351 +273,982 @@ def closing_tile( if closure is None: raise ValueError("No closing direction given") - if parameters is None: - self._log("Tile request is not parametrized, setting default 0.2") - parameters = _np.array( - _np.ones( - (len(self._evaluation_points), self._n_info_per_eval_point) - ) - * 0.2 - ) - - if not (_np.all(parameters[0] > 0) and _np.all(parameters[0] < 0.5)): - raise ValueError( - "The thickness of the wall must be in (0.01 and 0.49)" - ) - - self.check_params(parameters) - - if parameter_sensitivities is not None: - raise NotImplementedError( - "Derivatives are not implemented for this tile yet" - ) + # Process input + parameters, n_derivatives, derivatives = self._process_input( + parameters=parameters, + parameter_sensitivities=parameter_sensitivities, + ) v_h_void = parameters[0, 0] - if not ((v_h_void > 0.01) and (v_h_void < 0.5)): - raise ValueError( - "The thickness of the wall must be in (0.01 and 0.49)" - ) - - spline_list = [] - v_zero = 0.0 - v_one_half = 0.5 - v_one = 1.0 - v_outer_c_h = contact_length * 0.5 - v_inner_c_h = contact_length * parameters[0, 0] - - if closure == "x_min": - # set points: - right = _np.array( - [ - [v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_one, -v_outer_c_h + v_one_half], - [v_h_void + v_one_half, v_inner_c_h + v_one_half], - [v_one, v_outer_c_h + v_one_half], - ] - ) - - right_top = _np.array( - [ - [v_h_void + v_one_half, v_inner_c_h + v_one_half], - [v_one, v_outer_c_h + v_one_half], - [v_inner_c_h + v_one_half, v_h_void + v_one_half], - [v_outer_c_h + v_one_half, v_one], - ] - ) - - top = _np.array( - [ - [v_inner_c_h + v_one_half, v_h_void + v_one_half], - [v_outer_c_h + v_one_half, v_one], - [-v_inner_c_h + v_one_half, v_h_void + v_one_half], - [-v_outer_c_h + v_one_half, v_one], - ] - ) - - bottom_left = _np.array( - [ - [-v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_zero, v_zero], - [-v_inner_c_h + v_one_half, -v_h_void + v_one_half], - [-v_outer_c_h + v_one_half, v_zero], - ] - ) - left = _np.array( - [ - [v_zero, v_zero], - [-v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_zero, v_one], - [-v_h_void + v_one_half, v_inner_c_h + v_one_half], - ] - ) - - top_left = _np.array( - [ - [v_zero, v_one], - [-v_h_void + v_one_half, v_inner_c_h + v_one_half], - [-v_outer_c_h + v_one_half, v_one], - [-v_inner_c_h + v_one_half, v_h_void + v_one_half], - ] - ) - - bottom = _np.array( - [ - [v_outer_c_h + v_one_half, v_zero], - [v_inner_c_h + v_one_half, -v_h_void + v_one_half], - [-v_outer_c_h + v_one_half, v_zero], - [-v_inner_c_h + v_one_half, -v_h_void + v_one_half], - ] - ) + splines = [] + for i_derivative in range(n_derivatives + 1): + if i_derivative == 0: + v_zero = 0.0 + v_one_half = 0.5 + v_one = 1.0 + v_outer_c_h = contact_length * 0.5 + v_inner_c_h = contact_length * parameters[0, 0] + else: + v_h_void = parameter_sensitivities[0, 0, i_derivative - 1] + v_zero, v_one_half, v_one = [0.0, 0.0, 0.0] + v_outer_c_h = 0.0 + v_inner_c_h = contact_length * v_h_void + + spline_list = [] + + if closure == "x_min": + # set points: + right = _np.array( + [ + [ + v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_zero, + ], + [v_one, -v_outer_c_h + v_one_half, v_zero], + [ + v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_zero, + ], + [v_one, v_outer_c_h + v_one_half, v_zero], + [ + v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_one, + ], + [v_one, -v_outer_c_h + v_one_half, v_one], + [ + v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_one, + ], + [v_one, v_outer_c_h + v_one_half, v_one], + ] + ) - bottom_right = _np.array( - [ - [v_inner_c_h + v_one_half, -v_h_void + v_one_half], - [v_outer_c_h + v_one_half, v_zero], - [v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_one, -v_outer_c_h + v_one_half], - ] - ) + right_top = _np.array( + [ + [ + v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_zero, + ], + [v_one, v_outer_c_h + v_one_half, v_zero], + [ + v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_zero, + ], + [v_outer_c_h + v_one_half, v_one, v_zero], + [ + v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_one, + ], + [v_one, v_outer_c_h + v_one_half, v_one], + [ + v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_one, + ], + [v_outer_c_h + v_one_half, v_one, v_one], + ] + ) - elif closure == "x_max": - right = _np.array( - [ - [v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_one, v_zero], - [v_h_void + v_one_half, v_inner_c_h + v_one_half], - [v_one, v_one], - ] - ) + top = _np.array( + [ + [ + v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_zero, + ], + [v_outer_c_h + v_one_half, v_one, v_zero], + [ + -v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_zero, + ], + [-v_outer_c_h + v_one_half, v_one, v_zero], + [ + v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_one, + ], + [v_outer_c_h + v_one_half, v_one, v_one], + [ + -v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_one, + ], + [-v_outer_c_h + v_one_half, v_one, v_one], + ] + ) - right_top = _np.array( - [ - [v_h_void + v_one_half, v_inner_c_h + v_one_half], - [v_one, v_one], - [v_inner_c_h + v_one_half, v_h_void + v_one_half], - [v_outer_c_h + v_one_half, v_one], - ] - ) + bottom_left = _np.array( + [ + [ + -v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_zero, + ], + [v_zero, v_zero, v_zero], + [ + -v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_zero, + ], + [-v_outer_c_h + v_one_half, v_zero, v_zero], + [ + -v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_one, + ], + [v_zero, v_zero, v_one], + [ + -v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_one, + ], + [-v_outer_c_h + v_one_half, v_zero, v_one], + ] + ) - top = _np.array( - [ - [v_inner_c_h + v_one_half, v_h_void + v_one_half], - [v_outer_c_h + v_one_half, v_one], - [-v_inner_c_h + v_one_half, v_h_void + v_one_half], - [-v_outer_c_h + v_one_half, v_one], - ] - ) + left = _np.array( + [ + [v_zero, v_zero, v_zero], + [ + -v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_zero, + ], + [v_zero, v_one, v_zero], + [ + -v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_zero, + ], + [v_zero, v_zero, v_one], + [ + -v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_one, + ], + [v_zero, v_one, v_one], + [ + -v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_one, + ], + ] + ) - bottom_left = _np.array( - [ - [-v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_zero, -v_outer_c_h + v_one_half], - [-v_inner_c_h + v_one_half, -v_h_void + v_one_half], - [-v_outer_c_h + v_one_half, v_zero], - ] - ) + top_left = _np.array( + [ + [v_zero, v_one, v_zero], + [ + -v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_zero, + ], + [-v_outer_c_h + v_one_half, v_one, v_zero], + [ + -v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_zero, + ], + [v_zero, v_one, v_one], + [ + -v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_one, + ], + [-v_outer_c_h + v_one_half, v_one, v_one], + [ + -v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_one, + ], + ] + ) - left = _np.array( - [ - [v_zero, -v_outer_c_h + v_one_half], - [-v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_zero, v_outer_c_h + v_one_half], - [-v_h_void + v_one_half, v_inner_c_h + v_one_half], - ] - ) + bottom = _np.array( + [ + [v_outer_c_h + v_one_half, v_zero, v_zero], + [ + v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_zero, + ], + [-v_outer_c_h + v_one_half, v_zero, v_zero], + [ + -v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_zero, + ], + [v_outer_c_h + v_one_half, v_zero, v_one], + [ + v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_one, + ], + [-v_outer_c_h + v_one_half, v_zero, v_one], + [ + -v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_one, + ], + ] + ) - top_left = _np.array( - [ - [v_zero, v_outer_c_h + v_one_half], - [-v_h_void + v_one_half, v_inner_c_h + v_one_half], - [-v_outer_c_h + v_one_half, v_one], - [-v_inner_c_h + v_one_half, v_h_void + v_one_half], - ] - ) + bottom_right = _np.array( + [ + [ + v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_zero, + ], + [v_outer_c_h + v_one_half, v_zero, v_zero], + [ + v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_zero, + ], + [v_one, -v_outer_c_h + v_one_half, v_zero], + [ + v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_one, + ], + [v_outer_c_h + v_one_half, v_zero, v_one], + [ + v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_one, + ], + [v_one, -v_outer_c_h + v_one_half, v_one], + ] + ) - bottom = _np.array( - [ - [v_outer_c_h + v_one_half, v_zero], - [v_inner_c_h + v_one_half, -v_h_void + v_one_half], - [-v_outer_c_h + v_one_half, v_zero], - [-v_inner_c_h + v_one_half, -v_h_void + v_one_half], - ] - ) + elif closure == "x_max": + right = _np.array( + [ + [ + v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_zero, + ], + [v_one, v_zero, v_zero], + [ + v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_zero, + ], + [v_one, v_one, v_zero], + [ + v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_one, + ], + [v_one, v_zero, v_one], + [ + v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_one, + ], + [v_one, v_one, v_one], + ] + ) - bottom_right = _np.array( - [ - [v_inner_c_h + v_one_half, -v_h_void + v_one_half], - [v_outer_c_h + v_one_half, v_zero], - [v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_one, v_zero], - ] - ) + right_top = _np.array( + [ + [ + v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_zero, + ], + [v_one, v_one, v_zero], + [ + v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_zero, + ], + [v_outer_c_h + v_one_half, v_one, v_zero], + [ + v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_one, + ], + [v_one, v_one, v_one], + [ + v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_one, + ], + [v_outer_c_h + v_one_half, v_one, v_one], + ] + ) - elif closure == "y_min": - # set points: - right = _np.array( - [ - [v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_one, -v_outer_c_h + v_one_half], - [v_h_void + v_one_half, v_inner_c_h + v_one_half], - [v_one, v_outer_c_h + v_one_half], - ] - ) + top = _np.array( + [ + [ + v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_zero, + ], + [v_outer_c_h + v_one_half, v_one, v_zero], + [ + -v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_zero, + ], + [-v_outer_c_h + v_one_half, v_one, v_zero], + [ + v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_one, + ], + [v_outer_c_h + v_one_half, v_one, v_one], + [ + -v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_one, + ], + [-v_outer_c_h + v_one_half, v_one, v_one], + ] + ) - right_top = _np.array( - [ - [v_h_void + v_one_half, v_inner_c_h + v_one_half], - [v_one, v_outer_c_h + v_one_half], - [v_inner_c_h + v_one_half, v_h_void + v_one_half], - [v_outer_c_h + v_one_half, v_one], - ] - ) + bottom_left = _np.array( + [ + [ + -v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_zero, + ], + [v_zero, -v_outer_c_h + v_one_half, v_zero], + [ + -v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_zero, + ], + [-v_outer_c_h + v_one_half, v_zero, v_zero], + [ + -v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_one, + ], + [v_zero, -v_outer_c_h + v_one_half, v_one], + [ + -v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_one, + ], + [-v_outer_c_h + v_one_half, v_zero, v_one], + ] + ) - top = _np.array( - [ - [v_inner_c_h + v_one_half, v_h_void + v_one_half], - [v_outer_c_h + v_one_half, v_one], - [-v_inner_c_h + v_one_half, v_h_void + v_one_half], - [-v_outer_c_h + v_one_half, v_one], - ] - ) + left = _np.array( + [ + [v_zero, -v_outer_c_h + v_one_half, v_zero], + [ + -v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_zero, + ], + [v_zero, v_outer_c_h + v_one_half, v_zero], + [ + -v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_zero, + ], + [v_zero, -v_outer_c_h + v_one_half, v_one], + [ + -v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_one, + ], + [v_zero, v_outer_c_h + v_one_half, v_one], + [ + -v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_one, + ], + ] + ) - bottom_left = _np.array( - [ - [-v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_zero, -v_outer_c_h + v_one_half], - [-v_inner_c_h + v_one_half, -v_h_void + v_one_half], - [v_zero, v_zero], - ] - ) + top_left = _np.array( + [ + [v_zero, v_outer_c_h + v_one_half, v_zero], + [ + -v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_zero, + ], + [-v_outer_c_h + v_one_half, v_one, v_zero], + [ + -v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_zero, + ], + [v_zero, v_outer_c_h + v_one_half, v_one], + [ + -v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_one, + ], + [-v_outer_c_h + v_one_half, v_one, v_one], + [ + -v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_one, + ], + ] + ) - left = _np.array( - [ - [v_zero, -v_outer_c_h + v_one_half], - [-v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_zero, v_outer_c_h + v_one_half], - [-v_h_void + v_one_half, v_inner_c_h + v_one_half], - ] - ) + bottom = _np.array( + [ + [v_outer_c_h + v_one_half, v_zero, v_zero], + [ + v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_zero, + ], + [-v_outer_c_h + v_one_half, v_zero, v_zero], + [ + -v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_zero, + ], + [v_outer_c_h + v_one_half, v_zero, v_one], + [ + v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_one, + ], + [-v_outer_c_h + v_one_half, v_zero, v_one], + [ + -v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_one, + ], + ] + ) - top_left = _np.array( - [ - [v_zero, v_outer_c_h + v_one_half], - [-v_h_void + v_one_half, v_inner_c_h + v_one_half], - [-v_outer_c_h + v_one_half, v_one], - [-v_inner_c_h + v_one_half, v_h_void + v_one_half], - ] - ) + bottom_right = _np.array( + [ + [ + v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_zero, + ], + [v_outer_c_h + v_one_half, v_zero, v_zero], + [ + v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_zero, + ], + [v_one, v_zero, v_zero], + [ + v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_one, + ], + [v_outer_c_h + v_one_half, v_zero, v_one], + [ + v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_one, + ], + [v_one, v_zero, v_one], + ] + ) - bottom = _np.array( - [ - [v_one, v_zero], - [v_inner_c_h + v_one_half, -v_h_void + v_one_half], - [v_zero, v_zero], - [-v_inner_c_h + v_one_half, -v_h_void + v_one_half], - ] - ) + elif closure == "y_min": + # set points: + right = _np.array( + [ + [ + v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_zero, + ], + [v_one, -v_outer_c_h + v_one_half, v_zero], + [ + v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_zero, + ], + [v_one, v_outer_c_h + v_one_half, v_zero], + [ + v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_one, + ], + [v_one, -v_outer_c_h + v_one_half, v_one], + [ + v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_one, + ], + [v_one, v_outer_c_h + v_one_half, v_one], + ] + ) - bottom_right = _np.array( - [ - [v_inner_c_h + v_one_half, -v_h_void + v_one_half], - [v_one, v_zero], - [v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_one, -v_outer_c_h + v_one_half], - ] - ) + right_top = _np.array( + [ + [ + v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_zero, + ], + [v_one, v_outer_c_h + v_one_half, v_zero], + [ + v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_zero, + ], + [v_outer_c_h + v_one_half, v_one, v_zero], + [ + v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_one, + ], + [v_one, v_outer_c_h + v_one_half, v_one], + [ + v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_one, + ], + [v_outer_c_h + v_one_half, v_one, v_one], + ] + ) - elif closure == "y_max": - # set points: - right = _np.array( - [ - [v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_one, -v_outer_c_h + v_one_half], - [v_h_void + v_one_half, v_inner_c_h + v_one_half], - [v_one, v_outer_c_h + v_one_half], - ] - ) + top = _np.array( + [ + [ + v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_zero, + ], + [v_outer_c_h + v_one_half, v_one, v_zero], + [ + -v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_zero, + ], + [-v_outer_c_h + v_one_half, v_one, v_zero], + [ + v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_one, + ], + [v_outer_c_h + v_one_half, v_one, v_one], + [ + -v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_one, + ], + [-v_outer_c_h + v_one_half, v_one, v_one], + ] + ) - right_top = _np.array( - [ - [v_h_void + v_one_half, v_inner_c_h + v_one_half], - [v_one, v_outer_c_h + v_one_half], - [v_inner_c_h + v_one_half, v_h_void + v_one_half], - [v_one, v_one], - ] - ) + bottom_left = _np.array( + [ + [ + -v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_zero, + ], + [v_zero, -v_outer_c_h + v_one_half, v_zero], + [ + -v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_zero, + ], + [v_zero, v_zero, v_zero], + [ + -v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_one, + ], + [v_zero, -v_outer_c_h + v_one_half, v_one], + [ + -v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_one, + ], + [v_zero, v_zero, v_one], + ] + ) - top = _np.array( - [ - [v_inner_c_h + v_one_half, v_h_void + v_one_half], - [v_one, v_one], - [-v_inner_c_h + v_one_half, v_h_void + v_one_half], - [v_zero, v_one], - ] - ) + left = _np.array( + [ + [v_zero, -v_outer_c_h + v_one_half, v_zero], + [ + -v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_zero, + ], + [v_zero, v_outer_c_h + v_one_half, v_zero], + [ + -v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_zero, + ], + [v_zero, -v_outer_c_h + v_one_half, v_one], + [ + -v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_one, + ], + [v_zero, v_outer_c_h + v_one_half, v_one], + [ + -v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_one, + ], + ] + ) - bottom_left = _np.array( - [ - [-v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_zero, -v_outer_c_h + v_one_half], - [-v_inner_c_h + v_one_half, -v_h_void + v_one_half], - [-v_outer_c_h + v_one_half, v_zero], - ] - ) + top_left = _np.array( + [ + [v_zero, v_outer_c_h + v_one_half, v_zero], + [ + -v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_zero, + ], + [-v_outer_c_h + v_one_half, v_one, v_zero], + [ + -v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_zero, + ], + [v_zero, v_outer_c_h + v_one_half, v_one], + [ + -v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_one, + ], + [-v_outer_c_h + v_one_half, v_one, v_one], + [ + -v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_one, + ], + ] + ) - left = _np.array( - [ - [v_zero, -v_outer_c_h + v_one_half], - [-v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_zero, v_outer_c_h + v_one_half], - [-v_h_void + v_one_half, v_inner_c_h + v_one_half], - ] - ) + bottom = _np.array( + [ + [v_one, v_zero, v_zero], + [ + v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_zero, + ], + [v_zero, v_zero, v_zero], + [ + -v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_zero, + ], + [v_one, v_zero, v_one], + [ + v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_one, + ], + [v_zero, v_zero, v_one], + [ + -v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_one, + ], + ] + ) - top_left = _np.array( - [ - [v_zero, v_outer_c_h + v_one_half], - [-v_h_void + v_one_half, v_inner_c_h + v_one_half], - [v_zero, v_one], - [-v_inner_c_h + v_one_half, v_h_void + v_one_half], - ] - ) + bottom_right = _np.array( + [ + [ + v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_zero, + ], + [v_one, v_zero, v_zero], + [ + v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_zero, + ], + [v_one, -v_outer_c_h + v_one_half, v_zero], + [ + v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_one, + ], + [v_one, v_zero, v_one], + [ + v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_one, + ], + [v_one, -v_outer_c_h + v_one_half, v_one], + ] + ) - bottom = _np.array( - [ - [v_outer_c_h + v_one_half, v_zero], - [v_inner_c_h + v_one_half, -v_h_void + v_one_half], - [-v_outer_c_h + v_one_half, v_zero], - [-v_inner_c_h + v_one_half, -v_h_void + v_one_half], - ] - ) + elif closure == "y_max": + # set points: + right = _np.array( + [ + [ + v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_zero, + ], + [v_one, -v_outer_c_h + v_one_half, v_zero], + [ + v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_zero, + ], + [v_one, v_outer_c_h + v_one_half, v_zero], + [ + v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_one, + ], + [v_one, -v_outer_c_h + v_one_half, v_one], + [ + v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_one, + ], + [v_one, v_outer_c_h + v_one_half, v_one], + ] + ) - bottom_right = _np.array( - [ - [v_inner_c_h + v_one_half, -v_h_void + v_one_half], - [v_outer_c_h + v_one_half, v_zero], - [v_h_void + v_one_half, -v_inner_c_h + v_one_half], - [v_one, -v_outer_c_h + v_one_half], - ] - ) + right_top = _np.array( + [ + [ + v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_zero, + ], + [v_one, v_outer_c_h + v_one_half, v_zero], + [ + v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_zero, + ], + [v_one, v_one, v_zero], + [ + v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_one, + ], + [v_one, v_outer_c_h + v_one_half, v_one], + [ + v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_one, + ], + [v_one, v_one, v_one], + ] + ) - spline_list.append(_Bezier(degrees=[1, 1], control_points=right)) + top = _np.array( + [ + [ + v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_zero, + ], + [v_one, v_one, v_zero], + [ + -v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_zero, + ], + [v_zero, v_one, v_zero], + [ + v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_one, + ], + [v_one, v_one, v_one], + [ + -v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_one, + ], + [v_zero, v_one, v_one], + ] + ) - spline_list.append(_Bezier(degrees=[1, 1], control_points=right_top)) + bottom_left = _np.array( + [ + [ + -v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_zero, + ], + [v_zero, -v_outer_c_h + v_one_half, v_zero], + [ + -v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_zero, + ], + [-v_outer_c_h + v_one_half, v_zero, v_zero], + [ + -v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_one, + ], + [v_zero, -v_outer_c_h + v_one_half, v_one], + [ + -v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_one, + ], + [-v_outer_c_h + v_one_half, v_zero, v_one], + ] + ) - spline_list.append(_Bezier(degrees=[1, 1], control_points=bottom)) + left = _np.array( + [ + [v_zero, -v_outer_c_h + v_one_half, v_zero], + [ + -v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_zero, + ], + [v_zero, v_outer_c_h + v_one_half, v_zero], + [ + -v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_zero, + ], + [v_zero, -v_outer_c_h + v_one_half, v_one], + [ + -v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_one, + ], + [v_zero, v_outer_c_h + v_one_half, v_one], + [ + -v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_one, + ], + ] + ) - spline_list.append(_Bezier(degrees=[1, 1], control_points=bottom_left)) + top_left = _np.array( + [ + [v_zero, v_outer_c_h + v_one_half, v_zero], + [ + -v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_zero, + ], + [v_zero, v_one, v_zero], + [ + -v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_zero, + ], + [v_zero, v_outer_c_h + v_one_half, v_one], + [ + -v_h_void + v_one_half, + v_inner_c_h + v_one_half, + v_one, + ], + [v_zero, v_one, v_one], + [ + -v_inner_c_h + v_one_half, + v_h_void + v_one_half, + v_one, + ], + ] + ) - spline_list.append(_Bezier(degrees=[1, 1], control_points=left)) + bottom = _np.array( + [ + [v_outer_c_h + v_one_half, v_zero, v_zero], + [ + v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_zero, + ], + [-v_outer_c_h + v_one_half, v_zero, v_zero], + [ + -v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_zero, + ], + [v_outer_c_h + v_one_half, v_zero, v_one], + [ + v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_one, + ], + [-v_outer_c_h + v_one_half, v_zero, v_one], + [ + -v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_one, + ], + ] + ) - spline_list.append(_Bezier(degrees=[1, 1], control_points=top_left)) + bottom_right = _np.array( + [ + [ + v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_zero, + ], + [v_outer_c_h + v_one_half, v_zero, v_zero], + [ + v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_zero, + ], + [v_one, -v_outer_c_h + v_one_half, v_zero], + [ + v_inner_c_h + v_one_half, + -v_h_void + v_one_half, + v_one, + ], + [v_outer_c_h + v_one_half, v_zero, v_one], + [ + v_h_void + v_one_half, + -v_inner_c_h + v_one_half, + v_one, + ], + [v_one, -v_outer_c_h + v_one_half, v_one], + ] + ) - spline_list.append(_Bezier(degrees=[1, 1], control_points=top)) + for control_points in [ + right, + right_top, + bottom, + bottom_left, + left, + top_left, + top, + bottom_right, + ]: + spline_list.append( + _Bezier(degrees=[1, 1, 1], control_points=control_points) + ) - spline_list.append( - _Bezier(degrees=[1, 1], control_points=bottom_right) - ) + if i_derivative == 0: + splines = spline_list.copy() + else: + derivatives.append(spline_list) - return (spline_list, None) + return (splines, derivatives) diff --git a/splinepy/microstructure/tiles/inverse_cross_3d.py b/splinepy/microstructure/tiles/inverse_cross_3d.py index c24954702..43e5ed632 100644 --- a/splinepy/microstructure/tiles/inverse_cross_3d.py +++ b/splinepy/microstructure/tiles/inverse_cross_3d.py @@ -32,6 +32,16 @@ class InverseCross3D(_TileBase): ] ) _n_info_per_eval_point = 1 + # TODO: implemented sensitivities are not correct + _sensitivities_implemented = True + _closure_directions = ["z_min", "z_max"] + _parameter_bounds = [[0.2, 0.3]] * 6 # For default values + _parameters_shape = (6, 1) + _default_parameter_value = 0.21 + + _BOUNDARY_WIDTH_BOUNDS = [0.0, 0.5] + _FILLING_HEIGHT_BOUNDS = [0.0, 1.0] + _CENTER_EXPANSION_BOUNDS = [0.5, 1.5] def _closing_tile( self, @@ -40,7 +50,7 @@ def _closing_tile( closure=None, boundary_width=0.1, filling_height=0.5, - seperator_distance=None, + separator_distance=0.3, **kwargs, # noqa ARG002 ): """Create a closing tile to match with closed surface. @@ -53,7 +63,7 @@ def _closing_tile( with of the boundary surrounding branch filling_height : float portion of the height that is filled in parametric domain - seperator_distance : float + separator_distance : float Describes the position of the separator layer in the control point domain closure : str @@ -69,827 +79,951 @@ def _closing_tile( if closure is None: raise ValueError("No closing direction given") - # Set default values - if seperator_distance is None: - seperator_distance = 0.3 - - if parameters is None: - self._logd("Tile request is not parametrized, setting default 0.2") - parameters = ( - _np.ones( - ( - self._evaluation_points.shape[0], - self._n_info_per_eval_point, - ) - ) - * 0.2 - ) - - self.check_params(parameters) - - if parameter_sensitivities is not None: - raise NotImplementedError( - "Derivatives are not implemented for this tile yet" - ) - - if not (_np.all(parameters > 0) and _np.all(parameters < 0.5)): - raise ValueError("Thickness out of range (0, .5)") - - if not (0.0 < float(boundary_width) < 0.5): - raise ValueError("Boundary Width is out of range") - - if not (0.0 < float(filling_height) < 1.0): - raise ValueError("Filling must be in (0,1)") + parameters, n_derivatives, derivatives = self._process_input( + parameters=parameters, + parameter_sensitivities=parameter_sensitivities, + ) - # Precompute auxiliary values - inv_filling_height = 1.0 - filling_height - ctps_mid_height_top = (1 + filling_height) * 0.5 - ctps_mid_height_bottom = 1.0 - ctps_mid_height_top - center_width = 1.0 - 2 * boundary_width - r_center = center_width * 0.5 - half_r_center = (r_center + 0.5) * 0.5 - aux_column_width = 0.5 - 2 * (0.5 - seperator_distance) + self._check_custom_parameter( + boundary_width, "boundary width", self._BOUNDARY_WIDTH_BOUNDS + ) + self._check_custom_parameter( + filling_height, "filling height", self._FILLING_HEIGHT_BOUNDS + ) - spline_list = [] - if closure == "z_min": - branch_thickness = parameters.flatten()[5] - branch_neighbor_x_min_ctps = _np.array( - [ - [-0.5, -r_center, filling_height], - [-half_r_center, -r_center, filling_height], - [-r_center, -r_center, filling_height], - [-0.5, r_center, filling_height], - [-half_r_center, r_center, filling_height], - [-r_center, r_center, filling_height], - [-0.5, -aux_column_width, ctps_mid_height_top], - [ - -seperator_distance, - -aux_column_width, - ctps_mid_height_top, - ], + splines = [] + + for i_derivative in range(n_derivatives + 1): + if i_derivative == 0: + # Auxiliary values + fill_height_aux = filling_height + sep_distance_aux = separator_distance + inv_filling_height = 1.0 - filling_height + ctps_mid_height_top = (1 + filling_height) * 0.5 + ctps_mid_height_bottom = 1.0 - ctps_mid_height_top + center_width = 1.0 - 2 * boundary_width + r_center = center_width * 0.5 + half_r_center = (r_center + 0.5) * 0.5 + aux_column_width = 0.5 - 2 * (0.5 - separator_distance) + v_zero = 0.0 + v_one_half = 0.5 + v_one = 1.0 + if closure == "z_min": + branch_thickness = parameters.flatten()[5] + elif closure == "z_max": + branch_thickness = parameters.flatten()[4] + else: + fill_height_aux = 0.0 + sep_distance_aux = 0.0 + inv_filling_height = 0.0 + ctps_mid_height_top = 0.0 + ctps_mid_height_bottom = 0.0 + center_width = 0.0 + r_center = 0.0 + half_r_center = 0.0 + aux_column_width = 0.0 + v_zero, v_one_half, v_one = [0.0] * 3 + if closure == "z_min": + branch_thickness = parameter_sensitivities.flatten()[5] + elif closure == "z_max": + branch_thickness = parameter_sensitivities.flatten()[4] + spline_list = [] + if closure == "z_min": + branch_neighbor_x_min_ctps = _np.array( [ - -branch_thickness, - -branch_thickness, - ctps_mid_height_top, - ], - [-0.5, aux_column_width, ctps_mid_height_top], - [ - -seperator_distance, - aux_column_width, - ctps_mid_height_top, - ], - [-branch_thickness, branch_thickness, ctps_mid_height_top], - [-0.5, -aux_column_width, 1.0], - [-seperator_distance, -aux_column_width, 1.0], - [-branch_thickness, -branch_thickness, 1.0], - [-0.5, aux_column_width, 1.0], - [-seperator_distance, aux_column_width, 1.0], - [-branch_thickness, branch_thickness, 1.0], - ] - ) + _np.array([0.5, 0.5, 0.0]) - - spline_list.append( - _Bezier( - degrees=[2, 1, 2], - control_points=branch_neighbor_x_min_ctps, + [-v_one_half, -r_center, fill_height_aux], + [-half_r_center, -r_center, fill_height_aux], + [-r_center, -r_center, fill_height_aux], + [-v_one_half, r_center, fill_height_aux], + [-half_r_center, r_center, fill_height_aux], + [-r_center, r_center, fill_height_aux], + [-v_one_half, -aux_column_width, ctps_mid_height_top], + [ + -sep_distance_aux, + -aux_column_width, + ctps_mid_height_top, + ], + [ + -branch_thickness, + -branch_thickness, + ctps_mid_height_top, + ], + [-v_one_half, aux_column_width, ctps_mid_height_top], + [ + -sep_distance_aux, + aux_column_width, + ctps_mid_height_top, + ], + [ + -branch_thickness, + branch_thickness, + ctps_mid_height_top, + ], + [-v_one_half, -aux_column_width, v_one], + [-sep_distance_aux, -aux_column_width, v_one], + [-branch_thickness, -branch_thickness, v_one], + [-v_one_half, aux_column_width, v_one], + [-sep_distance_aux, aux_column_width, v_one], + [-branch_thickness, branch_thickness, v_one], + ] + ) + _np.array([v_one_half, v_one_half, v_zero]) + + spline_list.append( + _Bezier( + degrees=[2, 1, 2], + control_points=branch_neighbor_x_min_ctps, + ) ) - ) - branch_neighbor_x_max_ctps = _np.array( - [ - [r_center, -r_center, filling_height], - [half_r_center, -r_center, filling_height], - [0.5, -r_center, filling_height], - [r_center, r_center, filling_height], - [half_r_center, r_center, filling_height], - [0.5, r_center, filling_height], - [branch_thickness, -branch_thickness, ctps_mid_height_top], + branch_neighbor_x_max_ctps = _np.array( [ - seperator_distance, - -aux_column_width, - ctps_mid_height_top, - ], - [0.5, -aux_column_width, ctps_mid_height_top], - [branch_thickness, branch_thickness, ctps_mid_height_top], - [ - seperator_distance, - aux_column_width, - ctps_mid_height_top, - ], - [0.5, aux_column_width, ctps_mid_height_top], - [branch_thickness, -branch_thickness, 1.0], - [seperator_distance, -aux_column_width, 1.0], - [0.5, -aux_column_width, 1.0], - [branch_thickness, branch_thickness, 1.0], - [seperator_distance, aux_column_width, 1.0], - [0.5, aux_column_width, 1.0], - ] - ) + _np.array([0.5, 0.5, 0.0]) - - spline_list.append( - _Bezier( - degrees=[2, 1, 2], - control_points=branch_neighbor_x_max_ctps, + [r_center, -r_center, fill_height_aux], + [half_r_center, -r_center, fill_height_aux], + [v_one_half, -r_center, fill_height_aux], + [r_center, r_center, fill_height_aux], + [half_r_center, r_center, fill_height_aux], + [v_one_half, r_center, fill_height_aux], + [ + branch_thickness, + -branch_thickness, + ctps_mid_height_top, + ], + [ + sep_distance_aux, + -aux_column_width, + ctps_mid_height_top, + ], + [v_one_half, -aux_column_width, ctps_mid_height_top], + [ + branch_thickness, + branch_thickness, + ctps_mid_height_top, + ], + [ + sep_distance_aux, + aux_column_width, + ctps_mid_height_top, + ], + [v_one_half, aux_column_width, ctps_mid_height_top], + [branch_thickness, -branch_thickness, v_one], + [sep_distance_aux, -aux_column_width, v_one], + [v_one_half, -aux_column_width, v_one], + [branch_thickness, branch_thickness, v_one], + [sep_distance_aux, aux_column_width, v_one], + [v_one_half, aux_column_width, v_one], + ] + ) + _np.array([v_one_half, v_one_half, v_zero]) + + spline_list.append( + _Bezier( + degrees=[2, 1, 2], + control_points=branch_neighbor_x_max_ctps, + ) ) - ) - branch_neighbor_y_min_ctps = _np.array( - [ - [-r_center, -0.5, filling_height], - [r_center, -0.5, filling_height], - [-r_center, -half_r_center, filling_height], - [r_center, -half_r_center, filling_height], - [-r_center, -r_center, filling_height], - [r_center, -r_center, filling_height], - [-aux_column_width, -0.5, ctps_mid_height_top], - [aux_column_width, -0.5, ctps_mid_height_top], + branch_neighbor_y_min_ctps = _np.array( [ - -aux_column_width, - -seperator_distance, - ctps_mid_height_top, - ], - [ - aux_column_width, - -seperator_distance, - ctps_mid_height_top, - ], - [ - -branch_thickness, - -branch_thickness, - ctps_mid_height_top, - ], - [branch_thickness, -branch_thickness, ctps_mid_height_top], - [-aux_column_width, -0.5, 1.0], - [aux_column_width, -0.5, 1.0], - [-aux_column_width, -seperator_distance, 1.0], - [aux_column_width, -seperator_distance, 1.0], - [-branch_thickness, -branch_thickness, 1.0], - [branch_thickness, -branch_thickness, 1.0], - ] - ) + _np.array([0.5, 0.5, 0.0]) - - spline_list.append( - _Bezier( - degrees=[1, 2, 2], - control_points=branch_neighbor_y_min_ctps, + [-r_center, -v_one_half, fill_height_aux], + [r_center, -v_one_half, fill_height_aux], + [-r_center, -half_r_center, fill_height_aux], + [r_center, -half_r_center, fill_height_aux], + [-r_center, -r_center, fill_height_aux], + [r_center, -r_center, fill_height_aux], + [-aux_column_width, -v_one_half, ctps_mid_height_top], + [aux_column_width, -v_one_half, ctps_mid_height_top], + [ + -aux_column_width, + -sep_distance_aux, + ctps_mid_height_top, + ], + [ + aux_column_width, + -sep_distance_aux, + ctps_mid_height_top, + ], + [ + -branch_thickness, + -branch_thickness, + ctps_mid_height_top, + ], + [ + branch_thickness, + -branch_thickness, + ctps_mid_height_top, + ], + [-aux_column_width, -v_one_half, v_one], + [aux_column_width, -v_one_half, v_one], + [-aux_column_width, -sep_distance_aux, v_one], + [aux_column_width, -sep_distance_aux, v_one], + [-branch_thickness, -branch_thickness, v_one], + [branch_thickness, -branch_thickness, v_one], + ] + ) + _np.array([v_one_half, v_one_half, v_zero]) + + spline_list.append( + _Bezier( + degrees=[1, 2, 2], + control_points=branch_neighbor_y_min_ctps, + ) ) - ) - branch_neighbor_y_max_ctps = _np.array( - [ - [-r_center, r_center, filling_height], - [r_center, r_center, filling_height], - [-r_center, half_r_center, filling_height], - [r_center, half_r_center, filling_height], - [-r_center, 0.5, filling_height], - [r_center, 0.5, filling_height], - [-branch_thickness, branch_thickness, ctps_mid_height_top], - [branch_thickness, branch_thickness, ctps_mid_height_top], + branch_neighbor_y_max_ctps = _np.array( [ - -aux_column_width, - seperator_distance, - ctps_mid_height_top, - ], - [ - aux_column_width, - seperator_distance, - ctps_mid_height_top, - ], - [-aux_column_width, 0.5, ctps_mid_height_top], - [aux_column_width, 0.5, ctps_mid_height_top], - [-branch_thickness, branch_thickness, 1.0], - [branch_thickness, branch_thickness, 1.0], - [-aux_column_width, seperator_distance, 1.0], - [aux_column_width, seperator_distance, 1.0], - [-aux_column_width, 0.5, 1.0], - [aux_column_width, 0.5, 1.0], - ] - ) + _np.array([0.5, 0.5, 0.0]) - - spline_list.append( - _Bezier( - degrees=[1, 2, 2], - control_points=branch_neighbor_y_max_ctps, + [-r_center, r_center, fill_height_aux], + [r_center, r_center, fill_height_aux], + [-r_center, half_r_center, fill_height_aux], + [r_center, half_r_center, fill_height_aux], + [-r_center, v_one_half, fill_height_aux], + [r_center, v_one_half, fill_height_aux], + [ + -branch_thickness, + branch_thickness, + ctps_mid_height_top, + ], + [ + branch_thickness, + branch_thickness, + ctps_mid_height_top, + ], + [ + -aux_column_width, + sep_distance_aux, + ctps_mid_height_top, + ], + [ + aux_column_width, + sep_distance_aux, + ctps_mid_height_top, + ], + [-aux_column_width, v_one_half, ctps_mid_height_top], + [aux_column_width, v_one_half, ctps_mid_height_top], + [-branch_thickness, branch_thickness, v_one], + [branch_thickness, branch_thickness, v_one], + [-aux_column_width, sep_distance_aux, v_one], + [aux_column_width, sep_distance_aux, v_one], + [-aux_column_width, v_one_half, v_one], + [aux_column_width, v_one_half, v_one], + ] + ) + _np.array([v_one_half, v_one_half, v_zero]) + + spline_list.append( + _Bezier( + degrees=[1, 2, 2], + control_points=branch_neighbor_y_max_ctps, + ) ) - ) - branch_x_min_y_min_ctps = _np.array( - [ - [-0.5, -0.5, filling_height], - [-half_r_center, -0.5, filling_height], - [-r_center, -0.5, filling_height], - [-0.5, -half_r_center, filling_height], - [-half_r_center, -half_r_center, filling_height], - [-r_center, -half_r_center, filling_height], - [-0.5, -r_center, filling_height], - [-half_r_center, -r_center, filling_height], - [-r_center, -r_center, filling_height], - [-0.5, -0.5, ctps_mid_height_top], - [-seperator_distance, -0.5, ctps_mid_height_top], - [-aux_column_width, -0.5, ctps_mid_height_top], - [-0.5, -seperator_distance, ctps_mid_height_top], - [ - -seperator_distance, - -seperator_distance, - ctps_mid_height_top, - ], - [ - -aux_column_width, - -seperator_distance, - ctps_mid_height_top, - ], - [-0.5, -aux_column_width, ctps_mid_height_top], + branch_x_min_y_min_ctps = _np.array( [ - -seperator_distance, - -aux_column_width, - ctps_mid_height_top, - ], - [ - -branch_thickness, - -branch_thickness, - ctps_mid_height_top, - ], - [-0.5, -0.5, 1.0], - [-seperator_distance, -0.5, 1.0], - [-aux_column_width, -0.5, 1.0], - [-0.5, -seperator_distance, 1.0], - [-seperator_distance, -seperator_distance, 1.0], - [-aux_column_width, -seperator_distance, 1.0], - [-0.5, -aux_column_width, 1.0], - [-seperator_distance, -aux_column_width, 1.0], - [-branch_thickness, -branch_thickness, 1.0], - ] - ) + _np.array([0.5, 0.5, 0.0]) - - spline_list.append( - _Bezier( - degrees=[2, 2, 2], control_points=branch_x_min_y_min_ctps + [-v_one_half, -v_one_half, fill_height_aux], + [-half_r_center, -v_one_half, fill_height_aux], + [-r_center, -v_one_half, fill_height_aux], + [-v_one_half, -half_r_center, fill_height_aux], + [-half_r_center, -half_r_center, fill_height_aux], + [-r_center, -half_r_center, fill_height_aux], + [-v_one_half, -r_center, fill_height_aux], + [-half_r_center, -r_center, fill_height_aux], + [-r_center, -r_center, fill_height_aux], + [-v_one_half, -v_one_half, ctps_mid_height_top], + [-sep_distance_aux, -v_one_half, ctps_mid_height_top], + [-aux_column_width, -v_one_half, ctps_mid_height_top], + [-v_one_half, -sep_distance_aux, ctps_mid_height_top], + [ + -sep_distance_aux, + -sep_distance_aux, + ctps_mid_height_top, + ], + [ + -aux_column_width, + -sep_distance_aux, + ctps_mid_height_top, + ], + [-v_one_half, -aux_column_width, ctps_mid_height_top], + [ + -sep_distance_aux, + -aux_column_width, + ctps_mid_height_top, + ], + [ + -branch_thickness, + -branch_thickness, + ctps_mid_height_top, + ], + [-v_one_half, -v_one_half, v_one], + [-sep_distance_aux, -v_one_half, v_one], + [-aux_column_width, -v_one_half, v_one], + [-v_one_half, -sep_distance_aux, v_one], + [-sep_distance_aux, -sep_distance_aux, v_one], + [-aux_column_width, -sep_distance_aux, v_one], + [-v_one_half, -aux_column_width, v_one], + [-sep_distance_aux, -aux_column_width, v_one], + [-branch_thickness, -branch_thickness, v_one], + ] + ) + _np.array([v_one_half, v_one_half, v_zero]) + + spline_list.append( + _Bezier( + degrees=[2, 2, 2], + control_points=branch_x_min_y_min_ctps, + ) ) - ) - branch_x_min_y_max_ctps = _np.array( - [ - [-0.5, r_center, filling_height], - [-half_r_center, r_center, filling_height], - [-r_center, r_center, filling_height], - [-0.5, half_r_center, filling_height], - [-half_r_center, half_r_center, filling_height], - [-r_center, half_r_center, filling_height], - [-0.5, 0.5, filling_height], - [-half_r_center, 0.5, filling_height], - [-r_center, 0.5, filling_height], - [-0.5, aux_column_width, ctps_mid_height_top], - [ - -seperator_distance, - aux_column_width, - ctps_mid_height_top, - ], - [-branch_thickness, branch_thickness, ctps_mid_height_top], - [-0.5, seperator_distance, ctps_mid_height_top], + branch_x_min_y_max_ctps = _np.array( [ - -seperator_distance, - seperator_distance, - ctps_mid_height_top, - ], - [ - -aux_column_width, - seperator_distance, - ctps_mid_height_top, - ], - [-0.5, 0.5, ctps_mid_height_top], - [-seperator_distance, 0.5, ctps_mid_height_top], - [-aux_column_width, 0.5, ctps_mid_height_top], - [-0.5, aux_column_width, 1.0], - [-seperator_distance, aux_column_width, 1.0], - [-branch_thickness, branch_thickness, 1.0], - [-0.5, seperator_distance, 1.0], - [-seperator_distance, seperator_distance, 1.0], - [-aux_column_width, seperator_distance, 1.0], - [-0.5, 0.5, 1.0], - [-seperator_distance, 0.5, 1.0], - [-aux_column_width, 0.5, 1.0], - ] - ) + _np.array([0.5, 0.5, 0.0]) - - spline_list.append( - _Bezier( - degrees=[2, 2, 2], control_points=branch_x_min_y_max_ctps + [-v_one_half, r_center, fill_height_aux], + [-half_r_center, r_center, fill_height_aux], + [-r_center, r_center, fill_height_aux], + [-v_one_half, half_r_center, fill_height_aux], + [-half_r_center, half_r_center, fill_height_aux], + [-r_center, half_r_center, fill_height_aux], + [-v_one_half, v_one_half, fill_height_aux], + [-half_r_center, v_one_half, fill_height_aux], + [-r_center, v_one_half, fill_height_aux], + [-v_one_half, aux_column_width, ctps_mid_height_top], + [ + -sep_distance_aux, + aux_column_width, + ctps_mid_height_top, + ], + [ + -branch_thickness, + branch_thickness, + ctps_mid_height_top, + ], + [-v_one_half, sep_distance_aux, ctps_mid_height_top], + [ + -sep_distance_aux, + sep_distance_aux, + ctps_mid_height_top, + ], + [ + -aux_column_width, + sep_distance_aux, + ctps_mid_height_top, + ], + [-v_one_half, v_one_half, ctps_mid_height_top], + [-sep_distance_aux, v_one_half, ctps_mid_height_top], + [-aux_column_width, v_one_half, ctps_mid_height_top], + [-v_one_half, aux_column_width, v_one], + [-sep_distance_aux, aux_column_width, v_one], + [-branch_thickness, branch_thickness, v_one], + [-v_one_half, sep_distance_aux, v_one], + [-sep_distance_aux, sep_distance_aux, v_one], + [-aux_column_width, sep_distance_aux, v_one], + [-v_one_half, v_one_half, v_one], + [-sep_distance_aux, v_one_half, v_one], + [-aux_column_width, v_one_half, v_one], + ] + ) + _np.array([v_one_half, v_one_half, v_zero]) + + spline_list.append( + _Bezier( + degrees=[2, 2, 2], + control_points=branch_x_min_y_max_ctps, + ) ) - ) - branch_x_max_y_min_ctps = _np.array( - [ - [r_center, -0.5, filling_height], - [half_r_center, -0.5, filling_height], - [0.5, -0.5, filling_height], - [r_center, -half_r_center, filling_height], - [half_r_center, -half_r_center, filling_height], - [0.5, -half_r_center, filling_height], - [r_center, -r_center, filling_height], - [half_r_center, -r_center, filling_height], - [0.5, -r_center, filling_height], - [aux_column_width, -0.5, ctps_mid_height_top], - [seperator_distance, -0.5, ctps_mid_height_top], - [0.5, -0.5, ctps_mid_height_top], - [ - aux_column_width, - -seperator_distance, - ctps_mid_height_top, - ], - [ - seperator_distance, - -seperator_distance, - ctps_mid_height_top, - ], - [0.5, -seperator_distance, ctps_mid_height_top], - [branch_thickness, -branch_thickness, ctps_mid_height_top], + branch_x_max_y_min_ctps = _np.array( [ - seperator_distance, - -aux_column_width, - ctps_mid_height_top, - ], - [0.5, -aux_column_width, ctps_mid_height_top], - [aux_column_width, -0.5, 1.0], - [seperator_distance, -0.5, 1.0], - [0.5, -0.5, 1.0], - [aux_column_width, -seperator_distance, 1.0], - [seperator_distance, -seperator_distance, 1.0], - [0.5, -seperator_distance, 1.0], - [branch_thickness, -branch_thickness, 1.0], - [seperator_distance, -aux_column_width, 1.0], - [0.5, -aux_column_width, 1.0], - ] - ) + _np.array([0.5, 0.5, 0.0]) - - spline_list.append( - _Bezier( - degrees=[2, 2, 2], control_points=branch_x_max_y_min_ctps + [r_center, -v_one_half, fill_height_aux], + [half_r_center, -v_one_half, fill_height_aux], + [v_one_half, -v_one_half, fill_height_aux], + [r_center, -half_r_center, fill_height_aux], + [half_r_center, -half_r_center, fill_height_aux], + [v_one_half, -half_r_center, fill_height_aux], + [r_center, -r_center, fill_height_aux], + [half_r_center, -r_center, fill_height_aux], + [v_one_half, -r_center, fill_height_aux], + [aux_column_width, -v_one_half, ctps_mid_height_top], + [sep_distance_aux, -v_one_half, ctps_mid_height_top], + [v_one_half, -v_one_half, ctps_mid_height_top], + [ + aux_column_width, + -sep_distance_aux, + ctps_mid_height_top, + ], + [ + sep_distance_aux, + -sep_distance_aux, + ctps_mid_height_top, + ], + [v_one_half, -sep_distance_aux, ctps_mid_height_top], + [ + branch_thickness, + -branch_thickness, + ctps_mid_height_top, + ], + [ + sep_distance_aux, + -aux_column_width, + ctps_mid_height_top, + ], + [v_one_half, -aux_column_width, ctps_mid_height_top], + [aux_column_width, -v_one_half, v_one], + [sep_distance_aux, -v_one_half, v_one], + [v_one_half, -v_one_half, v_one], + [aux_column_width, -sep_distance_aux, v_one], + [sep_distance_aux, -sep_distance_aux, v_one], + [v_one_half, -sep_distance_aux, v_one], + [branch_thickness, -branch_thickness, v_one], + [sep_distance_aux, -aux_column_width, v_one], + [v_one_half, -aux_column_width, v_one], + ] + ) + _np.array([v_one_half, v_one_half, v_zero]) + + spline_list.append( + _Bezier( + degrees=[2, 2, 2], + control_points=branch_x_max_y_min_ctps, + ) ) - ) - branch_x_max_y_max_ctps = _np.array( - [ - [r_center, r_center, filling_height], - [half_r_center, r_center, filling_height], - [0.5, r_center, filling_height], - [r_center, half_r_center, filling_height], - [half_r_center, half_r_center, filling_height], - [0.5, half_r_center, filling_height], - [r_center, 0.5, filling_height], - [half_r_center, 0.5, filling_height], - [0.5, 0.5, filling_height], - [branch_thickness, branch_thickness, ctps_mid_height_top], - [ - seperator_distance, - aux_column_width, - ctps_mid_height_top, - ], - [0.5, aux_column_width, ctps_mid_height_top], - [ - aux_column_width, - seperator_distance, - ctps_mid_height_top, - ], + branch_x_max_y_max_ctps = _np.array( [ - seperator_distance, - seperator_distance, - ctps_mid_height_top, - ], - [0.5, seperator_distance, ctps_mid_height_top], - [aux_column_width, 0.5, ctps_mid_height_top], - [seperator_distance, 0.5, ctps_mid_height_top], - [0.5, 0.5, ctps_mid_height_top], - [branch_thickness, branch_thickness, 1.0], - [seperator_distance, aux_column_width, 1.0], - [0.5, aux_column_width, 1.0], - [aux_column_width, seperator_distance, 1.0], - [seperator_distance, seperator_distance, 1.0], - [0.5, seperator_distance, 1.0], - [aux_column_width, 0.5, 1.0], - [seperator_distance, 0.5, 1.0], - [0.5, 0.5, 1.0], - ] - ) + _np.array([0.5, 0.5, 0.0]) - - spline_list.append( - _Bezier( - degrees=[2, 2, 2], control_points=branch_x_max_y_max_ctps + [r_center, r_center, fill_height_aux], + [half_r_center, r_center, fill_height_aux], + [v_one_half, r_center, fill_height_aux], + [r_center, half_r_center, fill_height_aux], + [half_r_center, half_r_center, fill_height_aux], + [v_one_half, half_r_center, fill_height_aux], + [r_center, v_one_half, fill_height_aux], + [half_r_center, v_one_half, fill_height_aux], + [v_one_half, v_one_half, fill_height_aux], + [ + branch_thickness, + branch_thickness, + ctps_mid_height_top, + ], + [ + sep_distance_aux, + aux_column_width, + ctps_mid_height_top, + ], + [v_one_half, aux_column_width, ctps_mid_height_top], + [ + aux_column_width, + sep_distance_aux, + ctps_mid_height_top, + ], + [ + sep_distance_aux, + sep_distance_aux, + ctps_mid_height_top, + ], + [v_one_half, sep_distance_aux, ctps_mid_height_top], + [aux_column_width, v_one_half, ctps_mid_height_top], + [sep_distance_aux, v_one_half, ctps_mid_height_top], + [v_one_half, v_one_half, ctps_mid_height_top], + [branch_thickness, branch_thickness, v_one], + [sep_distance_aux, aux_column_width, v_one], + [v_one_half, aux_column_width, v_one], + [aux_column_width, sep_distance_aux, v_one], + [sep_distance_aux, sep_distance_aux, v_one], + [v_one_half, sep_distance_aux, v_one], + [aux_column_width, v_one_half, v_one], + [sep_distance_aux, v_one_half, v_one], + [v_one_half, v_one_half, v_one], + ] + ) + _np.array([v_one_half, v_one_half, v_zero]) + + spline_list.append( + _Bezier( + degrees=[2, 2, 2], + control_points=branch_x_max_y_max_ctps, + ) ) - ) - return (spline_list, None) - - elif closure == "z_max": - branch_thickness = parameters.flatten()[4] - branch_neighbor_x_min_ctps = _np.array( - [ - [-0.5, -aux_column_width, 0.0], - [-seperator_distance, -aux_column_width, 0.0], - [-branch_thickness, -branch_thickness, 0.0], - [-0.5, aux_column_width, 0.0], - [-seperator_distance, aux_column_width, 0.0], - [-branch_thickness, branch_thickness, 0.0], - [-0.5, -aux_column_width, ctps_mid_height_bottom], - [ - -seperator_distance, - -aux_column_width, - ctps_mid_height_bottom, - ], - [ - -branch_thickness, - -branch_thickness, - ctps_mid_height_bottom, - ], - [-0.5, aux_column_width, ctps_mid_height_bottom], + elif closure == "z_max": + branch_neighbor_x_min_ctps = _np.array( [ - -seperator_distance, - aux_column_width, - ctps_mid_height_bottom, - ], - [ - -branch_thickness, - branch_thickness, - ctps_mid_height_bottom, - ], - [-0.5, -r_center, inv_filling_height], - [-half_r_center, -r_center, inv_filling_height], - [-r_center, -r_center, inv_filling_height], - [-0.5, r_center, inv_filling_height], - [-half_r_center, r_center, inv_filling_height], - [-r_center, r_center, inv_filling_height], - ] - ) + _np.array([0.5, 0.5, 0.0]) - - spline_list.append( - _Bezier( - degrees=[2, 1, 2], - control_points=branch_neighbor_x_min_ctps, + [-v_one_half, -aux_column_width, v_zero], + [-sep_distance_aux, -aux_column_width, v_zero], + [-branch_thickness, -branch_thickness, v_zero], + [-v_one_half, aux_column_width, v_zero], + [-sep_distance_aux, aux_column_width, v_zero], + [-branch_thickness, branch_thickness, v_zero], + [ + -v_one_half, + -aux_column_width, + ctps_mid_height_bottom, + ], + [ + -sep_distance_aux, + -aux_column_width, + ctps_mid_height_bottom, + ], + [ + -branch_thickness, + -branch_thickness, + ctps_mid_height_bottom, + ], + [ + -v_one_half, + aux_column_width, + ctps_mid_height_bottom, + ], + [ + -sep_distance_aux, + aux_column_width, + ctps_mid_height_bottom, + ], + [ + -branch_thickness, + branch_thickness, + ctps_mid_height_bottom, + ], + [-v_one_half, -r_center, inv_filling_height], + [-half_r_center, -r_center, inv_filling_height], + [-r_center, -r_center, inv_filling_height], + [-v_one_half, r_center, inv_filling_height], + [-half_r_center, r_center, inv_filling_height], + [-r_center, r_center, inv_filling_height], + ] + ) + _np.array([v_one_half, v_one_half, v_zero]) + + spline_list.append( + _Bezier( + degrees=[2, 1, 2], + control_points=branch_neighbor_x_min_ctps, + ) ) - ) - branch_neighbor_x_max_ctps = _np.array( - [ - [branch_thickness, -branch_thickness, 0.0], - [seperator_distance, -aux_column_width, 0.0], - [0.5, -aux_column_width, 0.0], - [branch_thickness, branch_thickness, 0.0], - [seperator_distance, aux_column_width, 0.0], - [0.5, aux_column_width, 0.0], - [ - branch_thickness, - -branch_thickness, - ctps_mid_height_bottom, - ], + branch_neighbor_x_max_ctps = _np.array( [ - seperator_distance, - -aux_column_width, - ctps_mid_height_bottom, - ], - [0.5, -aux_column_width, ctps_mid_height_bottom], - [ - branch_thickness, - branch_thickness, - ctps_mid_height_bottom, - ], - [ - seperator_distance, - aux_column_width, - ctps_mid_height_bottom, - ], - [0.5, aux_column_width, ctps_mid_height_bottom], - [r_center, -r_center, inv_filling_height], - [half_r_center, -r_center, inv_filling_height], - [0.5, -r_center, inv_filling_height], - [r_center, r_center, inv_filling_height], - [half_r_center, r_center, inv_filling_height], - [0.5, r_center, inv_filling_height], - ] - ) + _np.array([0.5, 0.5, 0.0]) - - spline_list.append( - _Bezier( - degrees=[2, 1, 2], - control_points=branch_neighbor_x_max_ctps, + [branch_thickness, -branch_thickness, v_zero], + [sep_distance_aux, -aux_column_width, v_zero], + [v_one_half, -aux_column_width, v_zero], + [branch_thickness, branch_thickness, v_zero], + [sep_distance_aux, aux_column_width, v_zero], + [v_one_half, aux_column_width, v_zero], + [ + branch_thickness, + -branch_thickness, + ctps_mid_height_bottom, + ], + [ + sep_distance_aux, + -aux_column_width, + ctps_mid_height_bottom, + ], + [ + v_one_half, + -aux_column_width, + ctps_mid_height_bottom, + ], + [ + branch_thickness, + branch_thickness, + ctps_mid_height_bottom, + ], + [ + sep_distance_aux, + aux_column_width, + ctps_mid_height_bottom, + ], + [v_one_half, aux_column_width, ctps_mid_height_bottom], + [r_center, -r_center, inv_filling_height], + [half_r_center, -r_center, inv_filling_height], + [v_one_half, -r_center, inv_filling_height], + [r_center, r_center, inv_filling_height], + [half_r_center, r_center, inv_filling_height], + [v_one_half, r_center, inv_filling_height], + ] + ) + _np.array([v_one_half, v_one_half, v_zero]) + + spline_list.append( + _Bezier( + degrees=[2, 1, 2], + control_points=branch_neighbor_x_max_ctps, + ) ) - ) - branch_neighbor_y_min_ctps = _np.array( - [ - [-aux_column_width, -0.5, 0.0], - [aux_column_width, -0.5, 0.0], - [-aux_column_width, -seperator_distance, 0.0], - [aux_column_width, -seperator_distance, 0.0], - [-branch_thickness, -branch_thickness, 0.0], - [branch_thickness, -branch_thickness, 0.0], - [-aux_column_width, -0.5, ctps_mid_height_bottom], - [aux_column_width, -0.5, ctps_mid_height_bottom], - [ - -aux_column_width, - -seperator_distance, - ctps_mid_height_bottom, - ], + branch_neighbor_y_min_ctps = _np.array( [ - aux_column_width, - -seperator_distance, - ctps_mid_height_bottom, - ], - [ - -branch_thickness, - -branch_thickness, - ctps_mid_height_bottom, - ], - [ - branch_thickness, - -branch_thickness, - ctps_mid_height_bottom, - ], - [-r_center, -0.5, inv_filling_height], - [r_center, -0.5, inv_filling_height], - [-r_center, -half_r_center, inv_filling_height], - [r_center, -half_r_center, inv_filling_height], - [-r_center, -r_center, inv_filling_height], - [r_center, -r_center, inv_filling_height], - ] - ) + _np.array([0.5, 0.5, 0.0]) - - spline_list.append( - _Bezier( - degrees=[1, 2, 2], - control_points=branch_neighbor_y_min_ctps, + [-aux_column_width, -v_one_half, v_zero], + [aux_column_width, -v_one_half, v_zero], + [-aux_column_width, -sep_distance_aux, v_zero], + [aux_column_width, -sep_distance_aux, v_zero], + [-branch_thickness, -branch_thickness, v_zero], + [branch_thickness, -branch_thickness, v_zero], + [ + -aux_column_width, + -v_one_half, + ctps_mid_height_bottom, + ], + [ + aux_column_width, + -v_one_half, + ctps_mid_height_bottom, + ], + [ + -aux_column_width, + -sep_distance_aux, + ctps_mid_height_bottom, + ], + [ + aux_column_width, + -sep_distance_aux, + ctps_mid_height_bottom, + ], + [ + -branch_thickness, + -branch_thickness, + ctps_mid_height_bottom, + ], + [ + branch_thickness, + -branch_thickness, + ctps_mid_height_bottom, + ], + [-r_center, -v_one_half, inv_filling_height], + [r_center, -v_one_half, inv_filling_height], + [-r_center, -half_r_center, inv_filling_height], + [r_center, -half_r_center, inv_filling_height], + [-r_center, -r_center, inv_filling_height], + [r_center, -r_center, inv_filling_height], + ] + ) + _np.array([v_one_half, v_one_half, v_zero]) + + spline_list.append( + _Bezier( + degrees=[1, 2, 2], + control_points=branch_neighbor_y_min_ctps, + ) ) - ) - branch_neighbor_y_max_ctps = _np.array( - [ - [-branch_thickness, branch_thickness, 0.0], - [branch_thickness, branch_thickness, 0.0], - [-aux_column_width, seperator_distance, 0.0], - [aux_column_width, seperator_distance, 0.0], - [-aux_column_width, 0.5, 0.0], - [aux_column_width, 0.5, 0.0], + branch_neighbor_y_max_ctps = _np.array( [ - -branch_thickness, - branch_thickness, - ctps_mid_height_bottom, - ], - [ - branch_thickness, - branch_thickness, - ctps_mid_height_bottom, - ], - [ - -aux_column_width, - seperator_distance, - ctps_mid_height_bottom, - ], - [ - aux_column_width, - seperator_distance, - ctps_mid_height_bottom, - ], - [-aux_column_width, 0.5, ctps_mid_height_bottom], - [aux_column_width, 0.5, ctps_mid_height_bottom], - [-r_center, r_center, inv_filling_height], - [r_center, r_center, inv_filling_height], - [-r_center, half_r_center, inv_filling_height], - [r_center, half_r_center, inv_filling_height], - [-r_center, 0.5, inv_filling_height], - [r_center, 0.5, inv_filling_height], - ] - ) + _np.array([0.5, 0.5, 0.0]) - - spline_list.append( - _Bezier( - degrees=[1, 2, 2], - control_points=branch_neighbor_y_max_ctps, + [-branch_thickness, branch_thickness, v_zero], + [branch_thickness, branch_thickness, v_zero], + [-aux_column_width, sep_distance_aux, v_zero], + [aux_column_width, sep_distance_aux, v_zero], + [-aux_column_width, v_one_half, v_zero], + [aux_column_width, v_one_half, v_zero], + [ + -branch_thickness, + branch_thickness, + ctps_mid_height_bottom, + ], + [ + branch_thickness, + branch_thickness, + ctps_mid_height_bottom, + ], + [ + -aux_column_width, + sep_distance_aux, + ctps_mid_height_bottom, + ], + [ + aux_column_width, + sep_distance_aux, + ctps_mid_height_bottom, + ], + [ + -aux_column_width, + v_one_half, + ctps_mid_height_bottom, + ], + [aux_column_width, v_one_half, ctps_mid_height_bottom], + [-r_center, r_center, inv_filling_height], + [r_center, r_center, inv_filling_height], + [-r_center, half_r_center, inv_filling_height], + [r_center, half_r_center, inv_filling_height], + [-r_center, v_one_half, inv_filling_height], + [r_center, v_one_half, inv_filling_height], + ] + ) + _np.array([v_one_half, v_one_half, v_zero]) + + spline_list.append( + _Bezier( + degrees=[1, 2, 2], + control_points=branch_neighbor_y_max_ctps, + ) ) - ) - branch_x_min_y_min_ctps = _np.array( - [ - [-0.5, -0.5, 0.0], - [-seperator_distance, -0.5, 0.0], - [-aux_column_width, -0.5, 0.0], - [-0.5, -seperator_distance, 0.0], - [-seperator_distance, -seperator_distance, 0.0], - [-aux_column_width, -seperator_distance, 0.0], - [-0.5, -aux_column_width, 0.0], - [-seperator_distance, -aux_column_width, 0.0], - [-branch_thickness, -branch_thickness, 0.0], - [-0.5, -0.5, ctps_mid_height_bottom], - [-seperator_distance, -0.5, ctps_mid_height_bottom], - [-aux_column_width, -0.5, ctps_mid_height_bottom], - [-0.5, -seperator_distance, ctps_mid_height_bottom], - [ - -seperator_distance, - -seperator_distance, - ctps_mid_height_bottom, - ], - [ - -aux_column_width, - -seperator_distance, - ctps_mid_height_bottom, - ], - [-0.5, -aux_column_width, ctps_mid_height_bottom], - [ - -seperator_distance, - -aux_column_width, - ctps_mid_height_bottom, - ], + branch_x_min_y_min_ctps = _np.array( [ - -branch_thickness, - -branch_thickness, - ctps_mid_height_bottom, - ], - [-0.5, -0.5, inv_filling_height], - [-half_r_center, -0.5, inv_filling_height], - [-r_center, -0.5, inv_filling_height], - [-0.5, -half_r_center, inv_filling_height], - [-half_r_center, -half_r_center, inv_filling_height], - [-r_center, -half_r_center, inv_filling_height], - [-0.5, -r_center, inv_filling_height], - [-half_r_center, -r_center, inv_filling_height], - [-r_center, -r_center, inv_filling_height], - ] - ) + _np.array([0.5, 0.5, 0.0]) - - spline_list.append( - _Bezier( - degrees=[2, 2, 2], control_points=branch_x_min_y_min_ctps + [-v_one_half, -v_one_half, v_zero], + [-sep_distance_aux, -v_one_half, v_zero], + [-aux_column_width, -v_one_half, v_zero], + [-v_one_half, -sep_distance_aux, v_zero], + [-sep_distance_aux, -sep_distance_aux, v_zero], + [-aux_column_width, -sep_distance_aux, v_zero], + [-v_one_half, -aux_column_width, v_zero], + [-sep_distance_aux, -aux_column_width, v_zero], + [-branch_thickness, -branch_thickness, v_zero], + [-v_one_half, -v_one_half, ctps_mid_height_bottom], + [ + -sep_distance_aux, + -v_one_half, + ctps_mid_height_bottom, + ], + [ + -aux_column_width, + -v_one_half, + ctps_mid_height_bottom, + ], + [ + -v_one_half, + -sep_distance_aux, + ctps_mid_height_bottom, + ], + [ + -sep_distance_aux, + -sep_distance_aux, + ctps_mid_height_bottom, + ], + [ + -aux_column_width, + -sep_distance_aux, + ctps_mid_height_bottom, + ], + [ + -v_one_half, + -aux_column_width, + ctps_mid_height_bottom, + ], + [ + -sep_distance_aux, + -aux_column_width, + ctps_mid_height_bottom, + ], + [ + -branch_thickness, + -branch_thickness, + ctps_mid_height_bottom, + ], + [-v_one_half, -v_one_half, inv_filling_height], + [-half_r_center, -v_one_half, inv_filling_height], + [-r_center, -v_one_half, inv_filling_height], + [-v_one_half, -half_r_center, inv_filling_height], + [-half_r_center, -half_r_center, inv_filling_height], + [-r_center, -half_r_center, inv_filling_height], + [-v_one_half, -r_center, inv_filling_height], + [-half_r_center, -r_center, inv_filling_height], + [-r_center, -r_center, inv_filling_height], + ] + ) + _np.array([v_one_half, v_one_half, v_zero]) + + spline_list.append( + _Bezier( + degrees=[2, 2, 2], + control_points=branch_x_min_y_min_ctps, + ) ) - ) - branch_x_max_y_max_ctps = _np.array( - [ - [branch_thickness, branch_thickness, 0.0], - [seperator_distance, aux_column_width, 0.0], - [0.5, aux_column_width, 0.0], - [aux_column_width, seperator_distance, 0.0], - [seperator_distance, seperator_distance, 0.0], - [0.5, seperator_distance, 0.0], - [aux_column_width, 0.5, 0.0], - [seperator_distance, 0.5, 0.0], - [0.5, 0.5, 0.0], - [ - branch_thickness, - branch_thickness, - ctps_mid_height_bottom, - ], - [ - seperator_distance, - aux_column_width, - ctps_mid_height_bottom, - ], - [0.5, aux_column_width, ctps_mid_height_bottom], + branch_x_max_y_max_ctps = _np.array( [ - aux_column_width, - seperator_distance, - ctps_mid_height_bottom, - ], - [ - seperator_distance, - seperator_distance, - ctps_mid_height_bottom, - ], - [0.5, seperator_distance, ctps_mid_height_bottom], - [aux_column_width, 0.5, ctps_mid_height_bottom], - [seperator_distance, 0.5, ctps_mid_height_bottom], - [0.5, 0.5, ctps_mid_height_bottom], - [r_center, r_center, inv_filling_height], - [half_r_center, r_center, inv_filling_height], - [0.5, r_center, inv_filling_height], - [r_center, half_r_center, inv_filling_height], - [half_r_center, half_r_center, inv_filling_height], - [0.5, half_r_center, inv_filling_height], - [r_center, 0.5, inv_filling_height], - [half_r_center, 0.5, inv_filling_height], - [0.5, 0.5, inv_filling_height], - ] - ) + _np.array([0.5, 0.5, 0.0]) - - spline_list.append( - _Bezier( - degrees=[2, 2, 2], control_points=branch_x_max_y_max_ctps + [branch_thickness, branch_thickness, v_zero], + [sep_distance_aux, aux_column_width, v_zero], + [v_one_half, aux_column_width, v_zero], + [aux_column_width, sep_distance_aux, v_zero], + [sep_distance_aux, sep_distance_aux, v_zero], + [v_one_half, sep_distance_aux, v_zero], + [aux_column_width, v_one_half, v_zero], + [sep_distance_aux, v_one_half, v_zero], + [v_one_half, v_one_half, v_zero], + [ + branch_thickness, + branch_thickness, + ctps_mid_height_bottom, + ], + [ + sep_distance_aux, + aux_column_width, + ctps_mid_height_bottom, + ], + [v_one_half, aux_column_width, ctps_mid_height_bottom], + [ + aux_column_width, + sep_distance_aux, + ctps_mid_height_bottom, + ], + [ + sep_distance_aux, + sep_distance_aux, + ctps_mid_height_bottom, + ], + [v_one_half, sep_distance_aux, ctps_mid_height_bottom], + [aux_column_width, v_one_half, ctps_mid_height_bottom], + [sep_distance_aux, v_one_half, ctps_mid_height_bottom], + [v_one_half, v_one_half, ctps_mid_height_bottom], + [r_center, r_center, inv_filling_height], + [half_r_center, r_center, inv_filling_height], + [v_one_half, r_center, inv_filling_height], + [r_center, half_r_center, inv_filling_height], + [half_r_center, half_r_center, inv_filling_height], + [v_one_half, half_r_center, inv_filling_height], + [r_center, v_one_half, inv_filling_height], + [half_r_center, v_one_half, inv_filling_height], + [v_one_half, v_one_half, inv_filling_height], + ] + ) + _np.array([v_one_half, v_one_half, v_zero]) + + spline_list.append( + _Bezier( + degrees=[2, 2, 2], + control_points=branch_x_max_y_max_ctps, + ) ) - ) - branch_x_max_y_min_ctps = _np.array( - [ - [aux_column_width, -0.5, 0.0], - [seperator_distance, -0.5, 0.0], - [0.5, -0.5, 0.0], - [aux_column_width, -seperator_distance, 0.0], - [seperator_distance, -seperator_distance, 0.0], - [0.5, -seperator_distance, 0.0], - [branch_thickness, -branch_thickness, 0.0], - [seperator_distance, -aux_column_width, 0.0], - [0.5, -aux_column_width, 0.0], - [aux_column_width, -0.5, ctps_mid_height_bottom], - [seperator_distance, -0.5, ctps_mid_height_bottom], - [0.5, -0.5, ctps_mid_height_bottom], - [ - aux_column_width, - -seperator_distance, - ctps_mid_height_bottom, - ], + branch_x_max_y_min_ctps = _np.array( [ - seperator_distance, - -seperator_distance, - ctps_mid_height_bottom, - ], - [0.5, -seperator_distance, ctps_mid_height_bottom], - [ - branch_thickness, - -branch_thickness, - ctps_mid_height_bottom, - ], - [ - seperator_distance, - -aux_column_width, - ctps_mid_height_bottom, - ], - [0.5, -aux_column_width, ctps_mid_height_bottom], - [r_center, -0.5, inv_filling_height], - [half_r_center, -0.5, inv_filling_height], - [0.5, -0.5, inv_filling_height], - [r_center, -half_r_center, inv_filling_height], - [half_r_center, -half_r_center, inv_filling_height], - [0.5, -half_r_center, inv_filling_height], - [r_center, -r_center, inv_filling_height], - [half_r_center, -r_center, inv_filling_height], - [0.5, -r_center, inv_filling_height], - ] - ) + _np.array([0.5, 0.5, 0.0]) - - spline_list.append( - _Bezier( - degrees=[2, 2, 2], control_points=branch_x_max_y_min_ctps + [aux_column_width, -v_one_half, v_zero], + [sep_distance_aux, -v_one_half, v_zero], + [v_one_half, -v_one_half, v_zero], + [aux_column_width, -sep_distance_aux, v_zero], + [sep_distance_aux, -sep_distance_aux, v_zero], + [v_one_half, -sep_distance_aux, v_zero], + [branch_thickness, -branch_thickness, v_zero], + [sep_distance_aux, -aux_column_width, v_zero], + [v_one_half, -aux_column_width, v_zero], + [ + aux_column_width, + -v_one_half, + ctps_mid_height_bottom, + ], + [ + sep_distance_aux, + -v_one_half, + ctps_mid_height_bottom, + ], + [v_one_half, -v_one_half, ctps_mid_height_bottom], + [ + aux_column_width, + -sep_distance_aux, + ctps_mid_height_bottom, + ], + [ + sep_distance_aux, + -sep_distance_aux, + ctps_mid_height_bottom, + ], + [ + v_one_half, + -sep_distance_aux, + ctps_mid_height_bottom, + ], + [ + branch_thickness, + -branch_thickness, + ctps_mid_height_bottom, + ], + [ + sep_distance_aux, + -aux_column_width, + ctps_mid_height_bottom, + ], + [ + v_one_half, + -aux_column_width, + ctps_mid_height_bottom, + ], + [r_center, -v_one_half, inv_filling_height], + [half_r_center, -v_one_half, inv_filling_height], + [v_one_half, -v_one_half, inv_filling_height], + [r_center, -half_r_center, inv_filling_height], + [half_r_center, -half_r_center, inv_filling_height], + [v_one_half, -half_r_center, inv_filling_height], + [r_center, -r_center, inv_filling_height], + [half_r_center, -r_center, inv_filling_height], + [v_one_half, -r_center, inv_filling_height], + ] + ) + _np.array([v_one_half, v_one_half, v_zero]) + + spline_list.append( + _Bezier( + degrees=[2, 2, 2], + control_points=branch_x_max_y_min_ctps, + ) ) - ) - branch_x_min_y_max_ctps = _np.array( - [ - [-0.5, aux_column_width, 0.0], - [-seperator_distance, aux_column_width, 0.0], - [-branch_thickness, branch_thickness, 0.0], - [-0.5, seperator_distance, 0.0], - [-seperator_distance, seperator_distance, 0.0], - [-aux_column_width, seperator_distance, 0.0], - [-0.5, 0.5, 0.0], - [-seperator_distance, 0.5, 0.0], - [-aux_column_width, 0.5, 0.0], - [-0.5, aux_column_width, ctps_mid_height_bottom], - [ - -seperator_distance, - aux_column_width, - ctps_mid_height_bottom, - ], + branch_x_min_y_max_ctps = _np.array( [ - -branch_thickness, - branch_thickness, - ctps_mid_height_bottom, - ], - [-0.5, seperator_distance, ctps_mid_height_bottom], - [ - -seperator_distance, - seperator_distance, - ctps_mid_height_bottom, - ], - [ - -aux_column_width, - seperator_distance, - ctps_mid_height_bottom, - ], - [-0.5, 0.5, ctps_mid_height_bottom], - [-seperator_distance, 0.5, ctps_mid_height_bottom], - [-aux_column_width, 0.5, ctps_mid_height_bottom], - [-0.5, r_center, inv_filling_height], - [-half_r_center, r_center, inv_filling_height], - [-r_center, r_center, inv_filling_height], - [-0.5, half_r_center, inv_filling_height], - [-half_r_center, half_r_center, inv_filling_height], - [-r_center, half_r_center, inv_filling_height], - [-0.5, 0.5, inv_filling_height], - [-half_r_center, 0.5, inv_filling_height], - [-r_center, 0.5, inv_filling_height], - ] - ) + _np.array([0.5, 0.5, 0.0]) - - spline_list.append( - _Bezier( - degrees=[2, 2, 2], control_points=branch_x_min_y_max_ctps + [-v_one_half, aux_column_width, v_zero], + [-sep_distance_aux, aux_column_width, v_zero], + [-branch_thickness, branch_thickness, v_zero], + [-v_one_half, sep_distance_aux, v_zero], + [-sep_distance_aux, sep_distance_aux, v_zero], + [-aux_column_width, sep_distance_aux, v_zero], + [-v_one_half, v_one_half, v_zero], + [-sep_distance_aux, v_one_half, v_zero], + [-aux_column_width, v_one_half, v_zero], + [ + -v_one_half, + aux_column_width, + ctps_mid_height_bottom, + ], + [ + -sep_distance_aux, + aux_column_width, + ctps_mid_height_bottom, + ], + [ + -branch_thickness, + branch_thickness, + ctps_mid_height_bottom, + ], + [ + -v_one_half, + sep_distance_aux, + ctps_mid_height_bottom, + ], + [ + -sep_distance_aux, + sep_distance_aux, + ctps_mid_height_bottom, + ], + [ + -aux_column_width, + sep_distance_aux, + ctps_mid_height_bottom, + ], + [-v_one_half, v_one_half, ctps_mid_height_bottom], + [ + -sep_distance_aux, + v_one_half, + ctps_mid_height_bottom, + ], + [ + -aux_column_width, + v_one_half, + ctps_mid_height_bottom, + ], + [-v_one_half, r_center, inv_filling_height], + [-half_r_center, r_center, inv_filling_height], + [-r_center, r_center, inv_filling_height], + [-v_one_half, half_r_center, inv_filling_height], + [-half_r_center, half_r_center, inv_filling_height], + [-r_center, half_r_center, inv_filling_height], + [-v_one_half, v_one_half, inv_filling_height], + [-half_r_center, v_one_half, inv_filling_height], + [-r_center, v_one_half, inv_filling_height], + ] + ) + _np.array([v_one_half, v_one_half, v_zero]) + + spline_list.append( + _Bezier( + degrees=[2, 2, 2], + control_points=branch_x_min_y_max_ctps, + ) ) - ) + else: + raise ValueError("Corner Type not supported") + + if i_derivative == 0: + splines = spline_list.copy() + else: + derivatives.append(spline_list) - return (spline_list, None) - else: - raise ValueError("Corner Type not supported") + return (splines, derivatives) def create_tile( self, parameters=None, parameter_sensitivities=None, - seperator_distance=None, + separator_distance=0.3, center_expansion=1.0, closure=None, **kwargs, # noqa ARG002 @@ -905,9 +1039,9 @@ def create_tile( parameters : np.array only first entry is used, defines the internal radii of the branches - seperator_distance : float + separator_distance : float Control point distance to separation layer of biquadratic degrees, - determines the minimum branch thickness (defaults to 0.4) + determines the minimum branch thickness (defaults to 0.3) center_expansion : float thickness of center is expanded by a factor (default to 1.0), which determines the maximum branch thickness @@ -920,46 +1054,25 @@ def create_tile( microtile_list : list(splines) """ - if not isinstance(center_expansion, float): - raise ValueError("Invalid Type") - - if not ((center_expansion > 0.5) and (center_expansion < 1.5)): - raise ValueError("Center Expansion must be in (.5, 1.5)") - - # Set default values - if seperator_distance is None: - seperator_distance = 0.3 - - if center_expansion is None: - center_expansion = 1.0 + self._check_custom_parameter( + center_expansion, "center expansion", self._CENTER_EXPANSION_BOUNDS + ) # Check if all radii are in allowed range max_radius = min(0.5, (0.5 / center_expansion)) - max_radius = min(max_radius, seperator_distance) - min_radius = max(0.5 - seperator_distance, 0) - - # set to default if nothing is given - if parameters is None: - self._logd("Setting branch thickness to default 0.2") - parameters = ( - _np.ones( - (len(self._evaluation_points), self._n_info_per_eval_point) - ) - * 0.2 - ) - - if parameter_sensitivities is not None: - raise NotImplementedError( - "Derivatives are not implemented for this tile yet" - ) + max_radius = min(max_radius, separator_distance) + min_radius = max(0.5 - separator_distance, 0) - self.check_params(parameters) + parameters, n_derivatives, derivatives = self._process_input( + parameters=parameters, + parameter_sensitivities=parameter_sensitivities, + ) if _np.any(parameters < min_radius) or _np.any( parameters > max_radius ): raise ValueError( - f"Radii must be in (0,{max_radius}) for " + f"Radii must be in ({min_radius},{max_radius}) for " f"center_expansion {center_expansion}" ) @@ -967,649 +1080,715 @@ def create_tile( return self._closing_tile( parameters=parameters, parameter_sensitivities=parameter_sensitivities, - seperator_distance=seperator_distance, + separator_distance=separator_distance, closure=closure, **kwargs, ) - [ - x_min_r, - x_max_r, - y_min_r, - y_max_r, - z_min_r, - z_max_r, - ] = parameters.flatten() - - # center radius - center_r = _np.sum(parameters) / 6.0 * center_expansion - - # Auxiliary values for smooothing (mid-branch thickness) - [ - aux_x_min, - aux_x_max, - aux_y_min, - aux_y_max, - aux_z_min, - aux_z_max, - ] = _np.minimum(parameters.ravel(), center_r) - # Branch midlength - hd_center = 0.5 * (0.5 + center_r) - aux_column_width = 0.5 - 2 * (0.5 - seperator_distance) - - # Init return type - spline_list = [] - - # Start with branch interconnections - x_min_y_min = _np.array( - [ - [-0.5, -0.5, -aux_column_width], - [-seperator_distance, -0.5, -aux_column_width], - [-y_min_r, -0.5, -y_min_r], - [-0.5, -seperator_distance, -aux_column_width], - [-hd_center, -hd_center, -aux_column_width], - [-aux_y_min, -hd_center, -aux_y_min], - [-0.5, -x_min_r, -x_min_r], - [-hd_center, -aux_x_min, -aux_x_min], - [-center_r, -center_r, -center_r], - [-0.5, -0.5, aux_column_width], - [-seperator_distance, -0.5, aux_column_width], - [-y_min_r, -0.5, y_min_r], - [-0.5, -seperator_distance, aux_column_width], - [-hd_center, -hd_center, aux_column_width], - [-aux_y_min, -hd_center, aux_y_min], - [-0.5, -x_min_r, x_min_r], - [-hd_center, -aux_x_min, aux_x_min], - [-center_r, -center_r, center_r], - ] - ) + _np.array([0.5, 0.5, 0.5]) - - spline_list.append( - _Bezier(degrees=[2, 2, 1], control_points=x_min_y_min) - ) + splines = [] + for i_derivative in range(n_derivatives + 1): + if i_derivative == 0: + [ + x_min_r, + x_max_r, + y_min_r, + y_max_r, + z_min_r, + z_max_r, + ] = parameters.flatten() + + # center radius + center_r = _np.sum(parameters) / 6.0 * center_expansion + + # Auxiliary values for smooothing (mid-branch thickness) + [ + aux_x_min, + aux_x_max, + aux_y_min, + aux_y_max, + aux_z_min, + aux_z_max, + ] = _np.minimum(parameters.ravel(), center_r) + # Branch midlength + hd_center = 0.5 * (0.5 + center_r) + aux_column_width = 0.5 - 2 * (0.5 - separator_distance) + + v_one_half = 0.5 + center_point = _np.array([0.5, 0.5, 0.5]) + + sep_distance = separator_distance + else: + sensitivities_i = parameter_sensitivities[ + :, 0, i_derivative - 1 + ] + [ + x_min_r, + x_max_r, + y_min_r, + y_max_r, + z_min_r, + z_max_r, + ] = sensitivities_i + + center_r = _np.mean(sensitivities_i) * center_expansion + [ + aux_x_min, + aux_x_max, + aux_y_min, + aux_y_max, + aux_z_min, + aux_z_max, + ] = _np.where( + parameters.ravel() + < _np.mean(parameters.ravel()) * center_expansion, + sensitivities_i, + center_r, + ) + # Branch midlength + hd_center = center_r / 2.0 + aux_column_width = 0.0 + v_one_half = 0.0 + center_point = _np.zeros(3) - x_max_y_min = _np.array( - [ - [y_min_r, -0.5, -y_min_r], - [seperator_distance, -0.5, -aux_column_width], - [0.5, -0.5, -aux_column_width], - [aux_y_min, -hd_center, -aux_y_min], - [hd_center, -hd_center, -aux_column_width], - [0.5, -seperator_distance, -aux_column_width], - [center_r, -center_r, -center_r], - [hd_center, -aux_x_max, -aux_x_max], - [0.5, -x_max_r, -x_max_r], - [y_min_r, -0.5, y_min_r], - [seperator_distance, -0.5, aux_column_width], - [0.5, -0.5, aux_column_width], - [aux_y_min, -hd_center, aux_y_min], - [hd_center, -hd_center, aux_column_width], - [0.5, -seperator_distance, aux_column_width], - [center_r, -center_r, center_r], - [hd_center, -aux_x_max, aux_x_max], - [0.5, -x_max_r, x_max_r], - ] - ) + _np.array([0.5, 0.5, 0.5]) - - spline_list.append( - _Bezier(degrees=[2, 2, 1], control_points=x_max_y_min) - ) + sep_distance = 0.0 - x_min_y_max = _np.array( - [ - [-0.5, x_min_r, -x_min_r], - [-hd_center, aux_x_min, -aux_x_min], - [-center_r, center_r, -center_r], - [-0.5, seperator_distance, -aux_column_width], - [-hd_center, hd_center, -aux_column_width], - [-aux_y_max, hd_center, -aux_y_max], - [-0.5, 0.5, -aux_column_width], - [-seperator_distance, 0.5, -aux_column_width], - [-y_max_r, 0.5, -y_max_r], - [-0.5, x_min_r, x_min_r], - [-hd_center, aux_x_min, aux_x_min], - [-center_r, center_r, center_r], - [-0.5, seperator_distance, aux_column_width], - [-hd_center, hd_center, aux_column_width], - [-aux_y_max, hd_center, aux_y_max], - [-0.5, 0.5, aux_column_width], - [-seperator_distance, 0.5, aux_column_width], - [-y_max_r, 0.5, y_max_r], - ] - ) + _np.array([0.5, 0.5, 0.5]) - - spline_list.append( - _Bezier(degrees=[2, 2, 1], control_points=x_min_y_max) - ) + # Init return type + spline_list = [] - x_max_y_max = _np.array( - [ - [center_r, center_r, -center_r], - [hd_center, aux_x_max, -aux_x_max], - [0.5, x_max_r, -x_max_r], - [aux_y_max, hd_center, -aux_y_max], - [hd_center, hd_center, -aux_column_width], - [0.5, seperator_distance, -aux_column_width], - [y_max_r, 0.5, -y_max_r], - [seperator_distance, 0.5, -aux_column_width], - [0.5, 0.5, -aux_column_width], - [center_r, center_r, center_r], - [hd_center, aux_x_max, aux_x_max], - [0.5, x_max_r, x_max_r], - [aux_y_max, hd_center, aux_y_max], - [hd_center, hd_center, aux_column_width], - [0.5, seperator_distance, aux_column_width], - [y_max_r, 0.5, y_max_r], - [seperator_distance, 0.5, aux_column_width], - [0.5, 0.5, aux_column_width], - ] - ) + _np.array([0.5, 0.5, 0.5]) - - spline_list.append( - _Bezier(degrees=[2, 2, 1], control_points=x_max_y_max) - ) + # Start with branch interconnections + x_min_y_min = ( + _np.array( + [ + [-v_one_half, -v_one_half, -aux_column_width], + [-sep_distance, -v_one_half, -aux_column_width], + [-y_min_r, -v_one_half, -y_min_r], + [-v_one_half, -sep_distance, -aux_column_width], + [-hd_center, -hd_center, -aux_column_width], + [-aux_y_min, -hd_center, -aux_y_min], + [-v_one_half, -x_min_r, -x_min_r], + [-hd_center, -aux_x_min, -aux_x_min], + [-center_r, -center_r, -center_r], + [-v_one_half, -v_one_half, aux_column_width], + [-sep_distance, -v_one_half, aux_column_width], + [-y_min_r, -v_one_half, y_min_r], + [-v_one_half, -sep_distance, aux_column_width], + [-hd_center, -hd_center, aux_column_width], + [-aux_y_min, -hd_center, aux_y_min], + [-v_one_half, -x_min_r, x_min_r], + [-hd_center, -aux_x_min, aux_x_min], + [-center_r, -center_r, center_r], + ] + ) + + center_point + ) - x_min_z_min = _np.array( - [ - [-0.5, -aux_column_width, -0.5], - [-seperator_distance, -aux_column_width, -0.5], - [-z_min_r, -z_min_r, -0.5], - [-0.5, aux_column_width, -0.5], - [-seperator_distance, aux_column_width, -0.5], - [-z_min_r, z_min_r, -0.5], - [-0.5, -aux_column_width, -seperator_distance], - [-hd_center, -aux_column_width, -hd_center], - [-aux_z_min, -aux_z_min, -hd_center], - [-0.5, aux_column_width, -seperator_distance], - [-hd_center, aux_column_width, -hd_center], - [-aux_z_min, aux_z_min, -hd_center], - [-0.5, -x_min_r, -x_min_r], - [-hd_center, -aux_x_min, -aux_x_min], - [-center_r, -center_r, -center_r], - [-0.5, x_min_r, -x_min_r], - [-hd_center, aux_x_min, -aux_x_min], - [-center_r, center_r, -center_r], - ] - ) + _np.array([0.5, 0.5, 0.5]) - - spline_list.append( - _Bezier(degrees=[2, 1, 2], control_points=x_min_z_min) - ) + x_max_y_min = ( + _np.array( + [ + [y_min_r, -v_one_half, -y_min_r], + [sep_distance, -v_one_half, -aux_column_width], + [v_one_half, -v_one_half, -aux_column_width], + [aux_y_min, -hd_center, -aux_y_min], + [hd_center, -hd_center, -aux_column_width], + [v_one_half, -sep_distance, -aux_column_width], + [center_r, -center_r, -center_r], + [hd_center, -aux_x_max, -aux_x_max], + [v_one_half, -x_max_r, -x_max_r], + [y_min_r, -v_one_half, y_min_r], + [sep_distance, -v_one_half, aux_column_width], + [v_one_half, -v_one_half, aux_column_width], + [aux_y_min, -hd_center, aux_y_min], + [hd_center, -hd_center, aux_column_width], + [v_one_half, -sep_distance, aux_column_width], + [center_r, -center_r, center_r], + [hd_center, -aux_x_max, aux_x_max], + [v_one_half, -x_max_r, x_max_r], + ] + ) + + center_point + ) - x_max_z_min = _np.array( - [ - [z_min_r, -z_min_r, -0.5], - [seperator_distance, -aux_column_width, -0.5], - [0.5, -aux_column_width, -0.5], - [z_min_r, z_min_r, -0.5], - [seperator_distance, aux_column_width, -0.5], - [0.5, aux_column_width, -0.5], - [aux_z_min, -aux_z_min, -hd_center], - [hd_center, -aux_column_width, -hd_center], - [0.5, -aux_column_width, -seperator_distance], - [aux_z_min, aux_z_min, -hd_center], - [hd_center, aux_column_width, -hd_center], - [0.5, aux_column_width, -seperator_distance], - [center_r, -center_r, -center_r], - [hd_center, -aux_x_max, -aux_x_max], - [0.5, -x_max_r, -x_max_r], - [center_r, center_r, -center_r], - [hd_center, aux_x_max, -aux_x_max], - [0.5, x_max_r, -x_max_r], - ] - ) + _np.array([0.5, 0.5, 0.5]) - - spline_list.append( - _Bezier(degrees=[2, 1, 2], control_points=x_max_z_min) - ) + x_min_y_max = ( + _np.array( + [ + [-v_one_half, x_min_r, -x_min_r], + [-hd_center, aux_x_min, -aux_x_min], + [-center_r, center_r, -center_r], + [-v_one_half, sep_distance, -aux_column_width], + [-hd_center, hd_center, -aux_column_width], + [-aux_y_max, hd_center, -aux_y_max], + [-v_one_half, v_one_half, -aux_column_width], + [-sep_distance, v_one_half, -aux_column_width], + [-y_max_r, v_one_half, -y_max_r], + [-v_one_half, x_min_r, x_min_r], + [-hd_center, aux_x_min, aux_x_min], + [-center_r, center_r, center_r], + [-v_one_half, sep_distance, aux_column_width], + [-hd_center, hd_center, aux_column_width], + [-aux_y_max, hd_center, aux_y_max], + [-v_one_half, v_one_half, aux_column_width], + [-sep_distance, v_one_half, aux_column_width], + [-y_max_r, v_one_half, y_max_r], + ] + ) + + center_point + ) - x_min_z_max = _np.array( - [ - [-0.5, -x_min_r, x_min_r], - [-hd_center, -aux_x_min, aux_x_min], - [-center_r, -center_r, center_r], - [-0.5, x_min_r, x_min_r], - [-hd_center, aux_x_min, aux_x_min], - [-center_r, center_r, center_r], - [-0.5, -aux_column_width, seperator_distance], - [-hd_center, -aux_column_width, hd_center], - [-aux_z_max, -aux_z_max, hd_center], - [-0.5, aux_column_width, seperator_distance], - [-hd_center, aux_column_width, hd_center], - [-aux_z_max, aux_z_max, hd_center], - [-0.5, -aux_column_width, 0.5], - [-seperator_distance, -aux_column_width, 0.5], - [-z_max_r, -z_max_r, 0.5], - [-0.5, aux_column_width, 0.5], - [-seperator_distance, aux_column_width, 0.5], - [-z_max_r, z_max_r, 0.5], - ] - ) + _np.array([0.5, 0.5, 0.5]) - - spline_list.append( - _Bezier(degrees=[2, 1, 2], control_points=x_min_z_max) - ) + x_max_y_max = ( + _np.array( + [ + [center_r, center_r, -center_r], + [hd_center, aux_x_max, -aux_x_max], + [v_one_half, x_max_r, -x_max_r], + [aux_y_max, hd_center, -aux_y_max], + [hd_center, hd_center, -aux_column_width], + [v_one_half, sep_distance, -aux_column_width], + [y_max_r, v_one_half, -y_max_r], + [sep_distance, v_one_half, -aux_column_width], + [v_one_half, v_one_half, -aux_column_width], + [center_r, center_r, center_r], + [hd_center, aux_x_max, aux_x_max], + [v_one_half, x_max_r, x_max_r], + [aux_y_max, hd_center, aux_y_max], + [hd_center, hd_center, aux_column_width], + [v_one_half, sep_distance, aux_column_width], + [y_max_r, v_one_half, y_max_r], + [sep_distance, v_one_half, aux_column_width], + [v_one_half, v_one_half, aux_column_width], + ] + ) + + center_point + ) - x_max_z_max = _np.array( - [ - [center_r, -center_r, center_r], - [hd_center, -aux_x_max, aux_x_max], - [0.5, -x_max_r, x_max_r], - [center_r, center_r, center_r], - [hd_center, aux_x_max, aux_x_max], - [0.5, x_max_r, x_max_r], - [aux_z_max, -aux_z_max, hd_center], - [hd_center, -aux_column_width, hd_center], - [0.5, -aux_column_width, seperator_distance], - [aux_z_max, aux_z_max, hd_center], - [hd_center, aux_column_width, hd_center], - [0.5, aux_column_width, seperator_distance], - [z_max_r, -z_max_r, 0.5], - [seperator_distance, -aux_column_width, 0.5], - [0.5, -aux_column_width, 0.5], - [z_max_r, z_max_r, 0.5], - [seperator_distance, aux_column_width, 0.5], - [0.5, aux_column_width, 0.5], - ] - ) + _np.array([0.5, 0.5, 0.5]) - - spline_list.append( - _Bezier(degrees=[2, 1, 2], control_points=x_max_z_max) - ) + x_min_z_min = ( + _np.array( + [ + [-v_one_half, -aux_column_width, -v_one_half], + [-sep_distance, -aux_column_width, -v_one_half], + [-z_min_r, -z_min_r, -v_one_half], + [-v_one_half, aux_column_width, -v_one_half], + [-sep_distance, aux_column_width, -v_one_half], + [-z_min_r, z_min_r, -v_one_half], + [-v_one_half, -aux_column_width, -sep_distance], + [-hd_center, -aux_column_width, -hd_center], + [-aux_z_min, -aux_z_min, -hd_center], + [-v_one_half, aux_column_width, -sep_distance], + [-hd_center, aux_column_width, -hd_center], + [-aux_z_min, aux_z_min, -hd_center], + [-v_one_half, -x_min_r, -x_min_r], + [-hd_center, -aux_x_min, -aux_x_min], + [-center_r, -center_r, -center_r], + [-v_one_half, x_min_r, -x_min_r], + [-hd_center, aux_x_min, -aux_x_min], + [-center_r, center_r, -center_r], + ] + ) + + center_point + ) - y_min_z_min = _np.array( - [ - [-aux_column_width, -0.5, -0.5], - [aux_column_width, -0.5, -0.5], - [-aux_column_width, -seperator_distance, -0.5], - [aux_column_width, -seperator_distance, -0.5], - [-z_min_r, -z_min_r, -0.5], - [z_min_r, -z_min_r, -0.5], - [-aux_column_width, -0.5, -seperator_distance], - [aux_column_width, -0.5, -seperator_distance], - [-aux_column_width, -hd_center, -hd_center], - [aux_column_width, -hd_center, -hd_center], - [-aux_z_min, -aux_z_min, -hd_center], - [aux_z_min, -aux_z_min, -hd_center], - [-y_min_r, -0.5, -y_min_r], - [y_min_r, -0.5, -y_min_r], - [-aux_y_min, -hd_center, -aux_y_min], - [aux_y_min, -hd_center, -aux_y_min], - [-center_r, -center_r, -center_r], - [center_r, -center_r, -center_r], - ] - ) + _np.array([0.5, 0.5, 0.5]) - - spline_list.append( - _Bezier(degrees=[1, 2, 2], control_points=y_min_z_min) - ) + x_max_z_min = ( + _np.array( + [ + [z_min_r, -z_min_r, -v_one_half], + [sep_distance, -aux_column_width, -v_one_half], + [v_one_half, -aux_column_width, -v_one_half], + [z_min_r, z_min_r, -v_one_half], + [sep_distance, aux_column_width, -v_one_half], + [v_one_half, aux_column_width, -v_one_half], + [aux_z_min, -aux_z_min, -hd_center], + [hd_center, -aux_column_width, -hd_center], + [v_one_half, -aux_column_width, -sep_distance], + [aux_z_min, aux_z_min, -hd_center], + [hd_center, aux_column_width, -hd_center], + [v_one_half, aux_column_width, -sep_distance], + [center_r, -center_r, -center_r], + [hd_center, -aux_x_max, -aux_x_max], + [v_one_half, -x_max_r, -x_max_r], + [center_r, center_r, -center_r], + [hd_center, aux_x_max, -aux_x_max], + [v_one_half, x_max_r, -x_max_r], + ] + ) + + center_point + ) - y_max_z_min = _np.array( - [ - [-z_min_r, z_min_r, -0.5], - [z_min_r, z_min_r, -0.5], - [-aux_column_width, seperator_distance, -0.5], - [aux_column_width, seperator_distance, -0.5], - [-aux_column_width, 0.5, -0.5], - [aux_column_width, 0.5, -0.5], - [-aux_z_min, aux_z_min, -hd_center], - [aux_z_min, aux_z_min, -hd_center], - [-aux_column_width, hd_center, -hd_center], - [aux_column_width, hd_center, -hd_center], - [-aux_column_width, 0.5, -seperator_distance], - [aux_column_width, 0.5, -seperator_distance], - [-center_r, center_r, -center_r], - [center_r, center_r, -center_r], - [-aux_y_max, hd_center, -aux_y_max], - [aux_y_max, hd_center, -aux_y_max], - [-y_max_r, 0.5, -y_max_r], - [y_max_r, 0.5, -y_max_r], - ] - ) + _np.array([0.5, 0.5, 0.5]) - - spline_list.append( - _Bezier(degrees=[1, 2, 2], control_points=y_max_z_min) - ) + x_min_z_max = ( + _np.array( + [ + [-v_one_half, -x_min_r, x_min_r], + [-hd_center, -aux_x_min, aux_x_min], + [-center_r, -center_r, center_r], + [-v_one_half, x_min_r, x_min_r], + [-hd_center, aux_x_min, aux_x_min], + [-center_r, center_r, center_r], + [-v_one_half, -aux_column_width, sep_distance], + [-hd_center, -aux_column_width, hd_center], + [-aux_z_max, -aux_z_max, hd_center], + [-v_one_half, aux_column_width, sep_distance], + [-hd_center, aux_column_width, hd_center], + [-aux_z_max, aux_z_max, hd_center], + [-v_one_half, -aux_column_width, v_one_half], + [-sep_distance, -aux_column_width, v_one_half], + [-z_max_r, -z_max_r, v_one_half], + [-v_one_half, aux_column_width, v_one_half], + [-sep_distance, aux_column_width, v_one_half], + [-z_max_r, z_max_r, v_one_half], + ] + ) + + center_point + ) - y_min_z_max = _np.array( - [ - [-y_min_r, -0.5, y_min_r], - [y_min_r, -0.5, y_min_r], - [-aux_y_min, -hd_center, aux_y_min], - [aux_y_min, -hd_center, aux_y_min], - [-center_r, -center_r, center_r], - [center_r, -center_r, center_r], - [-aux_column_width, -0.5, seperator_distance], - [aux_column_width, -0.5, seperator_distance], - [-aux_column_width, -hd_center, hd_center], - [aux_column_width, -hd_center, hd_center], - [-aux_z_max, -aux_z_max, hd_center], - [aux_z_max, -aux_z_max, hd_center], - [-aux_column_width, -0.5, 0.5], - [aux_column_width, -0.5, 0.5], - [-aux_column_width, -seperator_distance, 0.5], - [aux_column_width, -seperator_distance, 0.5], - [-z_max_r, -z_max_r, 0.5], - [z_max_r, -z_max_r, 0.5], - ] - ) + _np.array([0.5, 0.5, 0.5]) - - spline_list.append( - _Bezier(degrees=[1, 2, 2], control_points=y_min_z_max) - ) + x_max_z_max = ( + _np.array( + [ + [center_r, -center_r, center_r], + [hd_center, -aux_x_max, aux_x_max], + [v_one_half, -x_max_r, x_max_r], + [center_r, center_r, center_r], + [hd_center, aux_x_max, aux_x_max], + [v_one_half, x_max_r, x_max_r], + [aux_z_max, -aux_z_max, hd_center], + [hd_center, -aux_column_width, hd_center], + [v_one_half, -aux_column_width, sep_distance], + [aux_z_max, aux_z_max, hd_center], + [hd_center, aux_column_width, hd_center], + [v_one_half, aux_column_width, sep_distance], + [z_max_r, -z_max_r, v_one_half], + [sep_distance, -aux_column_width, v_one_half], + [v_one_half, -aux_column_width, v_one_half], + [z_max_r, z_max_r, v_one_half], + [sep_distance, aux_column_width, v_one_half], + [v_one_half, aux_column_width, v_one_half], + ] + ) + + center_point + ) - y_max_z_max = _np.array( - [ - [-center_r, center_r, center_r], - [center_r, center_r, center_r], - [-aux_y_max, hd_center, aux_y_max], - [aux_y_max, hd_center, aux_y_max], - [-y_max_r, 0.5, y_max_r], - [y_max_r, 0.5, y_max_r], - [-aux_z_max, aux_z_max, hd_center], - [aux_z_max, aux_z_max, hd_center], - [-aux_column_width, hd_center, hd_center], - [aux_column_width, hd_center, hd_center], - [-aux_column_width, 0.5, seperator_distance], - [aux_column_width, 0.5, seperator_distance], - [-z_max_r, z_max_r, 0.5], - [z_max_r, z_max_r, 0.5], - [-aux_column_width, seperator_distance, 0.5], - [aux_column_width, seperator_distance, 0.5], - [-aux_column_width, 0.5, 0.5], - [aux_column_width, 0.5, 0.5], - ] - ) + _np.array([0.5, 0.5, 0.5]) - - spline_list.append( - _Bezier(degrees=[1, 2, 2], control_points=y_max_z_max) - ) + y_min_z_min = ( + _np.array( + [ + [-aux_column_width, -v_one_half, -v_one_half], + [aux_column_width, -v_one_half, -v_one_half], + [-aux_column_width, -sep_distance, -v_one_half], + [aux_column_width, -sep_distance, -v_one_half], + [-z_min_r, -z_min_r, -v_one_half], + [z_min_r, -z_min_r, -v_one_half], + [-aux_column_width, -v_one_half, -sep_distance], + [aux_column_width, -v_one_half, -sep_distance], + [-aux_column_width, -hd_center, -hd_center], + [aux_column_width, -hd_center, -hd_center], + [-aux_z_min, -aux_z_min, -hd_center], + [aux_z_min, -aux_z_min, -hd_center], + [-y_min_r, -v_one_half, -y_min_r], + [y_min_r, -v_one_half, -y_min_r], + [-aux_y_min, -hd_center, -aux_y_min], + [aux_y_min, -hd_center, -aux_y_min], + [-center_r, -center_r, -center_r], + [center_r, -center_r, -center_r], + ] + ) + + center_point + ) - x_min_y_min_z_min = _np.array( - [ - [-0.5, -0.5, -0.5], - [-seperator_distance, -0.5, -0.5], - [-aux_column_width, -0.5, -0.5], - [-0.5, -seperator_distance, -0.5], - [-seperator_distance, -seperator_distance, -0.5], - [-aux_column_width, -seperator_distance, -0.5], - [-0.5, -aux_column_width, -0.5], - [-seperator_distance, -aux_column_width, -0.5], - [-z_min_r, -z_min_r, -0.5], - [-0.5, -0.5, -seperator_distance], - [-seperator_distance, -0.5, -seperator_distance], - [-aux_column_width, -0.5, -seperator_distance], - [-0.5, -seperator_distance, -seperator_distance], - [-hd_center, -hd_center, -hd_center], - [-aux_column_width, -hd_center, -hd_center], - [-0.5, -aux_column_width, -seperator_distance], - [-hd_center, -aux_column_width, -hd_center], - [-aux_z_min, -aux_z_min, -hd_center], - [-0.5, -0.5, -aux_column_width], - [-seperator_distance, -0.5, -aux_column_width], - [-y_min_r, -0.5, -y_min_r], - [-0.5, -seperator_distance, -aux_column_width], - [-hd_center, -hd_center, -aux_column_width], - [-aux_y_min, -hd_center, -aux_y_min], - [-0.5, -x_min_r, -x_min_r], - [-hd_center, -aux_x_min, -aux_x_min], - [-center_r, -center_r, -center_r], - ] - ) + _np.array([0.5, 0.5, 0.5]) - - spline_list.append( - _Bezier(degrees=[2, 2, 2], control_points=x_min_y_min_z_min) - ) + y_max_z_min = ( + _np.array( + [ + [-z_min_r, z_min_r, -v_one_half], + [z_min_r, z_min_r, -v_one_half], + [-aux_column_width, sep_distance, -v_one_half], + [aux_column_width, sep_distance, -v_one_half], + [-aux_column_width, v_one_half, -v_one_half], + [aux_column_width, v_one_half, -v_one_half], + [-aux_z_min, aux_z_min, -hd_center], + [aux_z_min, aux_z_min, -hd_center], + [-aux_column_width, hd_center, -hd_center], + [aux_column_width, hd_center, -hd_center], + [-aux_column_width, v_one_half, -sep_distance], + [aux_column_width, v_one_half, -sep_distance], + [-center_r, center_r, -center_r], + [center_r, center_r, -center_r], + [-aux_y_max, hd_center, -aux_y_max], + [aux_y_max, hd_center, -aux_y_max], + [-y_max_r, v_one_half, -y_max_r], + [y_max_r, v_one_half, -y_max_r], + ] + ) + + center_point + ) - x_max_y_min_z_min = _np.array( - [ - [aux_column_width, -0.5, -0.5], - [seperator_distance, -0.5, -0.5], - [0.5, -0.5, -0.5], - [aux_column_width, -seperator_distance, -0.5], - [seperator_distance, -seperator_distance, -0.5], - [0.5, -seperator_distance, -0.5], - [z_min_r, -z_min_r, -0.5], - [seperator_distance, -aux_column_width, -0.5], - [0.5, -aux_column_width, -0.5], - [aux_column_width, -0.5, -seperator_distance], - [seperator_distance, -0.5, -seperator_distance], - [0.5, -0.5, -seperator_distance], - [aux_column_width, -hd_center, -hd_center], - [hd_center, -hd_center, -hd_center], - [0.5, -seperator_distance, -seperator_distance], - [aux_z_min, -aux_z_min, -hd_center], - [hd_center, -aux_column_width, -hd_center], - [0.5, -aux_column_width, -seperator_distance], - [y_min_r, -0.5, -y_min_r], - [seperator_distance, -0.5, -aux_column_width], - [0.5, -0.5, -aux_column_width], - [aux_y_min, -hd_center, -aux_y_min], - [hd_center, -hd_center, -aux_column_width], - [0.5, -seperator_distance, -aux_column_width], - [center_r, -center_r, -center_r], - [hd_center, -aux_x_max, -aux_x_max], - [0.5, -x_max_r, -x_max_r], - ] - ) + _np.array([0.5, 0.5, 0.5]) - - spline_list.append( - _Bezier(degrees=[2, 2, 2], control_points=x_max_y_min_z_min) - ) + y_min_z_max = ( + _np.array( + [ + [-y_min_r, -v_one_half, y_min_r], + [y_min_r, -v_one_half, y_min_r], + [-aux_y_min, -hd_center, aux_y_min], + [aux_y_min, -hd_center, aux_y_min], + [-center_r, -center_r, center_r], + [center_r, -center_r, center_r], + [-aux_column_width, -v_one_half, sep_distance], + [aux_column_width, -v_one_half, sep_distance], + [-aux_column_width, -hd_center, hd_center], + [aux_column_width, -hd_center, hd_center], + [-aux_z_max, -aux_z_max, hd_center], + [aux_z_max, -aux_z_max, hd_center], + [-aux_column_width, -v_one_half, v_one_half], + [aux_column_width, -v_one_half, v_one_half], + [-aux_column_width, -sep_distance, v_one_half], + [aux_column_width, -sep_distance, v_one_half], + [-z_max_r, -z_max_r, v_one_half], + [z_max_r, -z_max_r, v_one_half], + ] + ) + + center_point + ) - x_min_y_max_z_min = _np.array( - [ - [-0.5, aux_column_width, -0.5], - [-seperator_distance, aux_column_width, -0.5], - [-z_min_r, z_min_r, -0.5], - [-0.5, seperator_distance, -0.5], - [-seperator_distance, seperator_distance, -0.5], - [-aux_column_width, seperator_distance, -0.5], - [-0.5, 0.5, -0.5], - [-seperator_distance, 0.5, -0.5], - [-aux_column_width, 0.5, -0.5], - [-0.5, aux_column_width, -seperator_distance], - [-hd_center, aux_column_width, -hd_center], - [-aux_z_min, aux_z_min, -hd_center], - [-0.5, seperator_distance, -seperator_distance], - [-hd_center, hd_center, -hd_center], - [-aux_column_width, hd_center, -hd_center], - [-0.5, 0.5, -seperator_distance], - [-seperator_distance, 0.5, -seperator_distance], - [-aux_column_width, 0.5, -seperator_distance], - [-0.5, x_min_r, -x_min_r], - [-hd_center, aux_x_min, -aux_x_min], - [-center_r, center_r, -center_r], - [-0.5, seperator_distance, -aux_column_width], - [-hd_center, hd_center, -aux_column_width], - [-aux_y_max, hd_center, -aux_y_max], - [-0.5, 0.5, -aux_column_width], - [-seperator_distance, 0.5, -aux_column_width], - [-y_max_r, 0.5, -y_max_r], - ] - ) + _np.array([0.5, 0.5, 0.5]) - - spline_list.append( - _Bezier(degrees=[2, 2, 2], control_points=x_min_y_max_z_min) - ) + y_max_z_max = ( + _np.array( + [ + [-center_r, center_r, center_r], + [center_r, center_r, center_r], + [-aux_y_max, hd_center, aux_y_max], + [aux_y_max, hd_center, aux_y_max], + [-y_max_r, v_one_half, y_max_r], + [y_max_r, v_one_half, y_max_r], + [-aux_z_max, aux_z_max, hd_center], + [aux_z_max, aux_z_max, hd_center], + [-aux_column_width, hd_center, hd_center], + [aux_column_width, hd_center, hd_center], + [-aux_column_width, v_one_half, sep_distance], + [aux_column_width, v_one_half, sep_distance], + [-z_max_r, z_max_r, v_one_half], + [z_max_r, z_max_r, v_one_half], + [-aux_column_width, sep_distance, v_one_half], + [aux_column_width, sep_distance, v_one_half], + [-aux_column_width, v_one_half, v_one_half], + [aux_column_width, v_one_half, v_one_half], + ] + ) + + center_point + ) - x_max_y_max_z_min = _np.array( - [ - [z_min_r, z_min_r, -0.5], - [seperator_distance, aux_column_width, -0.5], - [0.5, aux_column_width, -0.5], - [aux_column_width, seperator_distance, -0.5], - [seperator_distance, seperator_distance, -0.5], - [0.5, seperator_distance, -0.5], - [aux_column_width, 0.5, -0.5], - [seperator_distance, 0.5, -0.5], - [0.5, 0.5, -0.5], - [aux_z_min, aux_z_min, -hd_center], - [hd_center, aux_column_width, -hd_center], - [0.5, aux_column_width, -seperator_distance], - [aux_column_width, hd_center, -hd_center], - [hd_center, hd_center, -hd_center], - [0.5, seperator_distance, -seperator_distance], - [aux_column_width, 0.5, -seperator_distance], - [seperator_distance, 0.5, -seperator_distance], - [0.5, 0.5, -seperator_distance], - [center_r, center_r, -center_r], - [hd_center, aux_x_max, -aux_x_max], - [0.5, x_max_r, -x_max_r], - [aux_y_max, hd_center, -aux_y_max], - [hd_center, hd_center, -aux_column_width], - [0.5, seperator_distance, -aux_column_width], - [y_max_r, 0.5, -y_max_r], - [seperator_distance, 0.5, -aux_column_width], - [0.5, 0.5, -aux_column_width], - ] - ) + _np.array([0.5, 0.5, 0.5]) - - spline_list.append( - _Bezier(degrees=[2, 2, 2], control_points=x_max_y_max_z_min) - ) + x_min_y_min_z_min = ( + _np.array( + [ + [-v_one_half, -v_one_half, -v_one_half], + [-sep_distance, -v_one_half, -v_one_half], + [-aux_column_width, -v_one_half, -v_one_half], + [-v_one_half, -sep_distance, -v_one_half], + [ + -sep_distance, + -sep_distance, + -v_one_half, + ], + [-aux_column_width, -sep_distance, -v_one_half], + [-v_one_half, -aux_column_width, -v_one_half], + [-sep_distance, -aux_column_width, -v_one_half], + [-z_min_r, -z_min_r, -v_one_half], + [-v_one_half, -v_one_half, -sep_distance], + [ + -sep_distance, + -v_one_half, + -sep_distance, + ], + [-aux_column_width, -v_one_half, -sep_distance], + [ + -v_one_half, + -sep_distance, + -sep_distance, + ], + [-hd_center, -hd_center, -hd_center], + [-aux_column_width, -hd_center, -hd_center], + [-v_one_half, -aux_column_width, -sep_distance], + [-hd_center, -aux_column_width, -hd_center], + [-aux_z_min, -aux_z_min, -hd_center], + [-v_one_half, -v_one_half, -aux_column_width], + [-sep_distance, -v_one_half, -aux_column_width], + [-y_min_r, -v_one_half, -y_min_r], + [-v_one_half, -sep_distance, -aux_column_width], + [-hd_center, -hd_center, -aux_column_width], + [-aux_y_min, -hd_center, -aux_y_min], + [-v_one_half, -x_min_r, -x_min_r], + [-hd_center, -aux_x_min, -aux_x_min], + [-center_r, -center_r, -center_r], + ] + ) + + center_point + ) - x_min_y_min_z_max = _np.array( - [ - [-0.5, -0.5, aux_column_width], - [-seperator_distance, -0.5, aux_column_width], - [-y_min_r, -0.5, y_min_r], - [-0.5, -seperator_distance, aux_column_width], - [-hd_center, -hd_center, aux_column_width], - [-aux_y_min, -hd_center, aux_y_min], - [-0.5, -x_min_r, x_min_r], - [-hd_center, -aux_x_min, aux_x_min], - [-center_r, -center_r, center_r], - [-0.5, -0.5, seperator_distance], - [-seperator_distance, -0.5, seperator_distance], - [-aux_column_width, -0.5, seperator_distance], - [-0.5, -seperator_distance, seperator_distance], - [-hd_center, -hd_center, hd_center], - [-aux_column_width, -hd_center, hd_center], - [-0.5, -aux_column_width, seperator_distance], - [-hd_center, -aux_column_width, hd_center], - [-aux_z_max, -aux_z_max, hd_center], - [-0.5, -0.5, 0.5], - [-seperator_distance, -0.5, 0.5], - [-aux_column_width, -0.5, 0.5], - [-0.5, -seperator_distance, 0.5], - [-seperator_distance, -seperator_distance, 0.5], - [-aux_column_width, -seperator_distance, 0.5], - [-0.5, -aux_column_width, 0.5], - [-seperator_distance, -aux_column_width, 0.5], - [-z_max_r, -z_max_r, 0.5], - ] - ) + _np.array([0.5, 0.5, 0.5]) - - spline_list.append( - _Bezier(degrees=[2, 2, 2], control_points=x_min_y_min_z_max) - ) + x_max_y_min_z_min = ( + _np.array( + [ + [aux_column_width, -v_one_half, -v_one_half], + [sep_distance, -v_one_half, -v_one_half], + [v_one_half, -v_one_half, -v_one_half], + [aux_column_width, -sep_distance, -v_one_half], + [sep_distance, -sep_distance, -v_one_half], + [v_one_half, -sep_distance, -v_one_half], + [z_min_r, -z_min_r, -v_one_half], + [sep_distance, -aux_column_width, -v_one_half], + [v_one_half, -aux_column_width, -v_one_half], + [aux_column_width, -v_one_half, -sep_distance], + [sep_distance, -v_one_half, -sep_distance], + [v_one_half, -v_one_half, -sep_distance], + [aux_column_width, -hd_center, -hd_center], + [hd_center, -hd_center, -hd_center], + [v_one_half, -sep_distance, -sep_distance], + [aux_z_min, -aux_z_min, -hd_center], + [hd_center, -aux_column_width, -hd_center], + [v_one_half, -aux_column_width, -sep_distance], + [y_min_r, -v_one_half, -y_min_r], + [sep_distance, -v_one_half, -aux_column_width], + [v_one_half, -v_one_half, -aux_column_width], + [aux_y_min, -hd_center, -aux_y_min], + [hd_center, -hd_center, -aux_column_width], + [v_one_half, -sep_distance, -aux_column_width], + [center_r, -center_r, -center_r], + [hd_center, -aux_x_max, -aux_x_max], + [v_one_half, -x_max_r, -x_max_r], + ] + ) + + center_point + ) - x_max_y_min_z_max = _np.array( - [ - [y_min_r, -0.5, y_min_r], - [seperator_distance, -0.5, aux_column_width], - [0.5, -0.5, aux_column_width], - [aux_y_min, -hd_center, aux_y_min], - [hd_center, -hd_center, aux_column_width], - [0.5, -seperator_distance, aux_column_width], - [center_r, -center_r, center_r], - [hd_center, -aux_x_max, aux_x_max], - [0.5, -x_max_r, x_max_r], - [aux_column_width, -0.5, seperator_distance], - [seperator_distance, -0.5, seperator_distance], - [0.5, -0.5, seperator_distance], - [aux_column_width, -hd_center, hd_center], - [hd_center, -hd_center, hd_center], - [0.5, -seperator_distance, seperator_distance], - [aux_z_max, -aux_z_max, hd_center], - [hd_center, -aux_column_width, hd_center], - [0.5, -aux_column_width, seperator_distance], - [aux_column_width, -0.5, 0.5], - [seperator_distance, -0.5, 0.5], - [0.5, -0.5, 0.5], - [aux_column_width, -seperator_distance, 0.5], - [seperator_distance, -seperator_distance, 0.5], - [0.5, -seperator_distance, 0.5], - [z_max_r, -z_max_r, 0.5], - [seperator_distance, -aux_column_width, 0.5], - [0.5, -aux_column_width, 0.5], - ] - ) + _np.array([0.5, 0.5, 0.5]) - - spline_list.append( - _Bezier(degrees=[2, 2, 2], control_points=x_max_y_min_z_max) - ) + x_min_y_max_z_min = ( + _np.array( + [ + [-v_one_half, aux_column_width, -v_one_half], + [-sep_distance, aux_column_width, -v_one_half], + [-z_min_r, z_min_r, -v_one_half], + [-v_one_half, sep_distance, -v_one_half], + [-sep_distance, sep_distance, -v_one_half], + [-aux_column_width, sep_distance, -v_one_half], + [-v_one_half, v_one_half, -v_one_half], + [-sep_distance, v_one_half, -v_one_half], + [-aux_column_width, v_one_half, -v_one_half], + [-v_one_half, aux_column_width, -sep_distance], + [-hd_center, aux_column_width, -hd_center], + [-aux_z_min, aux_z_min, -hd_center], + [-v_one_half, sep_distance, -sep_distance], + [-hd_center, hd_center, -hd_center], + [-aux_column_width, hd_center, -hd_center], + [-v_one_half, v_one_half, -sep_distance], + [-sep_distance, v_one_half, -sep_distance], + [-aux_column_width, v_one_half, -sep_distance], + [-v_one_half, x_min_r, -x_min_r], + [-hd_center, aux_x_min, -aux_x_min], + [-center_r, center_r, -center_r], + [-v_one_half, sep_distance, -aux_column_width], + [-hd_center, hd_center, -aux_column_width], + [-aux_y_max, hd_center, -aux_y_max], + [-v_one_half, v_one_half, -aux_column_width], + [-sep_distance, v_one_half, -aux_column_width], + [-y_max_r, v_one_half, -y_max_r], + ] + ) + + center_point + ) - x_min_y_max_z_max = _np.array( - [ - [-0.5, x_min_r, x_min_r], - [-hd_center, aux_x_min, aux_x_min], - [-center_r, center_r, center_r], - [-0.5, seperator_distance, aux_column_width], - [-hd_center, hd_center, aux_column_width], - [-aux_y_max, hd_center, aux_y_max], - [-0.5, 0.5, aux_column_width], - [-seperator_distance, 0.5, aux_column_width], - [-y_max_r, 0.5, y_max_r], - [-0.5, aux_column_width, seperator_distance], - [-hd_center, aux_column_width, hd_center], - [-aux_z_max, aux_z_max, hd_center], - [-0.5, seperator_distance, seperator_distance], - [-hd_center, hd_center, hd_center], - [-aux_column_width, hd_center, hd_center], - [-0.5, 0.5, seperator_distance], - [-seperator_distance, 0.5, seperator_distance], - [-aux_column_width, 0.5, seperator_distance], - [-0.5, aux_column_width, 0.5], - [-seperator_distance, aux_column_width, 0.5], - [-z_max_r, z_max_r, 0.5], - [-0.5, seperator_distance, 0.5], - [-seperator_distance, seperator_distance, 0.5], - [-aux_column_width, seperator_distance, 0.5], - [-0.5, 0.5, 0.5], - [-seperator_distance, 0.5, 0.5], - [-aux_column_width, 0.5, 0.5], - ] - ) + _np.array([0.5, 0.5, 0.5]) - - spline_list.append( - _Bezier(degrees=[2, 2, 2], control_points=x_min_y_max_z_max) - ) + x_max_y_max_z_min = ( + _np.array( + [ + [z_min_r, z_min_r, -v_one_half], + [sep_distance, aux_column_width, -v_one_half], + [v_one_half, aux_column_width, -v_one_half], + [aux_column_width, sep_distance, -v_one_half], + [sep_distance, sep_distance, -v_one_half], + [v_one_half, sep_distance, -v_one_half], + [aux_column_width, v_one_half, -v_one_half], + [sep_distance, v_one_half, -v_one_half], + [v_one_half, v_one_half, -v_one_half], + [aux_z_min, aux_z_min, -hd_center], + [hd_center, aux_column_width, -hd_center], + [v_one_half, aux_column_width, -sep_distance], + [aux_column_width, hd_center, -hd_center], + [hd_center, hd_center, -hd_center], + [v_one_half, sep_distance, -sep_distance], + [aux_column_width, v_one_half, -sep_distance], + [sep_distance, v_one_half, -sep_distance], + [v_one_half, v_one_half, -sep_distance], + [center_r, center_r, -center_r], + [hd_center, aux_x_max, -aux_x_max], + [v_one_half, x_max_r, -x_max_r], + [aux_y_max, hd_center, -aux_y_max], + [hd_center, hd_center, -aux_column_width], + [v_one_half, sep_distance, -aux_column_width], + [y_max_r, v_one_half, -y_max_r], + [sep_distance, v_one_half, -aux_column_width], + [v_one_half, v_one_half, -aux_column_width], + ] + ) + + center_point + ) - x_max_y_max_z_max = _np.array( - [ - [center_r, center_r, center_r], - [hd_center, aux_x_max, aux_x_max], - [0.5, x_max_r, x_max_r], - [aux_y_max, hd_center, aux_y_max], - [hd_center, hd_center, aux_column_width], - [0.5, seperator_distance, aux_column_width], - [y_max_r, 0.5, y_max_r], - [seperator_distance, 0.5, aux_column_width], - [0.5, 0.5, aux_column_width], - [aux_z_max, aux_z_max, hd_center], - [hd_center, aux_column_width, hd_center], - [0.5, aux_column_width, seperator_distance], - [aux_column_width, hd_center, hd_center], - [hd_center, hd_center, hd_center], - [0.5, seperator_distance, seperator_distance], - [aux_column_width, 0.5, seperator_distance], - [seperator_distance, 0.5, seperator_distance], - [0.5, 0.5, seperator_distance], - [z_max_r, z_max_r, 0.5], - [seperator_distance, aux_column_width, 0.5], - [0.5, aux_column_width, 0.5], - [aux_column_width, seperator_distance, 0.5], - [seperator_distance, seperator_distance, 0.5], - [0.5, seperator_distance, 0.5], - [aux_column_width, 0.5, 0.5], - [seperator_distance, 0.5, 0.5], - [0.5, 0.5, 0.5], - ] - ) + _np.array([0.5, 0.5, 0.5]) - - spline_list.append( - _Bezier(degrees=[2, 2, 2], control_points=x_max_y_max_z_max) - ) - return (spline_list, None) + x_min_y_min_z_max = ( + _np.array( + [ + [-v_one_half, -v_one_half, aux_column_width], + [-sep_distance, -v_one_half, aux_column_width], + [-y_min_r, -v_one_half, y_min_r], + [-v_one_half, -sep_distance, aux_column_width], + [-hd_center, -hd_center, aux_column_width], + [-aux_y_min, -hd_center, aux_y_min], + [-v_one_half, -x_min_r, x_min_r], + [-hd_center, -aux_x_min, aux_x_min], + [-center_r, -center_r, center_r], + [-v_one_half, -v_one_half, sep_distance], + [-sep_distance, -v_one_half, sep_distance], + [-aux_column_width, -v_one_half, sep_distance], + [-v_one_half, -sep_distance, sep_distance], + [-hd_center, -hd_center, hd_center], + [-aux_column_width, -hd_center, hd_center], + [-v_one_half, -aux_column_width, sep_distance], + [-hd_center, -aux_column_width, hd_center], + [-aux_z_max, -aux_z_max, hd_center], + [-v_one_half, -v_one_half, v_one_half], + [-sep_distance, -v_one_half, v_one_half], + [-aux_column_width, -v_one_half, v_one_half], + [-v_one_half, -sep_distance, v_one_half], + [-sep_distance, -sep_distance, v_one_half], + [-aux_column_width, -sep_distance, v_one_half], + [-v_one_half, -aux_column_width, v_one_half], + [-sep_distance, -aux_column_width, v_one_half], + [-z_max_r, -z_max_r, v_one_half], + ] + ) + + center_point + ) + + x_max_y_min_z_max = ( + _np.array( + [ + [y_min_r, -v_one_half, y_min_r], + [sep_distance, -v_one_half, aux_column_width], + [v_one_half, -v_one_half, aux_column_width], + [aux_y_min, -hd_center, aux_y_min], + [hd_center, -hd_center, aux_column_width], + [v_one_half, -sep_distance, aux_column_width], + [center_r, -center_r, center_r], + [hd_center, -aux_x_max, aux_x_max], + [v_one_half, -x_max_r, x_max_r], + [aux_column_width, -v_one_half, sep_distance], + [sep_distance, -v_one_half, sep_distance], + [v_one_half, -v_one_half, sep_distance], + [aux_column_width, -hd_center, hd_center], + [hd_center, -hd_center, hd_center], + [v_one_half, -sep_distance, sep_distance], + [aux_z_max, -aux_z_max, hd_center], + [hd_center, -aux_column_width, hd_center], + [v_one_half, -aux_column_width, sep_distance], + [aux_column_width, -v_one_half, v_one_half], + [sep_distance, -v_one_half, v_one_half], + [v_one_half, -v_one_half, v_one_half], + [aux_column_width, -sep_distance, v_one_half], + [sep_distance, -sep_distance, v_one_half], + [v_one_half, -sep_distance, v_one_half], + [z_max_r, -z_max_r, v_one_half], + [sep_distance, -aux_column_width, v_one_half], + [v_one_half, -aux_column_width, v_one_half], + ] + ) + + center_point + ) + + x_min_y_max_z_max = ( + _np.array( + [ + [-v_one_half, x_min_r, x_min_r], + [-hd_center, aux_x_min, aux_x_min], + [-center_r, center_r, center_r], + [-v_one_half, sep_distance, aux_column_width], + [-hd_center, hd_center, aux_column_width], + [-aux_y_max, hd_center, aux_y_max], + [-v_one_half, v_one_half, aux_column_width], + [-sep_distance, v_one_half, aux_column_width], + [-y_max_r, v_one_half, y_max_r], + [-v_one_half, aux_column_width, sep_distance], + [-hd_center, aux_column_width, hd_center], + [-aux_z_max, aux_z_max, hd_center], + [-v_one_half, sep_distance, sep_distance], + [-hd_center, hd_center, hd_center], + [-aux_column_width, hd_center, hd_center], + [-v_one_half, v_one_half, sep_distance], + [-sep_distance, v_one_half, sep_distance], + [-aux_column_width, v_one_half, sep_distance], + [-v_one_half, aux_column_width, v_one_half], + [-sep_distance, aux_column_width, v_one_half], + [-z_max_r, z_max_r, v_one_half], + [-v_one_half, sep_distance, v_one_half], + [-sep_distance, sep_distance, v_one_half], + [-aux_column_width, sep_distance, v_one_half], + [-v_one_half, v_one_half, v_one_half], + [-sep_distance, v_one_half, v_one_half], + [-aux_column_width, v_one_half, v_one_half], + ] + ) + + center_point + ) + + x_max_y_max_z_max = ( + _np.array( + [ + [center_r, center_r, center_r], + [hd_center, aux_x_max, aux_x_max], + [v_one_half, x_max_r, x_max_r], + [aux_y_max, hd_center, aux_y_max], + [hd_center, hd_center, aux_column_width], + [v_one_half, sep_distance, aux_column_width], + [y_max_r, v_one_half, y_max_r], + [sep_distance, v_one_half, aux_column_width], + [v_one_half, v_one_half, aux_column_width], + [aux_z_max, aux_z_max, hd_center], + [hd_center, aux_column_width, hd_center], + [v_one_half, aux_column_width, sep_distance], + [aux_column_width, hd_center, hd_center], + [hd_center, hd_center, hd_center], + [v_one_half, sep_distance, sep_distance], + [aux_column_width, v_one_half, sep_distance], + [sep_distance, v_one_half, sep_distance], + [v_one_half, v_one_half, sep_distance], + [z_max_r, z_max_r, v_one_half], + [sep_distance, aux_column_width, v_one_half], + [v_one_half, aux_column_width, v_one_half], + [aux_column_width, sep_distance, v_one_half], + [sep_distance, sep_distance, v_one_half], + [v_one_half, sep_distance, v_one_half], + [aux_column_width, v_one_half, v_one_half], + [sep_distance, v_one_half, v_one_half], + [v_one_half, v_one_half, v_one_half], + ] + ) + + center_point + ) + + # Append the control points to the spline list + for control_points, degrees in [ + (x_min_y_min, [2, 2, 1]), + (x_max_y_min, [2, 2, 1]), + (x_min_y_max, [2, 2, 1]), + (x_max_y_max, [2, 2, 1]), + (x_min_z_min, [2, 1, 2]), + (x_max_z_min, [2, 1, 2]), + (x_min_z_max, [2, 1, 2]), + (x_max_z_max, [2, 1, 2]), + (y_min_z_min, [1, 2, 2]), + (y_max_z_min, [1, 2, 2]), + (y_min_z_max, [1, 2, 2]), + (y_max_z_max, [1, 2, 2]), + (x_min_y_min_z_min, [2, 2, 2]), + (x_max_y_min_z_min, [2, 2, 2]), + (x_min_y_max_z_min, [2, 2, 2]), + (x_max_y_max_z_min, [2, 2, 2]), + (x_min_y_min_z_max, [2, 2, 2]), + (x_max_y_min_z_max, [2, 2, 2]), + (x_min_y_max_z_max, [2, 2, 2]), + (x_max_y_max_z_max, [2, 2, 2]), + ]: + spline_list.append( + _Bezier(degrees=degrees, control_points=control_points) + ) + + if i_derivative == 0: + splines = spline_list.copy() + else: + derivatives.append(spline_list) + return (splines, derivatives) diff --git a/splinepy/microstructure/tiles/snappy.py b/splinepy/microstructure/tiles/snappy.py index dac00bd20..24a910e0d 100644 --- a/splinepy/microstructure/tiles/snappy.py +++ b/splinepy/microstructure/tiles/snappy.py @@ -8,6 +8,9 @@ class Snappy(_TileBase): """Snap-through tile consisting of a thin truss and a thick truss that collide into each other. + # TODO: currently the tile parameters are not implemented as the parameters variable + therefore, no parameter sensitivities are calculated + .. raw:: html

Fullscreen.

@@ -20,10 +23,16 @@ class Snappy(_TileBase): # dummy values - not used _evaluation_points = _np.array([[0.5, 0.5]]) _n_info_per_eval_point = 1 + _sensitivities_implemented = False + _closure_directions = ["y_min", "y_max"] + _parameter_bounds = [] + _parameters_shape = () + + _CONTACT_LENGTH_BOUNDS = [0.0, 0.5] def _closing_tile( self, - parameters=None, + parameters=None, # noqa: ARG002 parameter_sensitivities=None, # TODO closure=None, contact_length=0.1, @@ -61,8 +70,6 @@ def _closing_tile( if closure is None: raise ValueError("No closing direction given") - self.check_params(parameters) - if parameter_sensitivities is not None: raise NotImplementedError( "Derivatives are not implemented for this tile yet" @@ -220,7 +227,6 @@ def _closing_tile( spline_list.append( _Bezier(degrees=[3, 1], control_points=spline_10) ) - return spline_list elif closure == "y_max": spline_1 = _np.array( [ @@ -286,12 +292,13 @@ def _closing_tile( spline_list.append( _Bezier(degrees=[3, 1], control_points=spline_5) ) - return (spline_list, None) else: - raise ValueError( + raise NotImplementedError( "Closing tile is only implemented for y-enclosure" ) + return (spline_list, None) + def create_tile( self, parameters=None, @@ -339,13 +346,16 @@ def create_tile( """ for param in [a, b, c, r, contact_length]: - if not isinstance(param, float): - raise ValueError(f"Invalid Type, {param} is not float") + if not isinstance(param, (int, float)): + raise TypeError( + f"Invalid Type, {param} is neither int nor float" + ) if param < 0: raise ValueError("Invalid parameter, must be > 0.") - if not ((contact_length > 0) and (contact_length < 0.49)): - raise ValueError("The length of a side must be in (0.01, 0.49)") + self._check_custom_parameter( + contact_length, "contact length", self._CONTACT_LENGTH_BOUNDS + ) # Check horizontal parameters if not ((r + contact_length) < 0.5): @@ -362,7 +372,7 @@ def create_tile( if parameters is not None: raise NotImplementedError( - "Parametriazation is not implemented for this tile yet" + "Parametrization is not implemented for this tile yet" ) if parameter_sensitivities is not None: diff --git a/splinepy/microstructure/tiles/tile_base.py b/splinepy/microstructure/tiles/tile_base.py index 5c1fe89e9..9678bdf30 100644 --- a/splinepy/microstructure/tiles/tile_base.py +++ b/splinepy/microstructure/tiles/tile_base.py @@ -6,12 +6,39 @@ class TileBase(_SplinepyBase): """ Base class for tile objects + + Attributes + --------------- + _dim: int + Dimension in physical space + _para_dim: int + Dimension in parametric space + _evaluation_points: np.ndarray (2D) + Points in parametric space where tile parameters are evaluated. Each parameter + is attributed one evaluation point. This is used for the parametrization spline. + _n_info_per_eval_point: int + Number of tile parameters per evaluation point + _sensitivities_implemented: bool + Whether sensitivities w.r.t. tile parameters are implemented + _closure_directions: list + List of directions in which the closure has been implemented + _parameter_bounds: list> + List of bounds for the tile parameters + _parameters_shape: tuple + Shape of parameters array + _default_parameter_value: float/np.ndarray + Default values for all tile parameters """ _dim = None _para_dim = None _evaluation_points = None _n_info_per_eval_point = None + _sensitivities_implemented = None + _closure_directions = None + _parameter_bounds = None + _parameters_shape = None + _default_parameter_value = None def __init__(self): if type(self) is TileBase: @@ -30,7 +57,6 @@ def _raise_if_not_set_else_return(cls, attr_name): ) return attr - @classmethod @property def evaluation_points(cls): """Positions in the parametrization function to be evaluated when tile @@ -46,7 +72,20 @@ def evaluation_points(cls): """ return cls._raise_if_not_set_else_return("_evaluation_points") - @classmethod + @property + def n_info_per_eval_point(cls): + """Number of parameters per evaluation point + + Parameters + ---------- + None + + Returns + ------- + n_info : int + """ + return cls._raise_if_not_set_else_return("_n_info_per_eval_point") + @property def dim(cls): """Returns dimensionality in physical space of the Microtile. @@ -61,7 +100,6 @@ def dim(cls): """ return cls._raise_if_not_set_else_return("_dim") - @classmethod @property def para_dim(cls): """Returns dimensionality in parametric space of the Microtile. @@ -76,8 +114,82 @@ def para_dim(cls): """ return cls._raise_if_not_set_else_return("_para_dim") - def check_params(self, params): - """Checks if the parameters have the correct format and shape + @property + def sensitivities_implemented(cls): + """Returns whether sensitivities are implemented for the microtile + + Parameters + ---------- + None + + Returns + ------- + is_implemented: bool + """ + return cls._raise_if_not_set_else_return("_sensitivities_implemented") + + @property + def closure_directions(cls): + """Returns the available closure directions of the microtile + + Parameters + ---------- + None + + Returns + ------- + directions: None/list + """ + return cls._closure_directions + + @property + def parameter_bounds(self): + """Returns the bounds for the microtiles' parameters. + + Depending on the tile, parameter bounds can dynamically change (e.g. Cross2D). + Therefore, it is instance-dependent and self instead of cls is used. + + Parameters + ---------- + None + + Returns + ------- + bounds: list> + """ + return self._raise_if_not_set_else_return("_parameter_bounds") + + @property + def parameters_shape(cls): + """Returns the shape of the microtile's parameters array + + Parameters + ---------- + None + + Returns + ------- + shape: tuple + """ + return cls._raise_if_not_set_else_return("_parameters_shape") + + @property + def default_parameter_value(cls): + """Returns the default value of the microtile's parameters + + Parameters + ---------- + None + + Returns + ------- + default_value: float/None + """ + return cls._default_parameter_value + + def check_params(self, parameters): + """Checks if the parameters have the correct format and shape and are within + defined bounds Parameters ---------- @@ -88,14 +200,14 @@ def check_params(self, params): ------- True: Boolean """ - # check if tuple - - if not (isinstance(params, _np.ndarray) and params.ndim == 2): + # Check correct format + if not (isinstance(parameters, _np.ndarray) and parameters.ndim == 2): raise TypeError("parameters must be two-dimensional np array") + # Check correct shape if not ( - (self._evaluation_points.shape[0] == params.shape[0]) - and (self._n_info_per_eval_point == params.shape[1]) + (self._evaluation_points.shape[0] == parameters.shape[0]) + and (self._n_info_per_eval_point == parameters.shape[1]) ): raise TypeError( f"Mismatch in parameter size, expected " @@ -103,6 +215,23 @@ def check_params(self, params): f"{self._n_info_per_eval_point}" ) + # Check if all parameters are within bounds + if self._parameter_bounds is not None: + bounds = _np.array(self._parameter_bounds) + lower_bounds = bounds[:, 0] + upper_bounds = bounds[:, 1] + within_bounds = (parameters.ravel() > lower_bounds) & ( + parameters.ravel() < upper_bounds + ) + if not _np.all(within_bounds): + out_of_bounds = parameters[ + ~within_bounds.reshape(parameters.shape) + ] + raise ValueError( + f"The following parameters are out of bounds: {out_of_bounds}. ", + f"Expected bounds: lower: {lower_bounds} and upper: {upper_bounds}", + ) + return True def check_param_derivatives(self, derivatives): @@ -156,3 +285,77 @@ def create_tile(self, **kwargs): raise NotImplementedError( f"create_tile() not implemented for {type(self)}" ) + + def _process_input(self, parameters, parameter_sensitivities): + """Processing input for create_tile and _closing_tile + + Parameters + ------------- + parameters: np.ndarray + Tile parameters + parameter_sensitivities: np.ndarray + Tile parameter sensitivities to be calculated + + Returns + --------- + parameters: np.ndarray + Tile parameters + n_derivatives: np.ndarray + Number of different derivatives to compute + derivatives: list/None + Initialized list of derivatives + """ + # Set parameters to default values if not user-given + if parameters is None: + default_value = self.default_parameter_value + self._logd( + f"Setting parameters to default values ({default_value})" + ) + if isinstance(default_value, float): + parameters = _np.full( + (len(self.evaluation_points), self.n_info_per_eval_point), + default_value, + ) + elif isinstance(default_value, _np.ndarray): + parameters = default_value + + # Initialize list of derivatives + if parameter_sensitivities is not None: + n_derivatives = parameter_sensitivities.shape[2] + derivatives = [] + else: + n_derivatives = 0 + derivatives = None + + # Validity check of parameters and their sensitivities + self.check_params(parameters) + self.check_param_derivatives(parameter_sensitivities) + + return parameters, n_derivatives, derivatives + + def _check_custom_parameter(self, value, param_name, bounds): + """Check if a custom tile parameter (e.g. contact length) is within bounds + + Parameters + ------------------ + value: float + Value of the custom parameter + param_name: str + Name of custom parameter + bounds: list + List of min. and max. bound + """ + + if not isinstance(bounds, list): + raise TypeError("bounds has to be a list") + if len(bounds) != 2: + raise ValueError("Bounds must consist of a min. and a max. value") + min_bound, max_bound = bounds + + if not isinstance(value, (int, float)): + raise ValueError(f"Invalid type for {param_name}") + + if not ((value > min_bound) and (value < max_bound)): + raise ValueError( + f"{param_name} must be in ({min_bound}, {max_bound})" + ) diff --git a/tests/conftest.py b/tests/conftest.py index 5043ef971..3bb99cd62 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -15,7 +15,7 @@ def error_log(*args): @pytest.fixture def np_rng(): - return np.random.default_rng() + return np.random.default_rng(seed=0) # query points @@ -41,6 +41,52 @@ def queries_3D(): ] +# hard-coded values to keep the same for derivative/sensitivity calculations +@pytest.fixture +def heps(): + """ + Perturbation/step size for finite difference evaluation of derivative/sensitivity. + + The value 1e-5 is arbitrary, but is a compromise between: + - Being small enough to ensure the finite difference calculation being accurate + - Being large enough to avoid round-off error in floating-point arithmetic + """ + return 1e-5 + + +@pytest.fixture +def n_test_points(): + """ + Number of random testing points (in parametric domain) + + The number 10 is arbitrary and should ensure to have good test coverage. Increasing + this number could yield more thorough tests at the cost of longer runtime. + """ + return 10 + + +@pytest.fixture +def big_perturbation(): + """Value for perturbation of parameters value + + The number 0.1 is chosen arbitrarily. This value is for testing out of bounds + parameter values. It is designed to add to the maximum or subtract from the + minimum bound to delibarately make the values out of the bounds.""" + return 0.1 + + +@pytest.fixture +def fd_derivative_stepsizes_and_weights(): + """Stepsizes and weights for the calculation of the derivative using finite + differences. Using fourth-order accurate centered scheme. + + Returns + ------- + stepsizes_and_weights, denominator: dict + """ + return {-2: 1 / 12, -1: -8 / 12, 1: 8 / 12, 2: -1 / 12} + + # initializing a spline should be a test itself, so provide `dict_spline` # this is "iga-book"'s fig 2.15. @pytest.fixture diff --git a/tests/test_knot_vectors.py b/tests/test_knot_vectors.py index 329d165b5..c7ddb41f2 100644 --- a/tests/test_knot_vectors.py +++ b/tests/test_knot_vectors.py @@ -29,4 +29,4 @@ def test_knot_vectors(splinetype, request): spline.knot_multiplicities, spline.knot_vectors, ): - assert np.allclose(np.array(spl_kv), np.repeat(u_kv, kn_m)) + assert np.allclose(spl_kv.numpy(), np.repeat(u_kv, kn_m)) diff --git a/tests/test_microstructure.py b/tests/test_microstructure.py new file mode 100644 index 000000000..4c3e62942 --- /dev/null +++ b/tests/test_microstructure.py @@ -0,0 +1,194 @@ +import numpy as np +from pytest import mark, skip + +import splinepy.microstructure as ms +from splinepy.helpme.create import box +from splinepy.helpme.integrate import volume + +all_tile_classes = list(ms.tiles.everything().values()) +# Tile classes where closure should be tested +tile_classes_with_closure = [ + tile_class + for tile_class in all_tile_classes + if tile_class._closure_directions is not None +] + +# Fixed auxiliary variables specific to microstructure testing +TILING = [2, 2, 2] +BOX_DIMENSIONS = [1, 1, 1] +EPS = 1e-7 + +# TODO(#458): the following tiles fail the closure test +CLOSURE_FAILS = { + ms.tiles.HollowOctagonExtrude: "has no closure implemented", + ms.tiles.InverseCross3D: "closure is special: it does not fill the whole unit " + + "cube and does not fully cover the closing face", +} + + +@mark.parametrize("tile_class", tile_classes_with_closure) +def test_closing_face(tile_class): + """Check if closing face is working + + Parameters + --------- + tile_class: tile class in splinepy.microstructure.tiles + Microtile + """ + + # Skip tile if it doesn't support closure + if tile_class._closure_directions is None: + skip( + f"Tile {tile_class.__name__} does not have a closure implementation. Skip" + ) + + # TODO: right now skip tiles which have faulty closures + if tile_class in CLOSURE_FAILS: + reason = CLOSURE_FAILS[tile_class] + skip( + f"Known issue: skip closure test for {tile_class.__name__}, " + f"reason: {reason}" + ) + + def check_if_closed(multipatch, closure_direction): + """Helper function to see if multipatch has a closing surface + + Parameters + ---------- + multipatch: splinepy Multipatch + Microstructure multipatch + closure_direction: str + Direction in which the closure has been applied + """ + direction_index_dict = {"x": 0, "y": 1, "z": 2} + direction_index = direction_index_dict[closure_direction] + + def min_identifier(points): + return points[:, direction_index] < EPS + + def max_identifier(points): + return ( + points[:, direction_index] + > BOX_DIMENSIONS[direction_index] - EPS + ) + + # create min- and max-boundaries of the multipatch using the identifiers + multipatch.boundary_from_function(min_identifier, boundary_id=2) + multipatch.boundary_from_function(max_identifier, boundary_id=3) + + min_patches = multipatch.boundary_multipatch(2) + max_patches = multipatch.boundary_multipatch(3) + + # Check if the closing surface has a surface area of 1 + face_min_area = sum([volume(patch) for patch in min_patches.patches]) + face_max_area = sum([volume(patch) for patch in max_patches.patches]) + + assert face_min_area > 1.0 - EPS, ( + f"The closure of the {closure_direction}_min surface is not complete. " + f"Expected area of 1, got {face_min_area}" + ) + assert face_max_area > 1.0 - EPS, ( + f"The closure of the {closure_direction}_max surface is not complete. " + f"Expected area of 1, instead got {face_max_area}" + ) + + tile_creator = tile_class() + generator = ms.microstructure.Microstructure( + deformation_function=box(*BOX_DIMENSIONS[: tile_creator._dim]), + microtile=tile_creator, + tiling=TILING[: tile_creator._dim], + ) + # Go through all implemented closure direction + closure_directions = { + directionname[0] for directionname in tile_creator._closure_directions + } + for closure_direction in closure_directions: + multipatch = generator.create(closing_face=closure_direction) + check_if_closed(multipatch, closure_direction) + + +@mark.parametrize("tile_class", all_tile_classes) +def test_macro_sensitivities(tile_class, np_rng, heps, n_test_points): + """Testing the correctness of the derivatives of the whole microstructure w.r.t. + the deformation function's control points. It is tested by evaluating the derivative + obtained via finite differences. The values are evaluated at random points. + + Parameters + ---------- + tile_class: tile class in splinepy.microstructure.tiles + Microtile + np_rng: numpy.random._generator.Generator + Default random number generator + heps: float + Perturbation size for finite difference evaluation. Defined in conftest.py + n_test_points: int + Number of testing points in the parametric domain. Defined in conftest.py + """ + + tile_creator = tile_class() + deformation_function_orig = box(*BOX_DIMENSIONS[: tile_creator._dim]) + generator = ms.microstructure.Microstructure( + deformation_function=deformation_function_orig, + microtile=tile_creator, + tiling=TILING[: tile_creator._dim], + ) + multipatch = generator.create(macro_sensitivities=True) + dim = multipatch.dim + n_cps = deformation_function_orig.cps.shape[0] + + # Set evaluation points as random spots in the parametric space + eval_points = np_rng.random((n_test_points, tile_creator._para_dim)) + microstructure_orig_evaluations = [ + patch.evaluate(eval_points) for patch in multipatch.patches + ] + n_patches = len(multipatch.patches) + + # Go through derivatives of every deformation function's control point + for ii_ctps in range(n_cps): + # Gradient through finite differences + deformation_function_perturbed = deformation_function_orig.copy() + deformation_function_perturbed.cps[ii_ctps, :] += heps + generator.deformation_function = deformation_function_perturbed + multipatch_perturbed = generator.create() + microstructure_perturbed_evaluations = [ + patch.evaluate(eval_points) + for patch in multipatch_perturbed.patches + ] + # Evaluate finite difference gradient + fd_sensitivity = [ + (patch_perturbed - patch_orig) / heps + for patch_perturbed, patch_orig in zip( + microstructure_orig_evaluations, + microstructure_perturbed_evaluations, + ) + ] + + # Go through each direction + for jj_dim in range(dim): + deriv_orig = multipatch.fields[ii_ctps * dim + jj_dim] + deriv_evaluations = [ + patch.evaluate(eval_points) for patch in deriv_orig.patches + ] + for k_patch, patch_deriv_implemented, patch_deriv_fd in zip( + range(n_patches), deriv_evaluations, fd_sensitivity + ): + # Verify derivative shapes + assert patch_deriv_implemented.shape[1] == dim, ( + "The derivative at " + + f"patch {k_patch} has the wrong dimensions." + ) + # Assert correctness of sensitivity + assert np.allclose( + -patch_deriv_implemented[:, jj_dim], + patch_deriv_fd[:, jj_dim], + ), ( + "Implemented derivative calculation for tile class" + + f"{tile_class}, at patch {k_patch+1}/{n_patches} does not " + + "match the derivative obtained using Finite Differences at " + + "the following evaluation points:\n" + + str(eval_points) + + "\nImplemented derivative:\n" + + str(patch_deriv_implemented[:, jj_dim]) + + "\nFinite difference derivative:\n" + + str(patch_deriv_fd[:, jj_dim]) + ) diff --git a/tests/test_microtiles.py b/tests/test_microtiles.py new file mode 100644 index 000000000..48ae1e508 --- /dev/null +++ b/tests/test_microtiles.py @@ -0,0 +1,460 @@ +from inspect import getfullargspec + +import numpy as np +from pytest import mark, raises, skip + +import splinepy.microstructure as ms +from splinepy.utils.data import cartesian_product as _cartesian_product + +# Tolerance value for checking control points +EPS = 1e-8 + +all_tile_classes = list(ms.tiles.everything().values()) +# Tile classes where closure should be tested +tile_classes_with_closure = [ + tile_class + for tile_class in all_tile_classes + if tile_class._closure_directions is not None +] +# Tile classes where sensitivities should be tested +tile_classes_with_sensitivities = [ + tile_class + for tile_class in all_tile_classes + if tile_class._sensitivities_implemented +] + +# Skip certain tile classes for parameters testing +skip_tiles = { + ms.tiles.EllipsVoid: "control points easily lie outside unitcube", + ms.tiles.Snappy: "has no 'parameters' implemented", +} + + +def check_control_points(tile_patches): + """Helper function. Check if all of tile's control points all lie within unit + square/cube. The tolerance is defined by EPS""" + # Go through all patches + for tile_patch in tile_patches: + cps = tile_patch.control_points + valid_cp_indices = (cps >= 0.0 - EPS) & (cps <= 1.0 + EPS) + assert np.all(valid_cp_indices), ( + "Control points of tile must lie inside the unit square/cube. " + + f"Found points outside bounds: {cps[~(valid_cp_indices)]}" + ) + + +def make_bounds_feasible(bounds): + """Helper function. Bounds are understood as open set of min. and max. values. + Therefore, convert bounds to open set of these values. + + Parameters + ------------ + bounds: list> + Values of bounds + + Returns + ---------- + feasible_bounds: np.ndarray + Values of bounds + """ + feasible_bounds = [ + [min_value + EPS, max_value - EPS] for min_value, max_value in bounds + ] + return np.array(feasible_bounds) + + +@mark.parametrize("tile_class", all_tile_classes) +def test_tile_class(tile_class): + """Checks if all tile classes have the appropriate members and functions. + + Parameters + --------- + tile_class: tile class in splinepy.microstructure.tiles + Microtile + """ + # Create instance of class + tile_instance = tile_class() + tile_name = tile_class.__name__ + + required_class_variables = { + "_para_dim": int, + "_dim": int, + "_evaluation_points": np.ndarray, + "_n_info_per_eval_point": int, + "_sensitivities_implemented": bool, + "_parameter_bounds": list, + "_parameters_shape": tuple, + } + + # Get tile class' objects + members = [ + attr for attr in dir(tile_instance) if not attr.startswith("__") + ] + + # Class must have function create_tile() + assert hasattr( + tile_instance, "create_tile" + ), f"Tile class {tile_name} must have create_tile() method" + + # Tile must be able to take parameters and sensitivities as input + create_parameters = getfullargspec(tile_instance.create_tile).args + for required_param in ["parameters", "parameter_sensitivities"]: + assert required_param in create_parameters, ( + f"{tile_name}.create_tile() must have '{required_param}' as an " + "input parameter" + ) + + # Ensure closure can be handled correctly + if "closure" in create_parameters: + assert "_closure_directions" in members, ( + f"Tile class {tile_name} has closure ability. The available closure " + + "directions are missing" + ) + assert hasattr( + tile_instance, "_closing_tile" + ), f"Tile class {tile_name} has closure ability but no _closing_tile() function" + + # Check if tile class has all required variables and they are the correct type + for required_variable, var_type in required_class_variables.items(): + assert ( + required_variable in members + ), f"Tile class {tile_name} needs to have member variable '{required_variable}'" + assert isinstance( + getattr(tile_instance, required_variable), var_type + ), ( + f"Variable {required_variable} must be of type {var_type}, but found type " + f"{type(getattr(tile_instance, required_variable))}" + ) + + # Check default parameter value if there is one + if tile_instance._parameters_shape != (): + # Assert that there is a default value + assert hasattr(tile_instance, "_default_parameter_value"), ( + f'{tile_name} must have "_default_parameter_value" as a class ' + " attribute." + ) + # Check the default value's type + default_value = tile_instance._default_parameter_value + if isinstance(default_value, np.ndarray): + # Check the dimensions + assert default_value.shape == tile_instance._parameters_shape, ( + f"Default parameter values for tile {tile_name} has the wrong" + " dimensions" + ) + # Check if default values are within bounds + default_value = default_value.ravel() + elif not isinstance(default_value, float): + raise ValueError( + f"Default parameter value for tile {tile_name} must either be " + "a float or a numpy array" + ) + + # Check if default values are within bounds + parameter_bounds = np.asarray(tile_instance._parameter_bounds) + lower_bounds = parameter_bounds[:, 0] + upper_bounds = parameter_bounds[:, 1] + assert np.all( + (default_value > lower_bounds) & (default_value < upper_bounds) + ), f"Default parameter value of tile {tile_name} is not within bounds" + + +@mark.parametrize("tile_class", all_tile_classes) +def test_tile_bounds(tile_class): + """Test if tile is still in unit cube at the bounds. Checks default and also + non-default parameter values. + + Parameters + --------- + tile_class: tile class in splinepy.microstructure.tiles + Microtile + """ + tile_creator = tile_class() + # Create tile with default parameters + tile_patches, _ = tile_creator.create_tile() + check_control_points(tile_patches) + + # Skip certain classes for testing + if tile_class in skip_tiles: + skip( + "Known issue: skip bound test for non-default parameter values for tile " + f"{tile_class.__name__}. Reason: {skip_tiles[tile_class]}" + ) + + # Go through all extremes of parameters and ensure that also they create + # tiles within unit square/cube + feasible_parameter_bounds = make_bounds_feasible( + tile_creator._parameter_bounds + ) + all_parameter_bounds = _cartesian_product(feasible_parameter_bounds) + for parameter_extremes in all_parameter_bounds: + tile_patches, _ = tile_creator.create_tile( + parameters=parameter_extremes.reshape( + tile_creator._parameters_shape + ) + ) + check_control_points(tile_patches) + + +@mark.parametrize("tile_class", tile_classes_with_closure) +def test_tile_closure(tile_class): + """Check if closing tiles also lie in unit cube. + + Parameters + --------- + tile_class: tile class in splinepy.microstructure.tiles + Microtile + """ + tile_name = tile_class.__name__ + + # Skip tile if if does not support closure + if tile_class._closure_directions is None: + skip(f"Tile {tile_name} does not have a closure implementation. Skip") + tile_creator = tile_class() + # Go through all implemented closure directions + for closure_direction in tile_creator._closure_directions: + tile_patches, sensitivities = tile_creator.create_tile( + closure=closure_direction + ) + assert sensitivities is None, ( + f"Expected sensitivities to be None for closure {closure_direction} " + + f"when no sensitivities are requested, got {sensitivities}" + ) + + check_control_points(tile_patches) + + # Also check non-default parameters + # Skip certain classes for testing + if tile_class in skip_tiles: + skip( + "Known issue: skip closure test for non-default parameter for tile " + f"{tile_name}. Reason: {skip_tiles[tile_class]}" + ) + + # Go through all extremes of parameters and ensure that also they create + # tiles within unit square/cube + feasible_parameter_bounds = make_bounds_feasible( + tile_creator._parameter_bounds + ) + all_parameter_bounds = _cartesian_product(feasible_parameter_bounds) + # Go through all implemented closure directions + for closure_direction in tile_creator._closure_directions: + for parameter_extremes in all_parameter_bounds: + tile_patches, _ = tile_creator.create_tile( + parameters=parameter_extremes.reshape( + tile_creator._parameters_shape + ), + closure=closure_direction, + ) + check_control_points(tile_patches) + + +@mark.parametrize("tile_class", tile_classes_with_sensitivities) +def test_tile_derivatives( + tile_class, + np_rng, + heps, + n_test_points, + fd_derivative_stepsizes_and_weights, +): + """Testing the correctness of the tile derivatives using Finite Differences. + This includes every closure and no closure, every parameter and every patch + by evaluating at random points and for random parameters. + + Parameters + --------- + tile_class: tile class in splinepy.microstructure.tiles + Microtile + np_rng: numpy.random._generator.Generator + Default random number generator + heps: float + Perturbation size for finite difference evaluation. Defined in conftest.py + n_test_points: int + Number of testing points in the parametric domain. Defined in conftest.py + fd_derivative_stepsizes_and_weights: dict + Stepsizes and weights for finite difference scheme. Defined in conftest.py + """ + tile_creator = tile_class() + # Skip test if tile class has no implemented sensitivities + if not tile_creator._sensitivities_implemented: + skip(f"Tile {tile_class.__name__} has no sensitivities implemented") + + def generate_random_parameters(tile_creator, np_rng): + """Generate random parameters within bounds""" + parameter_bounds = np.array(tile_creator._parameter_bounds) + parameters = parameter_bounds[:, 0] + np_rng.random( + len(parameter_bounds) + ) * np.ptp(parameter_bounds, axis=1) + return parameters.reshape(tile_creator._parameters_shape) + + parameters = generate_random_parameters(tile_creator, np_rng) + + # Test no closure as well as ... + closure_directions = [None] + # ... every closure implemented + if tile_creator._closure_directions is not None: + closure_directions += tile_creator._closure_directions + + # Retrieve shape values of parameters + n_eval_points = tile_creator._evaluation_points.shape[0] + n_info_per_eval_point = tile_creator._n_info_per_eval_point + + def derivative_finite_difference_evaluation( + tile_creator, parameters, i_parameter, closure, eval_points, n_patches + ): + """Compute the derivative using fourth-order accurate centered finite + differences + + Parameters + ------------ + tile_creator: instance of microtile + Microtile class + parameters: np.ndarray + Tile parameter values + i_parameter: int + Index of parameter, on which the FD derivative calculation should be + performed on + closure: None/str + Closure direction of tile + eval_points: np.ndarray + Evaluation points on where to evaluate the derivative on + n_patches: int + Number of patches of tile + """ + # Initialize array for FD evaluation + fd_sensitivities = np.zeros( + (n_patches, len(eval_points), tile_creator.dim) + ) + + # Go through the + for stepsize, weighting in fd_derivative_stepsizes_and_weights.items(): + # Perturb parameter with respective stepsize + parameters_perturbed = parameters.copy() + parameters_perturbed[:, i_parameter] += stepsize * heps + # Create patches with perturbed parameter value + splines_perturbed, _ = tile_creator.create_tile( + parameters=parameters_perturbed, closure=closure + ) + fd_sensitivities += np.array( + [ + weighting / heps * spl.evaluate(eval_points) + for spl in splines_perturbed + ] + ) + + return fd_sensitivities + + # Test each closure direction + for closure in closure_directions: + # Evaluate tile with given parameter and closure configuration + splines_orig, _ = tile_creator.create_tile( + parameters=parameters, closure=closure + ) + n_patches = len(splines_orig) + # Set evaluation points as random spots in the parametric space + eval_points = np_rng.random((n_test_points, splines_orig[0].para_dim)) + # Go through all the parameters individually + for i_parameter in range(n_info_per_eval_point): + # Get implemented derivatives w.r.t. one parameter + parameter_sensitivities = np.zeros( + (n_eval_points, n_info_per_eval_point, 1) + ) + parameter_sensitivities[:, i_parameter, :] = 1 + _, derivatives = tile_creator.create_tile( + parameters=parameters, + parameter_sensitivities=parameter_sensitivities, + closure=closure, + ) + deriv_evaluations = [ + deriv.evaluate(eval_points) for deriv in derivatives[0] + ] + # Perform finite difference evaluation + fd_sensitivities = derivative_finite_difference_evaluation( + tile_creator, + parameters, + i_parameter, + closure, + eval_points, + n_patches, + ) + # Check every patch + for i_patch, deriv_orig, deriv_fd in zip( + range(n_patches), deriv_evaluations, fd_sensitivities + ): + message = ( + f"Implemented derivative calculation for tile class {tile_class} " + f"with closure {closure}, parameter {i_parameter+1}/" + f"{n_info_per_eval_point} at patch {i_patch+1}/{n_patches} does not" + f" match the derivative obtained using Finite Differences at the " + f"following evaluation points:\n {eval_points}\nImplemented " + f"derivative:\n{deriv_orig}\nFinite Difference derivative:\n" + f"{deriv_fd}" + ) + assert np.allclose(deriv_orig, deriv_fd), message + + +@mark.parametrize("tile_class", all_tile_classes) +def test_invalid_parameter_values(tile_class, big_perturbation): + """Testing whether the tile class correctly raises an error if invalid parameters + are given. Current tests include too low or too high parameter values and wrong + shapes of the parameter array. + + Parameters + ---------- + tile_class: tile class in splinepy.microstructure.tiles + Microtile class + """ + tile_creator = tile_class() + # For certain tiles skip tests + if len(tile_creator._parameter_bounds) == 0: + skip( + f"Skip check for invalid parameters for tile {tile_class.__name__} " + "since there are no parameter bounds implemented for this tile" + ) + + parameter_bounds = np.asarray(tile_creator._parameter_bounds) + + # Check if tile class correctly raises an error if parameter values are too low + parameters_too_low = ( + parameter_bounds[:, 0].reshape(tile_creator._parameters_shape) + - big_perturbation + ) + with raises(ValueError) as exc_info_low: + tile_creator.create_tile(parameters=parameters_too_low) + # Check if the exception message calls TileBase.check_params() + assert "The following parameters are out of bounds: " in str( + exc_info_low.value + ), ( + f"Tile class {tile_class.__name__} must call TileBase.check_params() and raise", + " a ValueError if parameters values are too low", + ) + + # Check the same if parameter values are too high + parameters_too_high = ( + parameter_bounds[:, 1].reshape(tile_creator._parameters_shape) + + big_perturbation + ) + with raises(ValueError) as exc_info_high: + tile_creator.create_tile(parameters=parameters_too_high) + # Check if the exception message calls TileBase.check_params() + assert "The following parameters are out of bounds: " in str( + exc_info_high.value + ), ( + f"Tile class {tile_class.__name__} must call TileBase.check_params() and raise", + " a ValueError if parameters values are too high", + ) + + # Test if error is correctly thrown if the parameter shape is incompatible + # Take parameters in the middle of the bounds and double the array size + parameters_middle = np.mean(parameter_bounds, axis=1).reshape( + tile_creator._parameters_shape + ) + parameters_middle = np.tile(parameters_middle, [2, 1]) + # Check if the error is correctly raised + with raises(TypeError) as exc_info_size: + tile_creator.create_tile(parameters=parameters_middle) + assert "Mismatch in parameter size, expected" in str( + exc_info_size.value + ), ( + f"Tile class {tile_class.__name__} must call TileBase.check_params() and raise", + " a TypeError if the given parameters have the wrong shape", + )