MCPcopy Create free account
hub / github.com/google-deepmind/alphageometry / distance

Method distance

numericals.py:87–94  ·  view source on GitHub ↗
(self, p: Union[Point, Line, Circle])

Source from the content-addressed store, hash-verified

85 return Point(0.5 * (self.x + p.x), 0.5 * (self.y + p.y))
86
87 def distance(self, p: Union[Point, Line, Circle]) -> float:
88 if isinstance(p, Line):
89 return p.distance(self)
90 if isinstance(p, Circle):
91 return abs(p.radius - self.distance(p.center))
92 dx = self.x - p.x
93 dy = self.y - p.y
94 return np.sqrt(dx * dx + dy * dy)
95
96 def distance2(self, p: Point) -> float:
97 if isinstance(p, Line):

Callers 3

footMethod · 0.95
is_sameMethod · 0.95

Calls 1

distanceMethod · 0.45

Tested by 1