bluemira.builders._varied_offset ================================ .. py:module:: bluemira.builders._varied_offset .. autoapi-nested-parse:: Module containing functions to generate variable offset curves Functions --------- .. autoapisummary:: bluemira.builders._varied_offset.varied_offset bluemira.builders._varied_offset._throw_if_inputs_invalid bluemira.builders._varied_offset._sort_coords_by_angle bluemira.builders._varied_offset._calculate_offset_magnitudes bluemira.builders._varied_offset._calculate_variable_offset_magnitudes bluemira.builders._varied_offset._calculate_normals_2d bluemira.builders._varied_offset._2d_coords_to_wire Module Contents --------------- .. py:function:: varied_offset(wire: bluemira.geometry.wire.BluemiraWire, inboard_offset: float, outboard_offset: float, inboard_offset_degree: float, outboard_offset_degree: float, num_points: int = 200) -> bluemira.geometry.wire.BluemiraWire Create a new wire that offsets the given wire using a variable offset in the xz plane. All angles are measured from the negative x-direction (9 o'clock), centred at the center of mass of the wire. The offset will be 'inboard_offset' between the negative x-direction and 'inboard_offset_degree'. Between 'outboard_offset_degree' and the positive x-direction the offset will be 'outboard_offset'. Between those angles, the offset will linearly transition between the min and max. :param wire: The wire to create the offset from. This should be convex in order to get a sensible, non-intersecting, offset. :param inboard_offset: The size of the offset on the inboard side. :param outboard_offset: The size of the offset on the outboard side. :param inboard_offset_degree: The angle at which the variable offset should begin, in degrees. :param outboard_offset_degree: The angle at which the variable offset should end, in degrees. :param num_points: The number of points to use in the discretisation of the input wire. :returns: New wire at a variable offset to the input. :raises GeometryError: Wire must be planar .. py:function:: _throw_if_inputs_invalid(wire: bluemira.geometry.wire.BluemiraWire, inboard_offset_degree: float, outboard_offset_degree: float) .. py:function:: _sort_coords_by_angle(angles: numpy.typing.NDArray[numpy.float64], coords: numpy.typing.NDArray[numpy.float64]) -> tuple[numpy.typing.NDArray[numpy.float64], numpy.typing.NDArray[numpy.float64]] Sort the given angles and use that to re-order the coords. :returns: * the sorted angles * the coordinates associated with the sorted angles .. py:function:: _calculate_offset_magnitudes(angles: numpy.typing.NDArray[numpy.float64], inboard_offset_degree: float, outboard_offset_degree: float, inboard_offset: float, outboard_offset: float) -> numpy.typing.NDArray[numpy.float64] :returns: The magnitude of the offset at each angle. .. py:function:: _calculate_variable_offset_magnitudes(angles: numpy.typing.NDArray[numpy.float64], start_angle: float, end_angle: float, inboard_offset: float, outboard_offset: float) -> numpy.typing.NDArray[numpy.float64] Calculate the variable offset magnitude for each of the given angles. The offset increases linearly between start_angle and end_angle, between inboard_offset and outboard_offset. :returns: Variable offset angles .. py:function:: _calculate_normals_2d(wire_coords: numpy.typing.NDArray[numpy.float64]) -> numpy.typing.NDArray[numpy.float64] Calculate the unit normals to the tangents at each of the given coordinates. :returns: 2D normals .. rubric:: Notes That this applies an anti-clockwise rotation to the tangents, so to get an outward facing normal to a polygon, the coordinates should be ordered in the clockwise direction. .. py:function:: _2d_coords_to_wire(coords_2d: numpy.typing.NDArray[numpy.float64]) -> bluemira.geometry.wire.BluemiraWire Build a wire from a 2D array of coordinates using a bspline. :returns: the wire