MCPcopy Create free account
hub / github.com/FullControlXYZ/fullcontrol / midpoint

Function midpoint

fullcontrol/geometry/midpoint.py:5–22  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

3
4
5def 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
25def interpolated_point(point1: Point, point2: Point, interpolation_fraction: float) -> Point:

Callers 2

convex_segmentFunction · 0.90
convex_segment_and_speedFunction · 0.90

Calls 1

PointClass · 0.50

Tested by

no test coverage detected