Return the mid-point between two points. Args: point1 (Point): The first point. point2 (Point): The second point. Returns: Point: The mid-point between the two points.
(point1: Point, point2: Point)
| 3 | |
| 4 | |
| 5 | def midpoint(point1: Point, point2: Point) -> Point: |
| 6 | ''' |
| 7 | Return the mid-point between two points. |
| 8 | |
| 9 | Args: |
| 10 | point1 (Point): The first point. |
| 11 | point2 (Point): The second point. |
| 12 | |
| 13 | Returns: |
| 14 | Point: The mid-point between the two points. |
| 15 | ''' |
| 16 | if point1.x != None and point2.x != None: |
| 17 | mid_x = (point1.x + point2.x) / 2 |
| 18 | if point1.y != None and point2.y != None: |
| 19 | mid_y = (point1.y + point2.y) / 2 |
| 20 | if point1.z != None and point2.z != None: |
| 21 | mid_z = (point1.z + point2.z) / 2 |
| 22 | return Point(x=mid_x, y=mid_y, z=mid_z) |
| 23 | |
| 24 | |
| 25 | def interpolated_point(point1: Point, point2: Point, interpolation_fraction: float) -> Point: |
no test coverage detected