quilt_knit.swatch.course_wise_merging.Course_Seam_Search_Space module

Module containing the Course_Seam_Search_Space class.

class Course_Seam_Search_Space(left_swatch, right_swatch)[source]

Bases: Seam_Search_Space

Network of potential linking instructions between swatches to form a vertical seam along the courses.

left_swatch_boundaries_by_course_index

Left-swatch course indices keyed to the boundary of that course.

Type:

dict[int, Course_Boundary_Instruction]

right_swatch_boundaries_by_course_index

Right-swatch boundaries keyed to the boundary of that course.

Type:

dict[int, Course_Boundary_Instruction]

Parameters:
__init__(left_swatch, right_swatch)[source]
Parameters:
property left_swatch: Swatch

Returns: Swatch: The left swatch in the merge.

property right_swatch: Swatch

Returns: Swatch: The right swatch in the merge.

remove_boundaries_beyond_course_connections(course_wise_connection, remove_left_swatch=True, remove_right_swatch=True)[source]

Removes boundary instructions from the search space that occur outside the range of courses in the course-wise connection.

Parameters:
  • course_wise_connection (Course_Wise_Connection) – The connection to narrow the search space to.

  • remove_left_swatch (bool, optional) – Whether to remove boundary instructions in left swatch from the search space. Defaults to True.

  • remove_right_swatch (bool, optional) – Whether to remove boundary instructions in right swatch from the search space. Defaults to True.

Return type:

None

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]

remove_boundary(instruction)

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