Sketch two trisectors of an angle.
(args: tuple[gm.Point, ...])
| 1886 | |
| 1887 | |
| 1888 | def sketch_trisect(args: tuple[gm.Point, ...]) -> tuple[Point, Point]: |
| 1889 | """Sketch two trisectors of an angle.""" |
| 1890 | a, b, c = args |
| 1891 | ang1 = ang_of(b, a) |
| 1892 | ang2 = ang_of(b, c) |
| 1893 | |
| 1894 | swap = 0 |
| 1895 | if ang1 > ang2: |
| 1896 | ang1, ang2 = ang2, ang1 |
| 1897 | swap += 1 |
| 1898 | |
| 1899 | if ang2 - ang1 > np.pi: |
| 1900 | ang1, ang2 = ang2, ang1 + 2 * np.pi |
| 1901 | swap += 1 |
| 1902 | |
| 1903 | angx = ang1 + (ang2 - ang1) / 3 |
| 1904 | angy = ang2 - (ang2 - ang1) / 3 |
| 1905 | |
| 1906 | x = b + Point(np.cos(angx), np.sin(angx)) |
| 1907 | y = b + Point(np.cos(angy), np.sin(angy)) |
| 1908 | |
| 1909 | ac = Line(a, c) |
| 1910 | x = line_line_intersection(Line(b, x), ac) |
| 1911 | y = line_line_intersection(Line(b, y), ac) |
| 1912 | |
| 1913 | if swap == 1: |
| 1914 | return y, x |
| 1915 | return x, y |
| 1916 | |
| 1917 | |
| 1918 | def sketch_trisegment(args: tuple[gm.Point, ...]) -> tuple[Point, Point]: |
nothing calls this directly
no test coverage detected