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

Method check_aconst

graph.py:1953–1975  ·  view source on GitHub ↗

Check if the angle is equal to a certain constant.

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

Source from the content-addressed store, hash-verified

1951 return add
1952
1953 def check_aconst(self, points: list[Point], verbose: bool = False) -> bool:
1954 """Check if the angle is equal to a certain constant."""
1955 a, b, c, d, nd = points
1956 _ = verbose
1957 if isinstance(nd, str):
1958 name = nd
1959 else:
1960 name = nd.name
1961 num, den = name.split('pi/')
1962 ang, _ = self.get_or_create_const_ang(int(num), int(den))
1963
1964 ab = self._get_line(a, b)
1965 cd = self._get_line(c, d)
1966 if not ab or not cd:
1967 return False
1968
1969 if not (ab.val and cd.val):
1970 return False
1971
1972 for ang1, _, _ in gm.all_angles(ab._val, cd._val):
1973 if self.is_equal(ang1, ang):
1974 return True
1975 return False
1976
1977 def check_acompute(self, points: list[Point]) -> bool:
1978 """Check if an angle has a constant value."""

Callers 1

checkMethod · 0.95

Calls 3

_get_lineMethod · 0.95
is_equalMethod · 0.95

Tested by

no test coverage detected