Skip to content

DivisionSystem

Jonathan edited this page Apr 9, 2024 · 1 revision

Class DivisionSystem

The DivisionSystem class manages division systems, providing functionalities to calculate divisions and spacings based on various criteria.

Constructor

__init__(self)

Initializes a new DivisionSystem instance.

    - `type` (str): The class name, "DivisionSystem".
    - `name` (str): The name of the division system.
    - `id` (str): A unique identifier for the division system instance.
    - `system_length` (float): The total length of the system to be divided.
    - `spacing` (float): The spacing between divisions.
    - `distance_first` (float): The distance of the first division from the start of the system.
    - `width_stud` (float): The width of a stud, applicable in certain division strategies.
    - `fixed_number` (int): A fixed number of divisions.
    - `modifier` (int): A modifier value that adjusts the number of divisions or their placement.
    - `distances` (list): A list containing the cumulative distances of each division from the start.
    - `spaces` (list): A list containing the spaces between each division.
    - `system` (str): A string indicating the current system strategy (e.g., "fixed_distance_unequal_division").

Methods

  • _DivisionSystem__fixed_distance_equal_division(self): Creates divisions with equal spacing across the total system length. An internal method that evenly distributes divisions across the system's length. It takes into account the total length and the desired spacing to calculate the number of divisions, ensuring they are equally spaced.

  • _DivisionSystem__fixed_distance_unequal_division(self): Configures divisions with a fixed starting distance followed by unequal divisions. This internal method configures the division system to start with a specified distance for the first division, then continues with divisions spaced according to spacing. If the total length cannot be evenly divided, the last division's spacing may differ.

  • _DivisionSystem__fixed_number_equal_spacing(self): Calculates divisions based on a fixed number with equal spacing. This internal method sets up divisions across the system length, ensuring each division is equally spaced. It is triggered by configurations that require a fixed number of divisions, automatically adjusting the spacing to fit the total length.

  • by_fixed_distance_equal_division(self, length: float, spacing: float, modifier: int) -> DivisionSystem: Configures the division system for equal divisions with fixed spacing. This method sets up the division system to calculate divisions based on a fixed spacing between each division across the total system length. The modifier can adjust the calculation slightly but maintains equal spacing.

  • by_fixed_distance_unequal_division(self, length: float, spacing: float, distance_first: float, modifier: int) -> DivisionSystem: Configures the division system for unequal divisions with a specified distance first. This method sets up the division system to calculate divisions based on a fixed initial distance, followed by unevenly spaced divisions according to the specified parameters.

  • by_fixed_number_equal_spacing(self, length: float, number: int) -> DivisionSystem: Establishes the division system for a fixed number of divisions with equal spacing. This method arranges for a certain number of divisions to be spaced equally across the system length. It calculates the required spacing based on the total length and desired number of divisions.

Documentation

_DivisionSystem__fixed_distance_equal_division(self)

Creates divisions with equal spacing across the total system length. An internal method that evenly distributes divisions across the system's length. It takes into account the total length and the desired spacing to calculate the number of divisions, ensuring they are equally spaced.

Effects:

  • Sets the division system name to "fixed_distance_equal_division".
  • Calculates the number of divisions based on the desired spacing and total length.
  • Determines the starting distance for the first division to ensure all divisions, including the first and last, are equally spaced within the system length.

_DivisionSystem__fixed_distance_unequal_division(self)

Configures divisions with a fixed starting distance followed by unequal divisions. This internal method configures the division system to start with a specified distance for the first division, then continues with divisions spaced according to spacing. If the total length cannot be evenly divided, the last division's spacing may differ.

Effects:

  • Sets the division system name to "fixed_distance_unequal_division".
  • Calculates the number of divisions based on the spacing and the total system length minus the first division's distance.
  • Generates a list of distances where each division should occur, considering the initial distance and spacing.

_DivisionSystem__fixed_number_equal_spacing(self)

Calculates divisions based on a fixed number with equal spacing. This internal method sets up divisions across the system length, ensuring each division is equally spaced. It is triggered by configurations that require a fixed number of divisions, automatically adjusting the spacing to fit the total length.

Effects:

  • Sets the division system name to "fixed_number_equal_spacing".
  • Calculates equal spacing between divisions based on the total system length and the fixed number of divisions.
  • Resets the modifier to 0, as it is not applicable in this configuration.
  • Assigns the calculated spacing to distance_first to maintain consistency at the start of the system.

by_fixed_distance_equal_division(self, length: float, spacing: float, modifier: int) -> DivisionSystem

Configures the division system for equal divisions with fixed spacing. This method sets up the division system to calculate divisions based on a fixed spacing between each division across the total system length. The modifier can adjust the calculation slightly but maintains equal spacing.

Parameters:

  • length (float): The total length of the system to be divided.
  • spacing (float): The spacing between each division.
  • modifier (int): An integer modifier to fine-tune the division process.

Returns:

DivisionSystem: The instance itself, updated with the new division configuration.

Example usage:

division_system = DivisionSystem()
division_system.by_fixed_distance_equal_division(100, 10, 0)

by_fixed_distance_unequal_division(self, length: float, spacing: float, distance_first: float, modifier: int) -> DivisionSystem

Configures the division system for unequal divisions with a specified distance first. This method sets up the division system to calculate divisions based on a fixed initial distance, followed by unevenly spaced divisions according to the specified parameters.

Parameters:

  • length (float): The total length of the system to be divided.
  • spacing (float): The target spacing between divisions.
  • distance_first (float): The distance of the first division from the system's start.
  • modifier (int): An integer modifier to adjust the calculation of divisions.

Returns:

DivisionSystem: The instance itself, updated with the new division configuration.

Example usage:

division_system = DivisionSystem()
division_system.by_fixed_distance_unequal_division(100, 10, 5, 0)

by_fixed_number_equal_spacing(self, length: float, number: int) -> DivisionSystem

Establishes the division system for a fixed number of divisions with equal spacing. This method arranges for a certain number of divisions to be spaced equally across the system length. It calculates the required spacing based on the total length and desired number of divisions.

Parameters:

  • length (float): The total length of the system to be divided.
  • number (int): The fixed number of divisions to be created.

Returns:

DivisionSystem: The instance itself, updated with the new division configuration.

Example usage:

division_system = DivisionSystem()
division_system.by_fixed_number_equal_spacing(100, 5)