Conditions | 2 |
Total Lines | 17 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | # Author: Simon Blanke |
||
17 | def get_new_position(self, t): |
||
18 | """ |
||
19 | Calculate a position on the line (vector) between two positions using parameter t. |
||
20 | |||
21 | Parameters: |
||
22 | - t: float, parameter indicating the position along the line (0 <= t <= 1 for within the line segment) |
||
23 | |||
24 | Returns: |
||
25 | - dict representing the new position in the search-space coordinate system |
||
26 | """ |
||
27 | new_position = {} |
||
28 | for dim in self.position_1: |
||
29 | # Calculate the position along the line in each dimension |
||
30 | new_position[dim] = self.position_1[dim] + t * ( |
||
31 | self.position_2[dim] - self.position_1[dim] |
||
32 | ) |
||
33 | return new_position |
||
34 |