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

Method check_rconst

graph.py:2244–2267  ·  view source on GitHub ↗

Check whether a ratio is equal to some given constant.

(self, points: list[Point], verbose: bool = False)

Source from the content-addressed store, hash-verified

2242 return add
2243
2244 def check_rconst(self, points: list[Point], verbose: bool = False) -> bool:
2245 """Check whether a ratio is equal to some given constant."""
2246 _ = verbose
2247 a, b, c, d, nd = points
2248 if isinstance(nd, str):
2249 name = nd
2250 else:
2251 name = nd.name
2252 num, den = name.split('/')
2253 rat, _ = self.get_or_create_const_rat(int(num), int(den))
2254
2255 ab = self._get_segment(a, b)
2256 cd = self._get_segment(c, d)
2257
2258 if not ab or not cd:
2259 return False
2260
2261 if not (ab.val and cd.val):
2262 return False
2263
2264 for rat1, _, _ in gm.all_ratios(ab._val, cd._val):
2265 if self.is_equal(rat1, rat):
2266 return True
2267 return False
2268
2269 def check_rcompute(self, points: list[Point]) -> bool:
2270 """Check whether a ratio is equal to some constant."""

Callers 1

checkMethod · 0.95

Calls 3

_get_segmentMethod · 0.95
is_equalMethod · 0.95

Tested by

no test coverage detected