| 191 | |
| 192 | |
| 193 | def test_normals(): |
| 194 | |
| 195 | r1 = 10 |
| 196 | r2 = 1 |
| 197 | |
| 198 | t = torus(2 * r1, 2 * r2).faces() |
| 199 | |
| 200 | n1 = t.normalAt((r1, 0, r2)) |
| 201 | n2 = t.normalAt((r1 + r2, 0)) |
| 202 | |
| 203 | assert n1.toTuple() == approx((0, 0, 1)) |
| 204 | assert n2.toTuple() == approx((1, 0, 0)) |
| 205 | |
| 206 | n3, p3 = t.normalAt(0, 0) |
| 207 | |
| 208 | assert n3.toTuple() == approx((1, 0, 0)) |
| 209 | assert p3.toTuple() == approx((r1 + r2, 0, 0)) |
| 210 | |
| 211 | (n4, n5), _ = t.normals((0, 0), (0, pi / 2)) |
| 212 | |
| 213 | assert n4.toTuple() == approx((1, 0, 0)) |
| 214 | assert n5.toTuple() == approx((0, 0, 1)) |
| 215 | |
| 216 | |
| 217 | def test_trimming(): |