quilt_knit.swatch.wale_wise_merging.Wale_Seam_Search_Space module

Module containing the Wale_Seam_Search_Space class.

class Wale_Seam_Search_Space(bottom_swatch, top_swatch, max_rack=2)[source]

Bases: Seam_Search_Space

Network of potential linking instructions between swatches to form a horizontal seam.

exit_instructions

The set of wale boundary instructions that exit the bottom swatch.

Type:

set[Wale_Boundary_Instruction]

entrance_instructions

The set of wale boundary instructions that enter the top swatch.

Type:

set[Wale_Boundary_Instruction]

Parameters:
__init__(bottom_swatch, top_swatch, max_rack=2)[source]

Initializes the Wale_Seam_Search_Space between the bottom and top swatches. :type bottom_swatch: Swatch :param bottom_swatch: The bottom swatch to be merged from. :type bottom_swatch: Swatch :type top_swatch: Swatch :param top_swatch: The top swatch to be merged to. :type top_swatch: Swatch :type max_rack: int :param max_rack: The maximum racking alignment allowed to form a connection. Defaults to 2. :type max_rack: int, optional

property bottom_swatch: Swatch

Returns: Swatch: The bottom swatch in the merge.

property top_swatch: Swatch

Returns: Swatch: The top swatch in the merge.

clean_connections()[source]

Remove all boundary instructions from the search space that cannot form a connection.

Returns:

All boundary instructions that were removed by this process.

Return type:

list[Wale_Boundary_Instruction]

remove_boundary(instruction)[source]

Removes any boundary instruction associated with the given instruction from the search space. If the instruction does not belong to a boundary, nothing happens.

Parameters:

instruction (Knitout_Line) – The boundary instruction to remove from the search space.

Returns:

The boundary instruction that was removed or None, if no boundary was found by that instruction.

Return type:

Swatch_Boundary_Instruction | None

remove_excluded_boundary(connection)[source]

Remove the boundary instructions in the search space that fall outside the boundary interval defined by the given Wale Wise connection. :type connection: Wale_Wise_Connection :param connection: The wale wise connection interval to exclude boundary instructions outside its connection interval. :type connection: Wale_Seam_Connection

Return type:

None

needed_instructions(exit_instruction, entrance_instruction)[source]
Parameters:
Returns:

The number of instructions needed to connect the exit and entrance instructions.

Return type:

int

available_connections(boundary_instruction)
Parameters:

boundary_instruction (Wale_Boundary_Instruction) – The boundary instruction to find the available connections to.

Returns:

A list of all available connections to the given instruction. If this is an exit, only entrance instructions will be returned. If it is an entrance, only exits will be returned.

Return type:

set[Seam_Connection]