Translate a predicate from constraint-based to construction-based. Args: point: str: name of the new point name: str: name of the predicate, e.g., perp, para, etc. args: list[str]: list of predicate args. Returns: (name, args): translated to constructive predicate.
(
point: str, name: str, args: list[str]
)
| 232 | |
| 233 | |
| 234 | def translate_constrained_to_constructive( |
| 235 | point: str, name: str, args: list[str] |
| 236 | ) -> tuple[str, list[str]]: |
| 237 | """Translate a predicate from constraint-based to construction-based. |
| 238 | |
| 239 | Args: |
| 240 | point: str: name of the new point |
| 241 | name: str: name of the predicate, e.g., perp, para, etc. |
| 242 | args: list[str]: list of predicate args. |
| 243 | |
| 244 | Returns: |
| 245 | (name, args): translated to constructive predicate. |
| 246 | """ |
| 247 | if name in ['T', 'perp']: |
| 248 | a, b, c, d = args |
| 249 | if point in [c, d]: |
| 250 | a, b, c, d = c, d, a, b |
| 251 | if point == b: |
| 252 | a, b = b, a |
| 253 | if point == d: |
| 254 | c, d = d, c |
| 255 | if a == c and a == point: |
| 256 | return 'on_dia', [a, b, d] |
| 257 | return 'on_tline', [a, b, c, d] |
| 258 | |
| 259 | elif name in ['P', 'para']: |
| 260 | a, b, c, d = args |
| 261 | if point in [c, d]: |
| 262 | a, b, c, d = c, d, a, b |
| 263 | if point == b: |
| 264 | a, b = b, a |
| 265 | return 'on_pline', [a, b, c, d] |
| 266 | |
| 267 | elif name in ['D', 'cong']: |
| 268 | a, b, c, d = args |
| 269 | if point in [c, d]: |
| 270 | a, b, c, d = c, d, a, b |
| 271 | if point == b: |
| 272 | a, b = b, a |
| 273 | if point == d: |
| 274 | c, d = d, c |
| 275 | if a == c and a == point: |
| 276 | return 'on_bline', [a, b, d] |
| 277 | if b in [c, d]: |
| 278 | if b == d: |
| 279 | c, d = d, c # pylint: disable=unused-variable |
| 280 | return 'on_circle', [a, b, d] |
| 281 | return 'eqdistance', [a, b, c, d] |
| 282 | |
| 283 | elif name in ['C', 'coll']: |
| 284 | a, b, c = args |
| 285 | if point == b: |
| 286 | a, b = b, a |
| 287 | if point == c: |
| 288 | a, b, c = c, a, b |
| 289 | return 'on_line', [a, b, c] |
| 290 | |
| 291 | elif name in ['^', 'eqangle']: |
no outgoing calls
no test coverage detected