vecview 0.5.0__tar.gz → 0.6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. {vecview-0.5.0 → vecview-0.6.0}/CHANGELOG.md +14 -0
  2. {vecview-0.5.0 → vecview-0.6.0}/PKG-INFO +21 -17
  3. {vecview-0.5.0 → vecview-0.6.0}/README.md +19 -16
  4. {vecview-0.5.0 → vecview-0.6.0}/docs/development.md +2 -2
  5. {vecview-0.5.0 → vecview-0.6.0}/docs/gallery/aharonov_bohm_ring.svg +4 -4
  6. {vecview-0.5.0 → vecview-0.6.0}/docs/gallery/altermagnetic_dot.svg +1 -1
  7. {vecview-0.5.0 → vecview-0.6.0}/docs/gallery/bloch_sphere.svg +1 -1
  8. {vecview-0.5.0 → vecview-0.6.0}/docs/gallery/brillouin_zone.svg +1 -1
  9. {vecview-0.5.0 → vecview-0.6.0}/docs/gallery/dirac_cone.svg +1 -1
  10. {vecview-0.5.0 → vecview-0.6.0}/docs/gallery/fullerene.svg +1 -1
  11. {vecview-0.5.0 → vecview-0.6.0}/docs/gallery/kitaev_chain.svg +1 -1
  12. {vecview-0.5.0 → vecview-0.6.0}/docs/gallery/mirror_planes.svg +1 -1
  13. {vecview-0.5.0 → vecview-0.6.0}/docs/gallery/perovskite.svg +1 -1
  14. {vecview-0.5.0 → vecview-0.6.0}/docs/gallery/skyrmion.svg +1 -1
  15. {vecview-0.5.0 → vecview-0.6.0}/docs/gallery/slab_polarizer.svg +1 -1
  16. {vecview-0.5.0 → vecview-0.6.0}/docs/gallery/solenoid.svg +1 -1
  17. {vecview-0.5.0 → vecview-0.6.0}/docs/index.md +1 -1
  18. {vecview-0.5.0 → vecview-0.6.0}/docs/scenes.md +28 -0
  19. {vecview-0.5.0 → vecview-0.6.0}/docs/shapes.md +5 -3
  20. {vecview-0.5.0 → vecview-0.6.0}/examples/aharonov_bohm_ring.py +7 -12
  21. {vecview-0.5.0 → vecview-0.6.0}/pyproject.toml +2 -1
  22. {vecview-0.5.0 → vecview-0.6.0}/src/vecview/__init__.py +1 -1
  23. {vecview-0.5.0 → vecview-0.6.0}/src/vecview/_canvas.py +40 -1
  24. {vecview-0.5.0 → vecview-0.6.0}/src/vecview/_drawing.py +57 -1
  25. {vecview-0.5.0 → vecview-0.6.0}/src/vecview/_place.py +4 -0
  26. {vecview-0.5.0 → vecview-0.6.0}/src/vecview/_vec.py +24 -0
  27. {vecview-0.5.0 → vecview-0.6.0}/tests/test_arrows.py +112 -1
  28. {vecview-0.5.0 → vecview-0.6.0}/.gitignore +0 -0
  29. {vecview-0.5.0 → vecview-0.6.0}/AGENTS.md +0 -0
  30. {vecview-0.5.0 → vecview-0.6.0}/LICENSE +0 -0
  31. {vecview-0.5.0 → vecview-0.6.0}/docs/animation.md +0 -0
  32. {vecview-0.5.0 → vecview-0.6.0}/docs/cameras.md +0 -0
  33. {vecview-0.5.0 → vecview-0.6.0}/docs/embedding.md +0 -0
  34. {vecview-0.5.0 → vecview-0.6.0}/docs/gallery.md +0 -0
  35. {vecview-0.5.0 → vecview-0.6.0}/docs/images/readme.svg +0 -0
  36. {vecview-0.5.0 → vecview-0.6.0}/docs/outlines.md +0 -0
  37. {vecview-0.5.0 → vecview-0.6.0}/docs/readme_figure.py +0 -0
  38. {vecview-0.5.0 → vecview-0.6.0}/examples/README.md +0 -0
  39. {vecview-0.5.0 → vecview-0.6.0}/examples/__main__.py +0 -0
  40. {vecview-0.5.0 → vecview-0.6.0}/examples/altermagnetic_dot.py +0 -0
  41. {vecview-0.5.0 → vecview-0.6.0}/examples/bloch_sphere.py +0 -0
  42. {vecview-0.5.0 → vecview-0.6.0}/examples/brillouin_zone.py +0 -0
  43. {vecview-0.5.0 → vecview-0.6.0}/examples/dirac_cone.py +0 -0
  44. {vecview-0.5.0 → vecview-0.6.0}/examples/fullerene.py +0 -0
  45. {vecview-0.5.0 → vecview-0.6.0}/examples/kitaev_chain.py +0 -0
  46. {vecview-0.5.0 → vecview-0.6.0}/examples/mirror_planes.py +0 -0
  47. {vecview-0.5.0 → vecview-0.6.0}/examples/pendulum.py +0 -0
  48. {vecview-0.5.0 → vecview-0.6.0}/examples/perovskite.py +0 -0
  49. {vecview-0.5.0 → vecview-0.6.0}/examples/rotating_dipole.py +0 -0
  50. {vecview-0.5.0 → vecview-0.6.0}/examples/skyrmion.py +0 -0
  51. {vecview-0.5.0 → vecview-0.6.0}/examples/slab_polarizer.py +0 -0
  52. {vecview-0.5.0 → vecview-0.6.0}/examples/solenoid.py +0 -0
  53. {vecview-0.5.0 → vecview-0.6.0}/src/vecview/_animation_refs.py +0 -0
  54. {vecview-0.5.0 → vecview-0.6.0}/src/vecview/_animation_svg.py +0 -0
  55. {vecview-0.5.0 → vecview-0.6.0}/src/vecview/_cut.py +0 -0
  56. {vecview-0.5.0 → vecview-0.6.0}/src/vecview/_elements.py +0 -0
  57. {vecview-0.5.0 → vecview-0.6.0}/src/vecview/_face.py +0 -0
  58. {vecview-0.5.0 → vecview-0.6.0}/src/vecview/_line_art.py +0 -0
  59. {vecview-0.5.0 → vecview-0.6.0}/src/vecview/_numeric.py +0 -0
  60. {vecview-0.5.0 → vecview-0.6.0}/src/vecview/_occlusion.py +0 -0
  61. {vecview-0.5.0 → vecview-0.6.0}/src/vecview/_planar.py +0 -0
  62. {vecview-0.5.0 → vecview-0.6.0}/src/vecview/_solid_drawing.py +0 -0
  63. {vecview-0.5.0 → vecview-0.6.0}/src/vecview/_solids.py +0 -0
  64. {vecview-0.5.0 → vecview-0.6.0}/src/vecview/_tracks.py +0 -0
  65. {vecview-0.5.0 → vecview-0.6.0}/src/vecview/_transforms.py +0 -0
  66. {vecview-0.5.0 → vecview-0.6.0}/src/vecview/_types.py +0 -0
  67. {vecview-0.5.0 → vecview-0.6.0}/src/vecview/animation.py +0 -0
  68. {vecview-0.5.0 → vecview-0.6.0}/src/vecview/camera.py +0 -0
  69. {vecview-0.5.0 → vecview-0.6.0}/src/vecview/outlines.py +0 -0
  70. {vecview-0.5.0 → vecview-0.6.0}/src/vecview/projections.py +0 -0
  71. {vecview-0.5.0 → vecview-0.6.0}/src/vecview/py.typed +0 -0
  72. {vecview-0.5.0 → vecview-0.6.0}/src/vecview/scene.py +0 -0
  73. {vecview-0.5.0 → vecview-0.6.0}/src/vecview/shapes.py +0 -0
  74. {vecview-0.5.0 → vecview-0.6.0}/tests/test_animation.py +0 -0
  75. {vecview-0.5.0 → vecview-0.6.0}/tests/test_camera.py +0 -0
  76. {vecview-0.5.0 → vecview-0.6.0}/tests/test_document.py +0 -0
  77. {vecview-0.5.0 → vecview-0.6.0}/tests/test_occlusion.py +0 -0
  78. {vecview-0.5.0 → vecview-0.6.0}/tests/test_outlines.py +0 -0
  79. {vecview-0.5.0 → vecview-0.6.0}/tests/test_package_metadata.py +0 -0
  80. {vecview-0.5.0 → vecview-0.6.0}/tests/test_parts.py +0 -0
  81. {vecview-0.5.0 → vecview-0.6.0}/tests/test_planes.py +0 -0
  82. {vecview-0.5.0 → vecview-0.6.0}/tests/test_projections.py +0 -0
  83. {vecview-0.5.0 → vecview-0.6.0}/tests/test_regions.py +0 -0
  84. {vecview-0.5.0 → vecview-0.6.0}/tests/test_scene.py +0 -0
  85. {vecview-0.5.0 → vecview-0.6.0}/tests/test_shapes.py +0 -0
  86. {vecview-0.5.0 → vecview-0.6.0}/tests/test_solids.py +0 -0
  87. {vecview-0.5.0 → vecview-0.6.0}/tests/test_tracked_scenes.py +0 -0
  88. {vecview-0.5.0 → vecview-0.6.0}/zensical.toml +0 -0
@@ -5,6 +5,20 @@ All notable changes to this project are documented here, following
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [0.6.0] - 2026-11-27
9
+
10
+ ### Added
11
+
12
+ - `Scene.line_arrow(layer, path, normal=..., head_w=..., head_len=..., at=1.0)`
13
+ draws a stroked line with a flat head on it, filled with the line's stroke.
14
+ The head takes `head_len` of the path and points along it, at the end (where
15
+ the line stops at its base) or partway (`at=0.5`, line running through), in
16
+ the plane of `normal` or facing the camera. A curved arrow no longer needs a
17
+ head faked with `arrow(shaft_w=0)` and a tangent worked out by hand, which
18
+ also left a zero-width shaft in the polygon.
19
+ - Python 3.15 is supported and tested in CI, beside 3.12 to 3.14. The
20
+ development lock takes shapely 2.2, the first release with 3.15 wheels.
21
+
8
22
  ## [0.5.0] - 2026-11-09
9
23
 
10
24
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vecview
3
- Version: 0.5.0
3
+ Version: 0.6.0
4
4
  Summary: Layered 3D scenes that render to SVG, for scientific schematics
5
5
  Project-URL: Source, https://github.com/maiani/vecview
6
6
  Project-URL: Issues, https://github.com/maiani/vecview/issues
@@ -16,6 +16,7 @@ Classifier: Programming Language :: Python :: 3 :: Only
16
16
  Classifier: Programming Language :: Python :: 3.12
17
17
  Classifier: Programming Language :: Python :: 3.13
18
18
  Classifier: Programming Language :: Python :: 3.14
19
+ Classifier: Programming Language :: Python :: 3.15
19
20
  Classifier: Topic :: Multimedia :: Graphics :: 3D Rendering
20
21
  Classifier: Topic :: Scientific/Engineering :: Visualization
21
22
  Classifier: Typing :: Typed
@@ -36,10 +37,10 @@ stays editable afterwards: elements keep the ids you give them, the same scene
36
37
  renders to byte-identical SVG, and the output opens in Inkscape.
37
38
 
38
39
  <p align="center">
39
- <img src="https://raw.githubusercontent.com/maiani/vecview/v0.5.0/docs/images/readme.svg" alt="A gate-defined quantum dot on a layered slab, with leads, gates, spin densities and a bias circuit" width="640">
40
+ <img src="https://raw.githubusercontent.com/maiani/vecview/v0.6.0/docs/images/readme.svg" alt="A gate-defined quantum dot on a layered slab, with leads, gates, spin densities and a bias circuit" width="640">
40
41
  </p>
41
42
 
42
- <p align="center"><sub>A device sketch: layered solids, Gaussian densities, camera-facing arrows and a circuit, from <code>examples/altermagnetic_dot.py</code>. More in the <a href="https://github.com/maiani/vecview/blob/v0.5.0/docs/gallery.md">gallery</a>.</sub></p>
43
+ <p align="center"><sub>A device sketch: layered solids, Gaussian densities, camera-facing arrows and a circuit, from <code>examples/altermagnetic_dot.py</code>. More in the <a href="https://github.com/maiani/vecview/blob/v0.6.0/docs/gallery.md">gallery</a>.</sub></p>
43
44
 
44
45
  VecView is a small projection layer on top of
45
46
  [`svg.py`](https://pypi.org/project/svg.py/). `svg.py` builds the elements;
@@ -51,7 +52,7 @@ VecView is alpha: the API may change before 1.0.
51
52
 
52
53
  ## Install
53
54
 
54
- Install VecView with pip (Python 3.12 or newer; tested on 3.12–3.14):
55
+ Install VecView with pip (Python 3.12 or newer; tested on 3.12–3.15):
55
56
 
56
57
  ```bash
57
58
  python -m pip install vecview
@@ -142,6 +143,9 @@ World-space calls on `Scene`:
142
143
  - `arrow(..., normal="camera")` turns an arrow about its own axis to show its
143
144
  widest face, resolved by the camera that renders, so every camera sees it. An explicit
144
145
  normal also works.
146
+ - `line_arrow(layer, path, ...)` puts a flat head on a stroked line, at its end
147
+ or partway along (`at=0.5`), pointing along the path, so a curve needs no
148
+ tangent worked out by hand.
145
149
  - `silhouette(layer, solid)` fills the projected convex hull of a solid as one
146
150
  polygon. Drawn in the wall colour under the cap, it removes the hairline seams
147
151
  between per-wall polygons.
@@ -266,7 +270,7 @@ scene.slot(
266
270
  a string, rendered by the active camera. That method is the whole embedding
267
271
  contract: any tool that accepts an object exposing it can place a scene, without
268
272
  VecView knowing about the tool. The fitted viewBox usually does *not* start at
269
- `0, 0`, so a consumer must honour its origin. See [Embedding a scene](https://github.com/maiani/vecview/blob/v0.5.0/docs/embedding.md).
273
+ `0, 0`, so a consumer must honour its origin. See [Embedding a scene](https://github.com/maiani/vecview/blob/v0.6.0/docs/embedding.md).
270
274
 
271
275
  In Jupyter a scene displays itself inline. Rasterizing and PDF export are out of
272
276
  scope; they belong to whatever assembles the final page.
@@ -288,11 +292,11 @@ vecview.Animation(scene, duration=6.283, view_box=(-150, -110, 300, 220)).save("
288
292
 
289
293
  `Track` with keyframes and easing, turning parts about a pivot, and frame
290
294
  callbacks for anything else are in `vecview.animation`; see the [animation
291
- guide](https://github.com/maiani/vecview/blob/v0.5.0/docs/animation.md).
295
+ guide](https://github.com/maiani/vecview/blob/v0.6.0/docs/animation.md).
292
296
 
293
297
  ## Examples
294
298
 
295
- The [gallery](https://github.com/maiani/vecview/blob/v0.5.0/docs/gallery.md) has the static figures everyone draws — a perovskite
299
+ The [gallery](https://github.com/maiani/vecview/blob/v0.6.0/docs/gallery.md) has the static figures everyone draws — a perovskite
296
300
  cell, the fcc Brillouin zone, C60, the Bloch sphere, a Dirac cone, a skyrmion, a
297
301
  solenoid, crossing mirror planes, an Aharonov–Bohm ring, and two device sketches — and two
298
302
  animations, a pendulum and a rotating dipole radiating. Each is one
@@ -307,7 +311,7 @@ uv run python examples/slab_polarizer.py --projection all # all five
307
311
  uv run python examples/altermagnetic_dot.py --projection all # a device sketch, under four cameras
308
312
  ```
309
313
 
310
- See [examples/README.md](https://github.com/maiani/vecview/blob/v0.5.0/examples/README.md) for the full list and what each
314
+ See [examples/README.md](https://github.com/maiani/vecview/blob/v0.6.0/examples/README.md) for the full list and what each
311
315
  needs; several typeset their labels with
312
316
  [VecTeX](https://github.com/maiani/vectex), which needs TeX.
313
317
 
@@ -343,15 +347,15 @@ VecView depends on none of them and contains no code specific to any of them.
343
347
 
344
348
  ## Documentation
345
349
 
346
- - [Overview](https://github.com/maiani/vecview/blob/v0.5.0/docs/index.md)
347
- - [Cameras](https://github.com/maiani/vecview/blob/v0.5.0/docs/cameras.md)
348
- - [Scenes and layers](https://github.com/maiani/vecview/blob/v0.5.0/docs/scenes.md)
349
- - [Shapes](https://github.com/maiani/vecview/blob/v0.5.0/docs/shapes.md)
350
- - [Outlines](https://github.com/maiani/vecview/blob/v0.5.0/docs/outlines.md)
351
- - [Animation](https://github.com/maiani/vecview/blob/v0.5.0/docs/animation.md)
352
- - [Gallery](https://github.com/maiani/vecview/blob/v0.5.0/docs/gallery.md)
353
- - [Embedding a scene](https://github.com/maiani/vecview/blob/v0.5.0/docs/embedding.md)
354
- - [Development](https://github.com/maiani/vecview/blob/v0.5.0/docs/development.md)
350
+ - [Overview](https://github.com/maiani/vecview/blob/v0.6.0/docs/index.md)
351
+ - [Cameras](https://github.com/maiani/vecview/blob/v0.6.0/docs/cameras.md)
352
+ - [Scenes and layers](https://github.com/maiani/vecview/blob/v0.6.0/docs/scenes.md)
353
+ - [Shapes](https://github.com/maiani/vecview/blob/v0.6.0/docs/shapes.md)
354
+ - [Outlines](https://github.com/maiani/vecview/blob/v0.6.0/docs/outlines.md)
355
+ - [Animation](https://github.com/maiani/vecview/blob/v0.6.0/docs/animation.md)
356
+ - [Gallery](https://github.com/maiani/vecview/blob/v0.6.0/docs/gallery.md)
357
+ - [Embedding a scene](https://github.com/maiani/vecview/blob/v0.6.0/docs/embedding.md)
358
+ - [Development](https://github.com/maiani/vecview/blob/v0.6.0/docs/development.md)
355
359
 
356
360
  ## License
357
361
 
@@ -6,10 +6,10 @@ stays editable afterwards: elements keep the ids you give them, the same scene
6
6
  renders to byte-identical SVG, and the output opens in Inkscape.
7
7
 
8
8
  <p align="center">
9
- <img src="https://raw.githubusercontent.com/maiani/vecview/v0.5.0/docs/images/readme.svg" alt="A gate-defined quantum dot on a layered slab, with leads, gates, spin densities and a bias circuit" width="640">
9
+ <img src="https://raw.githubusercontent.com/maiani/vecview/v0.6.0/docs/images/readme.svg" alt="A gate-defined quantum dot on a layered slab, with leads, gates, spin densities and a bias circuit" width="640">
10
10
  </p>
11
11
 
12
- <p align="center"><sub>A device sketch: layered solids, Gaussian densities, camera-facing arrows and a circuit, from <code>examples/altermagnetic_dot.py</code>. More in the <a href="https://github.com/maiani/vecview/blob/v0.5.0/docs/gallery.md">gallery</a>.</sub></p>
12
+ <p align="center"><sub>A device sketch: layered solids, Gaussian densities, camera-facing arrows and a circuit, from <code>examples/altermagnetic_dot.py</code>. More in the <a href="https://github.com/maiani/vecview/blob/v0.6.0/docs/gallery.md">gallery</a>.</sub></p>
13
13
 
14
14
  VecView is a small projection layer on top of
15
15
  [`svg.py`](https://pypi.org/project/svg.py/). `svg.py` builds the elements;
@@ -21,7 +21,7 @@ VecView is alpha: the API may change before 1.0.
21
21
 
22
22
  ## Install
23
23
 
24
- Install VecView with pip (Python 3.12 or newer; tested on 3.12–3.14):
24
+ Install VecView with pip (Python 3.12 or newer; tested on 3.12–3.15):
25
25
 
26
26
  ```bash
27
27
  python -m pip install vecview
@@ -112,6 +112,9 @@ World-space calls on `Scene`:
112
112
  - `arrow(..., normal="camera")` turns an arrow about its own axis to show its
113
113
  widest face, resolved by the camera that renders, so every camera sees it. An explicit
114
114
  normal also works.
115
+ - `line_arrow(layer, path, ...)` puts a flat head on a stroked line, at its end
116
+ or partway along (`at=0.5`), pointing along the path, so a curve needs no
117
+ tangent worked out by hand.
115
118
  - `silhouette(layer, solid)` fills the projected convex hull of a solid as one
116
119
  polygon. Drawn in the wall colour under the cap, it removes the hairline seams
117
120
  between per-wall polygons.
@@ -236,7 +239,7 @@ scene.slot(
236
239
  a string, rendered by the active camera. That method is the whole embedding
237
240
  contract: any tool that accepts an object exposing it can place a scene, without
238
241
  VecView knowing about the tool. The fitted viewBox usually does *not* start at
239
- `0, 0`, so a consumer must honour its origin. See [Embedding a scene](https://github.com/maiani/vecview/blob/v0.5.0/docs/embedding.md).
242
+ `0, 0`, so a consumer must honour its origin. See [Embedding a scene](https://github.com/maiani/vecview/blob/v0.6.0/docs/embedding.md).
240
243
 
241
244
  In Jupyter a scene displays itself inline. Rasterizing and PDF export are out of
242
245
  scope; they belong to whatever assembles the final page.
@@ -258,11 +261,11 @@ vecview.Animation(scene, duration=6.283, view_box=(-150, -110, 300, 220)).save("
258
261
 
259
262
  `Track` with keyframes and easing, turning parts about a pivot, and frame
260
263
  callbacks for anything else are in `vecview.animation`; see the [animation
261
- guide](https://github.com/maiani/vecview/blob/v0.5.0/docs/animation.md).
264
+ guide](https://github.com/maiani/vecview/blob/v0.6.0/docs/animation.md).
262
265
 
263
266
  ## Examples
264
267
 
265
- The [gallery](https://github.com/maiani/vecview/blob/v0.5.0/docs/gallery.md) has the static figures everyone draws — a perovskite
268
+ The [gallery](https://github.com/maiani/vecview/blob/v0.6.0/docs/gallery.md) has the static figures everyone draws — a perovskite
266
269
  cell, the fcc Brillouin zone, C60, the Bloch sphere, a Dirac cone, a skyrmion, a
267
270
  solenoid, crossing mirror planes, an Aharonov–Bohm ring, and two device sketches — and two
268
271
  animations, a pendulum and a rotating dipole radiating. Each is one
@@ -277,7 +280,7 @@ uv run python examples/slab_polarizer.py --projection all # all five
277
280
  uv run python examples/altermagnetic_dot.py --projection all # a device sketch, under four cameras
278
281
  ```
279
282
 
280
- See [examples/README.md](https://github.com/maiani/vecview/blob/v0.5.0/examples/README.md) for the full list and what each
283
+ See [examples/README.md](https://github.com/maiani/vecview/blob/v0.6.0/examples/README.md) for the full list and what each
281
284
  needs; several typeset their labels with
282
285
  [VecTeX](https://github.com/maiani/vectex), which needs TeX.
283
286
 
@@ -313,15 +316,15 @@ VecView depends on none of them and contains no code specific to any of them.
313
316
 
314
317
  ## Documentation
315
318
 
316
- - [Overview](https://github.com/maiani/vecview/blob/v0.5.0/docs/index.md)
317
- - [Cameras](https://github.com/maiani/vecview/blob/v0.5.0/docs/cameras.md)
318
- - [Scenes and layers](https://github.com/maiani/vecview/blob/v0.5.0/docs/scenes.md)
319
- - [Shapes](https://github.com/maiani/vecview/blob/v0.5.0/docs/shapes.md)
320
- - [Outlines](https://github.com/maiani/vecview/blob/v0.5.0/docs/outlines.md)
321
- - [Animation](https://github.com/maiani/vecview/blob/v0.5.0/docs/animation.md)
322
- - [Gallery](https://github.com/maiani/vecview/blob/v0.5.0/docs/gallery.md)
323
- - [Embedding a scene](https://github.com/maiani/vecview/blob/v0.5.0/docs/embedding.md)
324
- - [Development](https://github.com/maiani/vecview/blob/v0.5.0/docs/development.md)
319
+ - [Overview](https://github.com/maiani/vecview/blob/v0.6.0/docs/index.md)
320
+ - [Cameras](https://github.com/maiani/vecview/blob/v0.6.0/docs/cameras.md)
321
+ - [Scenes and layers](https://github.com/maiani/vecview/blob/v0.6.0/docs/scenes.md)
322
+ - [Shapes](https://github.com/maiani/vecview/blob/v0.6.0/docs/shapes.md)
323
+ - [Outlines](https://github.com/maiani/vecview/blob/v0.6.0/docs/outlines.md)
324
+ - [Animation](https://github.com/maiani/vecview/blob/v0.6.0/docs/animation.md)
325
+ - [Gallery](https://github.com/maiani/vecview/blob/v0.6.0/docs/gallery.md)
326
+ - [Embedding a scene](https://github.com/maiani/vecview/blob/v0.6.0/docs/embedding.md)
327
+ - [Development](https://github.com/maiani/vecview/blob/v0.6.0/docs/development.md)
325
328
 
326
329
  ## License
327
330
 
@@ -134,8 +134,8 @@ uv run zensical build
134
134
  `.github/workflows/publish.yml` publishes tags named `v<version>`. It checks
135
135
  that the tag matches `pyproject.toml`, runs the CI matrix against that tag,
136
136
  builds both distributions (the wheel from the sdist), and runs
137
- `twine check --strict` before publishing the same artifacts. Python 3.15 is
138
- experimental; its job may fail while the supported 3.12–3.14 jobs must pass.
137
+ `twine check --strict` before publishing the same artifacts. Every job, Python
138
+ 3.12 to 3.15, must pass.
139
139
 
140
140
  Publishing goes through a
141
141
  [Trusted Publisher on PyPI](https://docs.pypi.org/trusted-publishers/), configured
@@ -7,7 +7,7 @@
7
7
  <path clip-rule="evenodd" d="M -279.93 -78.82 L -280.41 -79.32 L -128.31 -34.09 L -128.14 -33.93 L -128.17 -33.58 L -128.66 -32.77 L -130.91 -28.04 L -132.28 -24.13 L -279.4 -67.87 L -278.27 -67.89 L -278.27 -78.3 L -278.44 -78.31 L -278.93 -78.81 Z M -283.39 -79.86 L -283.87 -80.35 L -280.44 -79.33 L -281.91 -79.35 L -282.4 -79.85 Z M -284.88 -80.37 L -285.26 -80.76 L -283.92 -80.36 Z M -295.49 -72.66 L -287.23 -81.34 L -285.65 -80.87 L -286.86 -80.89 L -287.13 -81.16 L -295.19 -72.68 L -294.78 -72.68 L -294.43 -72.34 Z M -293.29 -72.2 L -293.01 -71.92 L -293.93 -72.19 Z M -291.31 -71.72 L -290.88 -71.29 L -292.3 -71.71 Z M -289.83 -71.23 L -289.45 -70.86 L -290.68 -71.23 Z M -286.36 -70.27 L -285.89 -69.8 L -289.05 -70.74 L -287.85 -70.75 L -287.35 -70.26 Z M -284.88 -69.79 L -284.46 -69.38 L -285.82 -69.78 Z M -279.93 -68.36 L -279.44 -67.89 L -284.21 -69.3 L -282.9 -69.32 L -282.4 -68.83 L -281.41 -68.84 L -280.92 -68.35 Z M -130.82 17.23 L -132.56 12.4 L -133.72 7.53 L -134.32 2.62 L -134.34 -13.44 L -134.32 -8.52 L -133.72 -3.61 L -132.56 1.26 L -130.82 6.08 L -128.53 10.83 L -125.68 15.48 L -122.3 20.02 L -118.39 24.43 L -113.98 28.68 L -109.08 32.77 L -103.71 36.66 L -97.89 40.35 L -91.66 43.82 L -85.04 47.06 L -78.05 50.04 L -70.72 52.77 L -63.1 55.22 L -55.2 57.38 L -47.07 59.25 L -38.73 60.82 L -30.23 62.09 L -21.6 63.04 L -12.88 63.67 L -4.1 63.98 L 4.69 63.97 L 13.47 63.64 L 22.18 62.98 L 30.8 62.01 L 39.29 60.73 L 47.62 59.14 L 55.73 57.25 L 63.61 55.06 L 71.22 52.59 L 78.52 49.85 L 85.49 46.85 L 92.09 43.6 L 98.29 40.11 L 104.08 36.41 L 105.39 35.45 L 105.51 35.43 L 246.99 77.5 L 238.73 86.18 L 105.44 46.55 L 104.08 47.55 L 98.29 51.26 L 92.09 54.74 L 85.49 57.99 L 78.52 60.99 L 71.22 63.74 L 63.61 66.2 L 55.73 68.39 L 47.62 70.28 L 39.29 71.87 L 30.8 73.15 L 22.18 74.12 L 13.47 74.78 L 4.69 75.11 L -4.1 75.12 L -12.88 74.81 L -21.6 74.18 L -30.23 73.23 L -38.73 71.97 L -47.07 70.4 L -55.2 68.52 L -63.1 66.36 L -70.72 63.91 L -78.05 61.19 L -85.04 58.2 L -91.66 54.97 L -97.89 51.5 L -103.71 47.8 L -109.08 43.91 L -113.98 39.83 L -118.39 35.57 L -122.3 31.17 L -125.68 26.63 L -128.53 21.97 Z M 128.16 11.41 L 128.7 10.52 L 130.96 5.76 L 132.65 0.94 L 133.78 -3.94 L 134.34 -8.85 L 134.34 2.3 L 133.78 7.2 L 132.65 12.08 L 132.31 13.05 L 128.4 11.89 L 128.14 11.65 Z "/>
8
8
  </clipPath>
9
9
  <clipPath id="ring-pz-visible">
10
- <path clip-rule="evenodd" d="M -264.21 -105.26 L -287.28 -80.99 L -287.5 -81.06 L -264.42 -105.33 Z M -278.97 -78.52 L -255.9 -102.79 L -105.51 -58.08 L -104.27 -58.99 L -98.47 -62.7 L -92.24 -66.2 L -85.64 -69.45 L -78.65 -72.46 L -71.33 -75.21 L -63.71 -77.68 L -55.81 -79.87 L -47.7 -81.76 L -39.35 -83.36 L -30.84 -84.64 L -22.21 -85.62 L -13.48 -86.27 L -5.36 -86.58 L -5.36 -64.37 L -9.6 -64.21 L -15.81 -63.74 L -21.96 -63.05 L -28.01 -62.13 L -33.94 -61.0 L -39.72 -59.65 L -45.34 -58.1 L -50.76 -56.34 L -55.96 -54.38 L -60.92 -52.25 L -65.61 -49.93 L -70.03 -47.45 L -74.14 -44.82 L -77.94 -42.04 L -81.4 -39.13 L -84.51 -36.1 L -87.26 -32.97 L -89.63 -29.75 L -91.62 -26.45 L -93.22 -23.08 L -94.42 -19.67 L -95.21 -16.23 L -95.61 -12.76 L -95.59 -9.29 L -95.17 -5.83 L -94.35 -2.38 L -93.12 1.03 L -91.5 4.39 L -89.48 7.68 L -87.08 10.9 L -84.31 14.02 L -81.18 17.04 L -77.7 19.95 L -73.88 22.71 L -69.74 25.34 L -65.31 27.81 L -60.59 30.11 L -55.62 32.24 L -50.4 34.18 L -44.97 35.92 L -39.34 37.46 L -33.55 38.8 L -27.61 39.92 L -21.55 40.82 L -15.4 41.49 L -9.18 41.94 L -2.93 42.17 L 3.34 42.16 L 9.6 41.92 L 15.81 41.46 L 21.96 40.76 L 28.01 39.85 L 33.94 38.72 L 39.72 37.37 L 45.34 35.81 L 50.76 34.05 L 55.96 32.1 L 60.92 29.96 L 65.61 27.65 L 70.03 25.17 L 74.14 22.53 L 77.94 19.76 L 81.4 16.85 L 84.51 13.82 L 87.26 10.69 L 89.63 7.46 L 91.62 4.16 L 93.22 0.8 L 94.42 -2.61 L 95.21 -6.06 L 95.61 -9.52 L 95.59 -12.99 L 95.17 -16.46 L 94.35 -19.9 L 93.12 -23.31 L 91.5 -26.67 L 89.48 -29.97 L 87.08 -33.18 L 84.31 -36.31 L 81.18 -39.33 L 77.7 -42.23 L 73.88 -45.0 L 69.74 -47.62 L 65.31 -50.09 L 60.59 -52.4 L 55.62 -54.52 L 50.4 -56.46 L 44.97 -58.21 L 39.34 -59.75 L 33.55 -61.08 L 27.61 -62.2 L 21.55 -63.1 L 15.4 -63.78 L 9.18 -64.23 L 5.36 -64.36 L 5.36 -86.57 L 12.89 -86.3 L 21.63 -85.67 L 30.27 -84.72 L 38.8 -83.45 L 47.13 -81.88 L 55.28 -80.01 L 63.2 -77.83 L 70.83 -75.38 L 78.17 -72.66 L 85.19 -69.66 L 91.81 -66.42 L 98.06 -62.94 L 103.91 -59.23 L 109.28 -55.34 L 114.2 -51.24 L 118.63 -46.97 L 122.58 -42.52 L 125.96 -37.98 L 128.83 -33.3 L 131.14 -28.52 L 132.9 -23.63 L 134.06 -18.75 L 134.67 -13.81 L 134.69 -8.81 L 134.12 -3.86 L 132.99 1.02 L 131.27 5.91 L 129.01 10.67 L 128.51 11.5 L 269.8 53.51 L 246.72 77.78 L 105.51 35.79 L 104.27 36.7 L 98.48 40.41 L 92.24 43.91 L 85.63 47.17 L 78.65 50.18 L 71.34 52.92 L 63.71 55.4 L 55.81 57.59 L 47.68 59.48 L 39.35 61.08 L 30.86 62.36 L 22.21 63.33 L 13.48 63.98 L 4.69 64.32 L -4.1 64.33 L -12.89 64.02 L -21.63 63.39 L -30.28 62.43 L -38.78 61.17 L -47.13 59.6 L -55.28 57.72 L -63.2 55.55 L -70.83 53.1 L -78.17 50.37 L -85.19 47.37 L -91.81 44.14 L -98.06 40.66 L -103.91 36.95 L -109.28 33.05 L -114.2 28.95 L -118.63 24.68 L -122.58 20.23 L -125.96 15.69 L -128.83 11.01 L -131.14 6.24 L -132.9 1.34 L -134.06 -3.53 L -134.67 -8.48 L -134.69 -13.48 L -134.12 -18.42 L -132.99 -23.3 L -131.27 -28.2 L -129.01 -32.95 L -128.51 -33.79 Z M 66.08 -65.3 L 45.99 -78.02 L 35.99 -67.5 Z M -62.17 35.73 L -72.18 46.26 L -42.08 48.46 Z "/>
10
+ <path clip-rule="evenodd" d="M -264.21 -105.26 L -287.28 -80.99 L -287.5 -81.06 L -264.42 -105.33 Z M -278.97 -78.52 L -255.9 -102.79 L -105.51 -58.08 L -104.27 -58.99 L -98.47 -62.7 L -92.24 -66.2 L -85.64 -69.45 L -78.65 -72.46 L -71.33 -75.21 L -63.71 -77.68 L -55.81 -79.87 L -47.7 -81.76 L -39.35 -83.36 L -30.84 -84.64 L -22.21 -85.62 L -13.48 -86.27 L -5.36 -86.58 L -5.36 -64.37 L -9.6 -64.21 L -15.81 -63.74 L -21.96 -63.05 L -28.01 -62.13 L -33.94 -61.0 L -39.72 -59.65 L -45.34 -58.1 L -50.76 -56.34 L -55.96 -54.38 L -60.92 -52.25 L -65.61 -49.93 L -70.03 -47.45 L -74.14 -44.82 L -77.94 -42.04 L -81.4 -39.13 L -84.51 -36.1 L -87.26 -32.97 L -89.63 -29.75 L -91.62 -26.45 L -93.22 -23.08 L -94.42 -19.67 L -95.21 -16.23 L -95.61 -12.76 L -95.59 -9.29 L -95.17 -5.83 L -94.35 -2.38 L -93.12 1.03 L -91.5 4.39 L -89.48 7.68 L -87.08 10.9 L -84.31 14.02 L -81.18 17.04 L -77.7 19.95 L -73.88 22.71 L -69.74 25.34 L -65.31 27.81 L -60.59 30.11 L -55.62 32.24 L -50.4 34.18 L -44.97 35.92 L -39.34 37.46 L -33.55 38.8 L -27.61 39.92 L -21.55 40.82 L -15.4 41.49 L -9.18 41.94 L -2.93 42.17 L 3.34 42.16 L 9.6 41.92 L 15.81 41.46 L 21.96 40.76 L 28.01 39.85 L 33.94 38.72 L 39.72 37.37 L 45.34 35.81 L 50.76 34.05 L 55.96 32.1 L 60.92 29.96 L 65.61 27.65 L 70.03 25.17 L 74.14 22.53 L 77.94 19.76 L 81.4 16.85 L 84.51 13.82 L 87.26 10.69 L 89.63 7.46 L 91.62 4.16 L 93.22 0.8 L 94.42 -2.61 L 95.21 -6.06 L 95.61 -9.52 L 95.59 -12.99 L 95.17 -16.46 L 94.35 -19.9 L 93.12 -23.31 L 91.5 -26.67 L 89.48 -29.97 L 87.08 -33.18 L 84.31 -36.31 L 81.18 -39.33 L 77.7 -42.23 L 73.88 -45.0 L 69.74 -47.62 L 65.31 -50.09 L 60.59 -52.4 L 55.62 -54.52 L 50.4 -56.46 L 44.97 -58.21 L 39.34 -59.75 L 33.55 -61.08 L 27.61 -62.2 L 21.55 -63.1 L 15.4 -63.78 L 9.18 -64.23 L 5.36 -64.36 L 5.36 -86.57 L 12.89 -86.3 L 21.63 -85.67 L 30.27 -84.72 L 38.8 -83.45 L 47.13 -81.88 L 55.28 -80.01 L 63.2 -77.83 L 70.83 -75.38 L 78.17 -72.66 L 85.19 -69.66 L 91.81 -66.42 L 98.06 -62.94 L 103.91 -59.23 L 109.28 -55.34 L 114.2 -51.24 L 118.63 -46.97 L 122.58 -42.52 L 125.96 -37.98 L 128.83 -33.3 L 131.14 -28.52 L 132.9 -23.63 L 134.06 -18.75 L 134.67 -13.81 L 134.69 -8.81 L 134.12 -3.86 L 132.99 1.02 L 131.27 5.91 L 129.01 10.67 L 128.51 11.5 L 269.8 53.51 L 246.72 77.78 L 105.51 35.79 L 104.27 36.7 L 98.48 40.41 L 92.24 43.91 L 85.63 47.17 L 78.65 50.18 L 71.34 52.92 L 63.71 55.4 L 55.81 57.59 L 47.68 59.48 L 39.35 61.08 L 30.86 62.36 L 22.21 63.33 L 13.48 63.98 L 4.69 64.32 L -4.1 64.33 L -12.89 64.02 L -21.63 63.39 L -30.28 62.43 L -38.78 61.17 L -47.13 59.6 L -55.28 57.72 L -63.2 55.55 L -70.83 53.1 L -78.17 50.37 L -85.19 47.37 L -91.81 44.14 L -98.06 40.66 L -103.91 36.95 L -109.28 33.05 L -114.2 28.95 L -118.63 24.68 L -122.58 20.23 L -125.96 15.69 L -128.83 11.01 L -131.14 6.24 L -132.9 1.34 L -134.06 -3.53 L -134.67 -8.48 L -134.69 -13.48 L -134.12 -18.42 L -132.99 -23.3 L -131.27 -28.2 L -129.01 -32.95 L -128.51 -33.79 Z M 65.55 -64.79 L 45.54 -77.49 L 35.53 -66.97 Z M -61.64 35.23 L -71.65 45.75 L -41.63 47.93 Z "/>
11
11
  </clipPath>
12
12
  <clipPath id="source-px-visible">
13
13
  <path clip-rule="evenodd" d="M -298.66 -45.13 L -298.83 -45.3 L -298.85 -69.29 L -298.77 -69.5 L -235.67 -135.85 L -235.46 -135.95 L -235.24 -135.86 L -235.15 -135.65 L -235.15 -111.77 L -235.24 -111.56 L -246.6 -99.61 L -255.34 -102.21 L -277.8 -78.59 L -269.06 -75.99 L -269.41 -75.63 L -277.7 -78.09 L -278.27 -78.08 L -278.27 -67.96 L -277.05 -67.59 L -298.33 -45.21 Z "/>
@@ -18,7 +18,7 @@
18
18
  <cc:Work>
19
19
  <dc:creator>
20
20
  <cc:Agent>
21
- <dc:title>VecView v0.3.0, https://github.com/maiani/vecview</dc:title>
21
+ <dc:title>VecView v0.6.0, https://github.com/maiani/vecview</dc:title>
22
22
  </cc:Agent>
23
23
  </dc:creator>
24
24
  </cc:Work>
@@ -36,14 +36,14 @@
36
36
  <polygon stroke="#1f2430" stroke-width="0.6" clip-path="url(#source-px-visible)" id="source-px" points="-298.55,-45.41 -235.45,-111.77 -235.45,-135.65 -298.55,-69.29" fill="#e2b56a"/>
37
37
  <path clip-path="url(#ring-walls-visible)" id="ring-walls" d="M -134.34 -2.3 L -134.32 2.62 L -133.72 7.53 L -132.56 12.4 L -130.82 17.23 L -128.53 21.97 L -125.68 26.63 L -122.3 31.17 L -118.39 35.57 L -113.98 39.83 L -109.08 43.91 L -103.71 47.8 L -97.89 51.5 L -91.66 54.97 L -85.04 58.2 L -78.05 61.19 L -70.72 63.91 L -63.1 66.36 L -55.2 68.52 L -47.07 70.4 L -38.73 71.97 L -30.23 73.23 L -21.6 74.18 L -12.88 74.81 L -4.1 75.12 L 4.69 75.11 L 13.47 74.78 L 22.18 74.12 L 30.8 73.15 L 39.29 71.87 L 47.62 70.28 L 55.73 68.39 L 63.61 66.2 L 71.22 63.74 L 78.52 60.99 L 85.49 57.99 L 92.09 54.74 L 98.29 51.26 L 104.08 47.55 L 105.44 46.55 L 276.93 97.54 L 299.46 73.84 L 299.46 62.7 L 276.93 86.4 L 105.44 35.41 L 104.08 36.41 L 98.29 40.11 L 92.09 43.6 L 85.49 46.85 L 78.52 49.85 L 71.22 52.59 L 63.61 55.06 L 55.73 57.25 L 47.62 59.14 L 39.29 60.73 L 30.8 62.01 L 22.18 62.98 L 13.47 63.64 L 4.69 63.97 L -4.1 63.98 L -12.88 63.67 L -21.6 63.04 L -30.23 62.09 L -38.73 60.82 L -47.07 59.25 L -55.2 57.38 L -63.1 55.22 L -70.72 52.77 L -78.05 50.04 L -85.04 47.06 L -91.66 43.82 L -97.89 40.35 L -103.71 36.66 L -109.08 32.77 L -113.98 28.68 L -118.39 24.43 L -122.3 20.02 L -125.68 15.48 L -128.53 10.83 L -130.82 6.08 L -132.56 1.26 L -133.72 -3.61 L -134.32 -8.52 L -134.34 -13.44 Z M 127.98 22.85 L 128.7 21.66 L 130.96 16.91 L 132.65 12.08 L 133.78 7.2 L 134.34 2.3 L 134.34 -8.85 L 133.78 -3.94 L 132.65 0.94 L 130.96 5.76 L 128.7 10.52 L 127.98 11.71 Z M -299.46 -73.84 L -127.98 -22.85 L -127.98 -33.99 L -299.46 -84.98 Z " fill="#8a96a8"/>
38
38
  <path stroke="#1f2430" stroke-width="0.7" clip-path="url(#ring-pz-visible)" id="ring-pz" d="M -299.46 -84.98 L -127.98 -33.99 L -128.7 -32.8 L -130.96 -28.05 L -132.65 -23.22 L -133.78 -18.35 L -134.34 -13.44 L -134.32 -8.52 L -133.72 -3.61 L -132.56 1.26 L -130.82 6.08 L -128.53 10.83 L -125.68 15.48 L -122.3 20.02 L -118.39 24.43 L -113.98 28.68 L -109.08 32.77 L -103.71 36.66 L -97.89 40.35 L -91.66 43.82 L -85.04 47.06 L -78.05 50.04 L -70.72 52.77 L -63.1 55.22 L -55.2 57.38 L -47.07 59.25 L -38.73 60.82 L -30.23 62.09 L -21.6 63.04 L -12.88 63.67 L -4.1 63.98 L 4.69 63.97 L 13.47 63.64 L 22.18 62.98 L 30.8 62.01 L 39.29 60.73 L 47.62 59.14 L 55.73 57.25 L 63.61 55.06 L 71.22 52.59 L 78.52 49.85 L 85.49 46.85 L 92.09 43.6 L 98.29 40.11 L 104.08 36.41 L 105.44 35.41 L 276.93 86.4 L 299.46 62.7 L 127.98 11.71 L 128.7 10.52 L 130.96 5.76 L 132.65 0.94 L 133.78 -3.94 L 134.34 -8.85 L 134.32 -13.77 L 133.72 -18.67 L 132.56 -23.55 L 130.82 -28.37 L 128.53 -33.12 L 125.68 -37.77 L 122.3 -42.31 L 118.39 -46.71 L 113.98 -50.97 L 109.08 -55.05 L 103.71 -58.95 L 97.89 -62.64 L 91.66 -66.11 L 85.04 -69.34 L 78.05 -72.33 L 70.72 -75.05 L 63.1 -77.5 L 55.2 -79.67 L 47.07 -81.54 L 38.73 -83.11 L 30.23 -84.37 L 21.6 -85.32 L 12.88 -85.95 L 4.1 -86.26 L -4.69 -86.25 L -13.47 -85.92 L -22.18 -85.27 L -30.8 -84.3 L -39.29 -83.01 L -47.62 -81.42 L -55.73 -79.53 L -63.61 -77.35 L -71.22 -74.88 L -78.52 -72.14 L -85.49 -69.13 L -92.09 -65.88 L -98.29 -62.4 L -104.08 -58.69 L -105.44 -57.69 L -276.93 -108.68 Z M 89.92 7.66 L 87.53 10.91 L 84.76 14.06 L 81.63 17.11 L 78.16 20.03 L 74.34 22.82 L 70.21 25.47 L 65.78 27.96 L 61.06 30.28 L 56.09 32.43 L 50.87 34.38 L 45.44 36.15 L 39.81 37.71 L 34.01 39.06 L 28.07 40.19 L 22.0 41.11 L 15.84 41.8 L 9.62 42.27 L 3.35 42.51 L -2.93 42.52 L -9.2 42.29 L -15.43 41.84 L -21.6 41.16 L -27.67 40.26 L -33.62 39.14 L -39.43 37.8 L -45.07 36.26 L -50.52 34.51 L -55.75 32.56 L -60.74 30.43 L -65.47 28.12 L -69.92 25.64 L -74.08 23.0 L -77.91 20.22 L -81.41 17.31 L -84.57 14.27 L -87.36 11.12 L -89.77 7.88 L -91.81 4.55 L -93.44 1.16 L -94.68 -2.28 L -95.52 -5.76 L -95.94 -9.27 L -95.96 -12.78 L -95.56 -16.29 L -94.75 -19.77 L -93.54 -23.22 L -91.93 -26.61 L -89.92 -29.94 L -87.53 -33.19 L -84.76 -36.34 L -81.63 -39.39 L -78.16 -42.32 L -74.34 -45.11 L -70.21 -47.75 L -65.78 -50.24 L -61.06 -52.57 L -56.09 -54.71 L -50.87 -56.67 L -45.44 -58.43 L -39.81 -59.99 L -34.01 -61.34 L -28.07 -62.48 L -22.0 -63.4 L -15.84 -64.09 L -9.62 -64.55 L -3.35 -64.79 L 2.93 -64.8 L 9.2 -64.58 L 15.43 -64.13 L 21.6 -63.45 L 27.67 -62.55 L 33.62 -61.43 L 39.43 -60.09 L 45.07 -58.54 L 50.52 -56.79 L 55.75 -54.85 L 60.74 -52.71 L 65.47 -50.4 L 69.92 -47.92 L 74.08 -45.29 L 77.91 -42.51 L 81.41 -39.59 L 84.57 -36.55 L 87.36 -33.4 L 89.77 -30.16 L 91.81 -26.84 L 93.44 -23.45 L 94.68 -20.0 L 95.52 -16.52 L 95.94 -13.02 L 95.96 -9.5 L 95.56 -6.0 L 94.75 -2.51 L 93.54 0.93 L 91.93 4.33 Z " fill-rule="evenodd" fill="#c7d0dc"/>
39
- <polygon id="head-upper" points="40.52,-72.85 40.52,-72.85 45.93,-78.54 67.65,-64.78 35.11,-67.16 40.52,-72.85 40.52,-72.85" fill="#c0392b"/>
39
+ <polygon id="path-upper-head" points="45.48,-78.01 67.11,-64.28 34.66,-66.63" fill="#c0392b"/>
40
40
  <g id="flux">
41
41
  <path id="flux-head" d="M -15.64 -29.22 L 0.0 0.0 L 15.64 -29.22 A 16.32 9.126 0.0 1 0 -15.64 -29.22 Z " fill="#6c3483"/>
42
42
  <ellipse id="flux-head-end0" cx="0.0" cy="-31.84" rx="16.32" ry="9.126" fill="#6c3483"/>
43
43
  <path id="flux-shaft" d="M -5.76 -183.05 L -5.76 -31.84 A 5.76 3.221 0.0 0 0 5.76 -31.84 L 5.76 -183.05 A 5.76 3.221 0.0 0 0 -5.76 -183.05 Z " fill="#6c3483"/>
44
44
  <ellipse id="flux-shaft-end0" cx="0.0" cy="-183.05" rx="5.76" ry="3.221" fill="#6c3483"/>
45
45
  </g>
46
- <polygon id="head-lower" points="-67.65,40.91 -67.65,40.91 -62.24,35.22 -40.52,48.97 -73.05,46.6 -67.65,40.91 -67.65,40.91" fill="#2e86c1"/>
46
+ <polygon id="path-lower-head" points="-61.7,34.71 -40.07,48.44 -72.52,46.09" fill="#2e86c1"/>
47
47
  <polygon stroke="#1f2430" stroke-width="0.6" id="drain-pz" points="235.45,89.49 320.22,114.69 383.31,48.33 298.55,23.13" fill="#e2b56a"/>
48
48
  <path stroke="#c0392b" stroke-width="2.4" id="path-upper" d="M -101.72 -42.18 L -98.94 -44.94 L -95.92 -47.61 L -92.68 -50.2 L -89.21 -52.7 L -85.53 -55.1 L -81.64 -57.39 L -77.55 -59.57 L -73.28 -61.65 L -68.83 -63.6 L -64.21 -65.42 L -59.44 -67.12 L -54.53 -68.68 L -49.48 -70.11 L -44.32 -71.4 L -39.05 -72.54 L -33.68 -73.54 L -28.24 -74.39 L -22.72 -75.09 L -17.15 -75.64 L -11.54 -76.03 L -5.9 -76.27 L -5.76 -76.27 M 5.76 -76.27 L 11.04 -76.06 L 16.65 -75.68 L 22.23 -75.15 L 27.75 -74.46 L 33.2 -73.62 L 38.57 -72.64 L 43.85 -71.51 L 49.03 -70.23 L 54.08 -68.82 L 59.01 -67.26 L 63.79 -65.58 L 68.42 -63.76 L 72.89 -61.82 L 77.18 -59.76 L 81.28 -57.59 L 85.19 -55.3 L 88.89 -52.91 L 92.38 -50.43 L 95.65 -47.84 L 98.68 -45.18 L 101.48 -42.43 L 104.03 -39.61 L 106.33 -36.72 L 108.38 -33.77 L 110.17 -30.77 L 111.69 -27.73 L 112.94 -24.64 L 113.92 -21.53 L 114.62 -18.39 L 115.05 -15.24 L 115.2 -12.08 L 115.07 -8.92 L 114.67 -5.76 L 113.99 -2.62 L 113.04 0.49 L 111.81 3.58 L 110.31 6.63 L 108.55 9.63 L 106.53 12.58 L 104.25 15.48 L 101.72 18.3" stroke-linecap="round" fill="none"/>
49
49
  <polyline stroke="#2e86c1" stroke-width="2.4" id="path-lower" points="-101.72,-42.18 -104.25,-39.35 -106.53,-36.46 -108.55,-33.51 -110.31,-30.5 -111.81,-27.45 -113.04,-24.37 -113.99,-21.25 -114.67,-18.11 -115.07,-14.96 -115.2,-11.8 -115.05,-8.64 -114.62,-5.48 -113.92,-2.35 -112.94,0.77 -111.69,3.85 -110.17,6.9 -108.38,9.9 -106.33,12.84 -104.03,15.73 -101.48,18.55 -98.68,21.3 -95.65,23.97 -92.38,26.55 -88.89,29.04 -85.19,31.43 -81.28,33.71 -77.18,35.89 -72.89,37.95 -68.42,39.89 -63.79,41.7 -59.01,43.39 -54.08,44.94 -49.03,46.36 -43.85,47.63 -38.57,48.76 -33.2,49.75 -27.75,50.58 -22.23,51.27 -16.65,51.8 -11.04,52.18 -5.4,52.41 0.25,52.48 5.9,52.4 11.54,52.16 17.15,51.76 22.72,51.22 28.24,50.52 33.68,49.67 39.05,48.67 44.32,47.52 49.48,46.24 54.53,44.81 59.44,43.24 64.21,41.55 68.83,39.72 73.28,37.77 77.55,35.7 81.64,33.51 85.53,31.22 89.21,28.82 92.68,26.32 95.92,23.73 98.94,21.06 101.72,18.3" stroke-linecap="round" fill="none"/>
@@ -28,7 +28,7 @@
28
28
  <cc:Work>
29
29
  <dc:creator>
30
30
  <cc:Agent>
31
- <dc:title>VecView v0.3.0, https://github.com/maiani/vecview</dc:title>
31
+ <dc:title>VecView v0.6.0, https://github.com/maiani/vecview</dc:title>
32
32
  </cc:Agent>
33
33
  </dc:creator>
34
34
  </cc:Work>
@@ -20,7 +20,7 @@
20
20
  <cc:Work>
21
21
  <dc:creator>
22
22
  <cc:Agent>
23
- <dc:title>VecView v0.3.0, https://github.com/maiani/vecview</dc:title>
23
+ <dc:title>VecView v0.6.0, https://github.com/maiani/vecview</dc:title>
24
24
  </cc:Agent>
25
25
  </dc:creator>
26
26
  </cc:Work>
@@ -4,7 +4,7 @@
4
4
  <cc:Work>
5
5
  <dc:creator>
6
6
  <cc:Agent>
7
- <dc:title>VecView v0.3.0, https://github.com/maiani/vecview</dc:title>
7
+ <dc:title>VecView v0.6.0, https://github.com/maiani/vecview</dc:title>
8
8
  </cc:Agent>
9
9
  </dc:creator>
10
10
  </cc:Work>
@@ -2247,7 +2247,7 @@
2247
2247
  <cc:Work>
2248
2248
  <dc:creator>
2249
2249
  <cc:Agent>
2250
- <dc:title>VecView v0.3.0, https://github.com/maiani/vecview</dc:title>
2250
+ <dc:title>VecView v0.6.0, https://github.com/maiani/vecview</dc:title>
2251
2251
  </cc:Agent>
2252
2252
  </dc:creator>
2253
2253
  </cc:Work>
@@ -910,7 +910,7 @@
910
910
  <cc:Work>
911
911
  <dc:creator>
912
912
  <cc:Agent>
913
- <dc:title>VecView v0.3.0, https://github.com/maiani/vecview</dc:title>
913
+ <dc:title>VecView v0.6.0, https://github.com/maiani/vecview</dc:title>
914
914
  </cc:Agent>
915
915
  </dc:creator>
916
916
  </cc:Work>
@@ -92,7 +92,7 @@
92
92
  <cc:Work>
93
93
  <dc:creator>
94
94
  <cc:Agent>
95
- <dc:title>VecView v0.3.0, https://github.com/maiani/vecview</dc:title>
95
+ <dc:title>VecView v0.6.0, https://github.com/maiani/vecview</dc:title>
96
96
  </cc:Agent>
97
97
  </dc:creator>
98
98
  </cc:Work>
@@ -19,7 +19,7 @@
19
19
  <cc:Work>
20
20
  <dc:creator>
21
21
  <cc:Agent>
22
- <dc:title>VecView v0.3.0, https://github.com/maiani/vecview</dc:title>
22
+ <dc:title>VecView v0.6.0, https://github.com/maiani/vecview</dc:title>
23
23
  </cc:Agent>
24
24
  </dc:creator>
25
25
  </cc:Work>
@@ -48,7 +48,7 @@
48
48
  <cc:Work>
49
49
  <dc:creator>
50
50
  <cc:Agent>
51
- <dc:title>VecView v0.3.0, https://github.com/maiani/vecview</dc:title>
51
+ <dc:title>VecView v0.6.0, https://github.com/maiani/vecview</dc:title>
52
52
  </cc:Agent>
53
53
  </dc:creator>
54
54
  </cc:Work>
@@ -2938,7 +2938,7 @@
2938
2938
  <cc:Work>
2939
2939
  <dc:creator>
2940
2940
  <cc:Agent>
2941
- <dc:title>VecView v0.3.0, https://github.com/maiani/vecview</dc:title>
2941
+ <dc:title>VecView v0.6.0, https://github.com/maiani/vecview</dc:title>
2942
2942
  </cc:Agent>
2943
2943
  </dc:creator>
2944
2944
  </cc:Work>
@@ -16,7 +16,7 @@
16
16
  <cc:Work>
17
17
  <dc:creator>
18
18
  <cc:Agent>
19
- <dc:title>VecView v0.3.0, https://github.com/maiani/vecview</dc:title>
19
+ <dc:title>VecView v0.6.0, https://github.com/maiani/vecview</dc:title>
20
20
  </cc:Agent>
21
21
  </dc:creator>
22
22
  </cc:Work>
@@ -474,7 +474,7 @@
474
474
  <cc:Work>
475
475
  <dc:creator>
476
476
  <cc:Agent>
477
- <dc:title>VecView v0.3.0, https://github.com/maiani/vecview</dc:title>
477
+ <dc:title>VecView v0.6.0, https://github.com/maiani/vecview</dc:title>
478
478
  </cc:Agent>
479
479
  </dc:creator>
480
480
  </cc:Work>
@@ -12,7 +12,7 @@ camera, world-space glyph geometry, and an explicit layer stack.
12
12
  python -m pip install vecview
13
13
  ```
14
14
 
15
- Python 3.12 or newer is required; 3.12–3.14 are tested. VecView is alpha and its
15
+ Python 3.12 or newer is required; 3.12–3.15 are tested. VecView is alpha and its
16
16
  API may change before 1.0.
17
17
 
18
18
  ## The shape of the package
@@ -131,6 +131,7 @@ scene.polyline(layer, points3, back=None, **style) # open path, fill="none" by
131
131
  scene.faces(layer, faces, cull=False, **style) # one polygon per Face, one style
132
132
  scene.text(layer, point3, s, dx=0, dy=0, size=22, **style)
133
133
  scene.arrow(layer, origin, direction, length, normal=..., shaft_w=..., head_w=..., head_len=...)
134
+ scene.line_arrow(layer, path, normal=..., head_w=..., head_len=..., at=1.0, back=None, **style)
134
135
  scene.gaussian(layer, center, u, v, a, b, id=..., color=..., opacity=1.0, extent=2.0, stops=9)
135
136
  ```
136
137
 
@@ -158,6 +159,33 @@ Computing it yourself from `cam.view` bakes in one camera's answer — and for a
158
159
  camera, `view` does not even give the widest face. An arrow pointing along the
159
160
  projection ray has no face to show and raises `ValueError`.
160
161
 
162
+ `line_arrow` heads a stroked line: the line is a `polyline` in your style, and
163
+ the head a flat triangle filled with its `stroke`, lying in the plane of
164
+ `normal` or facing the camera as `arrow`'s does. The head takes `head_len` of
165
+ the path's length and points along the path, so on a curve it follows the curve
166
+ with no tangent to work out:
167
+
168
+ ```python
169
+ flow = vecview.arc_shape((0, 0, 0), (1, 0, 0), (0, 1, 0), 2.0, 45, 135, n=24)
170
+ scene.line_arrow(
171
+ 16,
172
+ flow,
173
+ normal=(0, 0, 1),
174
+ head_w=0.4,
175
+ head_len=0.45,
176
+ stroke="crimson",
177
+ stroke_width=2.0,
178
+ id="circulation",
179
+ )
180
+ ```
181
+
182
+ `at` places the head as a fraction of the path's length: `1`, the default,
183
+ puts its tip at the end, where the line stops at the head's base; `0.5`
184
+ centres it halfway, the way a current is marked on a loop, and the line runs
185
+ through it. The line keeps `id` and the head is `{id}-head`. Its width is a
186
+ screen stroke, while [`path_arrow_shape`](shapes.md#curved-arrows) widens the
187
+ path in world units, so its shaft foreshortens with the plane it lies in.
188
+
161
189
  `gaussian` draws a soft spot lying in a world plane, with opacity
162
190
  `exp(-(s/a)² - (t/b)²)` along the in-plane axes `u` and `v`:
163
191
 
@@ -292,9 +292,11 @@ scene.polygon(
292
292
  ```
293
293
 
294
294
  A two-point path gives exactly `arrow_shape`, and a `head_len` longer than the
295
- path is clamped the same way. Every point of the path must lie in the plane of
296
- `normal`. A path that bends tighter than half the shaft's width, or turns back on
297
- itself, raises `ValueError` rather than drawing a shaft that folds over.
295
+ path is clamped the same way. For a stroked line with a head on it, whose width
296
+ stays a screen stroke, use [`Scene.line_arrow`](scenes.md#world-space-calls).
297
+ Every point of the path must lie in the plane of `normal`. A path that bends
298
+ tighter than half the shaft's width, or turns back on itself, raises
299
+ `ValueError` rather than drawing a shaft that folds over.
298
300
 
299
301
  ## Surfaces
300
302
 
@@ -46,23 +46,18 @@ def electron_paths(scene: Scene) -> None:
46
46
  ("lower", (180, 360), "#2e86c1"),
47
47
  ):
48
48
  path = vecview.arc_shape((0, 0, T + 0.01), (1, 0, 0), (0, 1, 0), R_PATH, t0, t1, n=64)
49
- scene.polyline(
50
- 20, path, stroke=colour, stroke_width=2.4, stroke_linecap="round", id=f"path-{name}"
51
- )
52
49
  # A head halfway along, pointing the way the electron goes.
53
- mid = len(path) // 2
54
- scene.arrow(
50
+ scene.line_arrow(
55
51
  20,
56
- path[mid],
57
- path[mid + 1] - path[mid - 1],
58
- 0.32,
52
+ path,
59
53
  normal=(0, 0, 1),
60
- shaft_w=0.0,
61
54
  head_w=0.24,
62
55
  head_len=0.32,
63
- pivot="mid",
64
- fill=colour,
65
- id=f"head-{name}",
56
+ at=0.5,
57
+ stroke=colour,
58
+ stroke_width=2.4,
59
+ stroke_linecap="round",
60
+ id=f"path-{name}",
66
61
  )
67
62
 
68
63
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "vecview"
7
- version = "0.5.0"
7
+ version = "0.6.0"
8
8
  description = "Layered 3D scenes that render to SVG, for scientific schematics"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12"
@@ -19,6 +19,7 @@ classifiers = [
19
19
  "Programming Language :: Python :: 3.12",
20
20
  "Programming Language :: Python :: 3.13",
21
21
  "Programming Language :: Python :: 3.14",
22
+ "Programming Language :: Python :: 3.15",
22
23
  "License :: OSI Approved :: MIT License",
23
24
  "Topic :: Multimedia :: Graphics :: 3D Rendering",
24
25
  "Topic :: Scientific/Engineering :: Visualization",
@@ -63,7 +63,7 @@ from vecview.shapes import (
63
63
  trim_corners,
64
64
  )
65
65
 
66
- __version__ = "0.5.0"
66
+ __version__ = "0.6.0"
67
67
 
68
68
  __all__ = [
69
69
  "ISOMETRIC_ELEV_DEG",
@@ -43,7 +43,7 @@ from vecview._occlusion import (
43
43
  )
44
44
  from vecview._place import _Frame
45
45
  from vecview._types import Array, Point3, Points3, Shape2, Shape3, Style
46
- from vecview._vec import as_points, as_rings, basis_for, convex_hull, unit
46
+ from vecview._vec import as_points, as_rings, basis_for, convex_hull, cut_polyline, distinct, unit
47
47
  from vecview.camera import Camera, ParallelCamera
48
48
  from vecview.shapes import Face, Pivot, arrow_shape, prism_faces
49
49
 
@@ -616,6 +616,45 @@ class _Canvas:
616
616
  shape = arrow_shape(origin, direction, length, normal, shaft_w, head_w, head_len, pivot)
617
617
  self.polygon(layer, shape, **style)
618
618
 
619
+ def line_arrow(
620
+ self,
621
+ layer: int,
622
+ path: Points3,
623
+ *,
624
+ normal: Point3 | Literal["camera"],
625
+ head_w: float,
626
+ head_len: float,
627
+ at: float = 1.0,
628
+ back: Mapping[str, Style] | None = None,
629
+ **style: Style,
630
+ ) -> None:
631
+ """A stroked line along ``path`` with a flat head on it, ``at`` along its length."""
632
+ pts = distinct(as_points(path))
633
+ length = float(np.linalg.norm(np.diff(pts, axis=0), axis=1).sum())
634
+ half = min(head_len, length) / 2
635
+ middle = min(max(at * length, half), length - half)
636
+ before, neck = cut_polyline(pts, middle - half)
637
+ _, tip = cut_polyline(pts, middle + half)
638
+ if isinstance(normal, str):
639
+ normal = self._facing_normal(tip - neck)
640
+ across = np.cross(unit(normal), tip - neck)
641
+ if float(np.linalg.norm(across)) < 1e-12 * max(float(np.linalg.norm(tip - neck)), 1.0):
642
+ raise ValueError("line_arrow: the head points along normal, so it has no width")
643
+ side = unit(across) * head_w / 2
644
+ base = style.pop("id", None)
645
+ head: dict[str, Style] = {"fill": style["stroke"]} if "stroke" in style else {}
646
+ if "opacity" in style:
647
+ head["opacity"] = style["opacity"]
648
+ if "stroke_opacity" in style:
649
+ head["fill_opacity"] = style["stroke_opacity"]
650
+ if base is not None:
651
+ style["id"], head["id"] = base, f"{base}-head"
652
+ # At the end the line stops at the head's base; elsewhere it runs through.
653
+ line = before if middle + half >= length else pts
654
+ if len(line) > 1:
655
+ self.polyline(layer, line, back=back, **style)
656
+ self.polygon(layer, np.array([neck + side, tip, neck - side]), **head)
657
+
619
658
  def _facing_normal(self, direction: Point3) -> Array:
620
659
  """Normal of the plane through ``direction`` that shows the widest arrow.
621
660
 
@@ -13,7 +13,7 @@ from vecview._place import _Call, _moved, _placement
13
13
  from vecview._planar import check_holed_polygon
14
14
  from vecview._tracks import Track
15
15
  from vecview._types import Point3, Points3, Shape2, Shape3, Style
16
- from vecview._vec import as_points, as_rings
16
+ from vecview._vec import as_points, as_rings, distinct
17
17
  from vecview.shapes import Face, Pivot, prism_faces
18
18
 
19
19
  if TYPE_CHECKING:
@@ -476,6 +476,62 @@ class _Drawing:
476
476
  **style,
477
477
  )
478
478
 
479
+ @_trackable
480
+ def line_arrow(
481
+ self,
482
+ layer: int,
483
+ path: Points3,
484
+ *,
485
+ normal: Point3 | Literal["camera"],
486
+ head_w: float,
487
+ head_len: float,
488
+ at: float = 1.0,
489
+ back: Mapping[str, Style] | None = None,
490
+ **style: Style,
491
+ ) -> None:
492
+ """A stroked line along ``path`` with a flat arrowhead on it.
493
+
494
+ The line is drawn as :meth:`polyline` draws it, in ``style``; the head
495
+ is a flat triangle filled with the line's ``stroke``, lying in the
496
+ plane with the given ``normal``, or facing the camera as
497
+ :meth:`arrow`'s does with ``normal="camera"``. The head takes
498
+ ``head_len`` of the path's length and points along it, so on a curve
499
+ it follows the curve rather than a direction worked out by hand::
500
+
501
+ flow = vecview.arc_shape((0, 0, 0), (1, 0, 0), (0, 1, 0), 2.0, 45, 135)
502
+ scene.line_arrow(16, flow, normal=(0, 0, 1), head_w=0.4, head_len=0.45,
503
+ stroke="crimson", stroke_width=2.0, id="circulation")
504
+
505
+ ``at`` places the head along the path, as a fraction of its length:
506
+ ``1`` (the default) puts its tip at the end, where the line stops at
507
+ the head's base; ``0.5`` centres it halfway, the way a current is
508
+ marked on a loop, with the line running through it. An ``id`` names
509
+ the line, and ``{id}-head`` the head. ``back`` styles the hidden parts
510
+ of the line in a sorted layer, as for :meth:`polyline`.
511
+
512
+ Raises:
513
+ ValueError: If the path has fewer than two distinct points, ``at``
514
+ lies outside ``[0, 1]``, or ``normal`` is a string other than
515
+ ``"camera"``.
516
+ """
517
+ if isinstance(normal, str) and normal != "camera":
518
+ raise ValueError(f"normal must be a vector or 'camera', got {normal!r}")
519
+ if not 0.0 <= at <= 1.0:
520
+ raise ValueError(f"at must lie between 0 and 1, got {at}")
521
+ if len(distinct(as_points(path))) < 2:
522
+ raise ValueError("line_arrow needs a path of at least two distinct points")
523
+ self._add(
524
+ "line_arrow",
525
+ layer,
526
+ path,
527
+ normal=normal,
528
+ head_w=head_w,
529
+ head_len=head_len,
530
+ at=at,
531
+ back=back,
532
+ **style,
533
+ )
534
+
479
535
  @_trackable
480
536
  def line_art(
481
537
  self,
@@ -113,6 +113,10 @@ _MOVES: dict[str, tuple[tuple[_Move, ...], dict[str, _Move]]] = {
113
113
  (_POINT, _VECTOR, _length),
114
114
  {"normal": _moved_normal, "shaft_w": _length, "head_w": _length, "head_len": _length},
115
115
  ),
116
+ "line_arrow": (
117
+ (_POINTS,),
118
+ {"normal": _moved_normal, "head_w": _length, "head_len": _length},
119
+ ),
116
120
  "gaussian": ((_POINT, _VECTOR, _VECTOR, _length, _length), {}),
117
121
  "sphere": ((_POINT, _length), {}),
118
122
  "cylinder": ((_POINT, _POINT, _length), {"r1": _length}),
@@ -28,6 +28,30 @@ def as_points(pts: Points3) -> Array:
28
28
  return a
29
29
 
30
30
 
31
+ def distinct(pts: Array) -> Array:
32
+ """``pts`` without a point that repeats the one before it."""
33
+ return pts[np.r_[True, np.any(np.diff(pts, axis=0) != 0, axis=1)]]
34
+
35
+
36
+ def cut_polyline(pts: Array, distance: float) -> tuple[Array, Array]:
37
+ """The part of a polyline up to ``distance`` along it, and the point there.
38
+
39
+ ``pts`` has no repeated consecutive points; a distance past either end is
40
+ clamped to it.
41
+ """
42
+ steps = np.linalg.norm(np.diff(pts, axis=0), axis=1)
43
+ run = np.r_[0.0, np.cumsum(steps)]
44
+ at = min(max(float(distance), 0.0), float(run[-1]))
45
+ k = int(np.searchsorted(run, at, side="right")) # the first vertex past ``at``
46
+ if k >= len(pts):
47
+ return pts.copy(), pts[-1].copy()
48
+ t = (at - run[k - 1]) / steps[k - 1]
49
+ if t == 0.0:
50
+ return pts[:k].copy(), pts[k - 1].copy()
51
+ point = pts[k - 1] + (pts[k] - pts[k - 1]) * t
52
+ return np.vstack([pts[:k], point]), point
53
+
54
+
31
55
  def as_rings(shape: Shape2 | Shape3, dim: int) -> list[Array]:
32
56
  """Normalize a region or plain ring, refusing ambiguous lists of rings."""
33
57
  if isinstance(shape, Region):
@@ -1,11 +1,13 @@
1
- """Flat arrows -- straight, double-headed, and along a path -- checked as numbers."""
1
+ """Flat arrows -- straight, double-headed, along a path, and heading a line."""
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
5
  import numpy as np
6
6
  import pytest
7
+ import svg
7
8
 
8
9
  import vecview
10
+ from vecview import Camera, OrthographicCamera, Scene
9
11
 
10
12
 
11
13
  def assert_in_plane(pts: np.ndarray, normal: np.ndarray) -> None:
@@ -153,3 +155,112 @@ class TestDoubleArrowShape:
153
155
  # Along the arrow, the outline runs monotonically from one tip to the other.
154
156
  assert np.all(np.diff(pts[: half + 1, 0]) <= 1e-12)
155
157
  assert np.ptp(pts[:, 0]) == pytest.approx(2.0)
158
+
159
+
160
+ @pytest.fixture
161
+ def cam() -> Camera:
162
+ return OrthographicCamera(35.0, 24.0, 10.0)
163
+
164
+
165
+ @pytest.fixture
166
+ def scene(cam: Camera) -> Scene:
167
+ return Scene(cam)
168
+
169
+
170
+ def drawn(scene: Scene) -> list[svg.Element]:
171
+ """The rendered elements, without the definitions."""
172
+ return [el for el in (scene.render().elements or []) if not isinstance(el, svg.Defs)]
173
+
174
+
175
+ def xy(element: svg.Polygon | svg.Polyline) -> np.ndarray:
176
+ """An element's points as an ``(n, 2)`` array of screen coordinates."""
177
+ return np.array([(float(p.x), float(p.y)) for p in element.points or []])
178
+
179
+
180
+ class TestLineArrow:
181
+ def test_at_the_end_the_line_stops_where_the_head_begins(
182
+ self, scene: Scene, cam: Camera
183
+ ) -> None:
184
+ path = [(0, 0, 0), (1, 0, 0), (2, 0, 0)]
185
+ scene.line_arrow(0, path, normal=(0, 0, 1), head_w=0.4, head_len=0.5, stroke="red", id="a")
186
+ expected = Scene(cam)
187
+ expected.polyline(0, [(0, 0, 0), (1, 0, 0), (1.5, 0, 0)], stroke="red", id="a")
188
+ expected.polygon(0, [(1.5, 0.2, 0), (2, 0, 0), (1.5, -0.2, 0)], fill="red", id="a-head")
189
+ assert scene.to_svg_document() == expected.to_svg_document()
190
+
191
+ def test_on_a_curve_the_head_follows_the_curve_to_its_end(self, cam: Camera) -> None:
192
+ flow = vecview.arc_shape((0, 0, 0), (1, 0, 0), (0, 1, 0), 2.0, 0, 90, n=90)
193
+ top = Scene(OrthographicCamera(0.0, 90.0, 1.0))
194
+ top.line_arrow(0, flow, normal=(0, 0, 1), head_w=0.2, head_len=0.3, stroke="red")
195
+ line, head = drawn(top)
196
+ assert isinstance(line, svg.Polyline) and isinstance(head, svg.Polygon)
197
+ tip = top.camera.project(flow[-1])
198
+ assert np.allclose(xy(head)[1], tip, atol=0.01)
199
+ neck = xy(line)[-1]
200
+ assert np.linalg.norm(neck - top.camera.project((0, 0, 0))) == pytest.approx(2.0, abs=0.01)
201
+ assert np.linalg.norm(neck - tip) == pytest.approx(0.3, abs=0.01), "head_len along it"
202
+
203
+ def test_halfway_the_head_is_centred_and_the_line_runs_through(self, scene: Scene) -> None:
204
+ path = [(0, 0, 0), (2, 0, 0)]
205
+ scene.line_arrow(0, path, normal=(0, 0, 1), head_w=0.4, head_len=0.5, at=0.5, stroke="k")
206
+ line, head = drawn(scene)
207
+ whole = Scene(scene.camera)
208
+ whole.polyline(0, path, stroke="k")
209
+ assert line == drawn(whole)[0]
210
+ mid = scene.camera.project((1, 0, 0))
211
+ corners = xy(head)
212
+ assert np.allclose((corners[0] + corners[2]) / 2 + (corners[1] - mid), mid, atol=0.02)
213
+
214
+ def test_a_head_longer_than_the_path_is_all_head(self, scene: Scene) -> None:
215
+ scene.line_arrow(0, [(0, 0, 0), (1, 0, 0)], normal=(0, 0, 1), head_w=0.4, head_len=3.0)
216
+ (head,) = drawn(scene)
217
+ assert isinstance(head, svg.Polygon)
218
+
219
+ def test_camera_normal_shows_the_full_head_width(self, scene: Scene, cam: Camera) -> None:
220
+ path = [(0, 0, 0), (0, 0, 2)]
221
+ scene.line_arrow(0, path, normal="camera", head_w=0.5, head_len=0.4, stroke="k")
222
+ _, head = drawn(scene)
223
+ corners = xy(head)
224
+ assert np.linalg.norm(corners[0] - corners[2]) == pytest.approx(0.5 * cam.scale, abs=0.02)
225
+
226
+ def test_the_head_takes_the_line_colour_and_opacity(self, scene: Scene) -> None:
227
+ scene.line_arrow(
228
+ 0,
229
+ [(0, 0, 0), (2, 0, 0)],
230
+ normal=(0, 0, 1),
231
+ head_w=0.4,
232
+ head_len=0.5,
233
+ stroke="#c00",
234
+ stroke_opacity=0.5,
235
+ opacity=0.8,
236
+ stroke_dasharray="2 1",
237
+ )
238
+ _, head = drawn(scene)
239
+ assert (head.fill, head.fill_opacity, head.opacity) == ("#c00", 0.5, 0.8)
240
+ assert head.stroke_dasharray is None
241
+
242
+ def test_rejects_a_head_along_its_normal(self, scene: Scene) -> None:
243
+ scene.line_arrow(0, [(0, 0, 0), (0, 0, 1)], normal=(0, 0, 1), head_w=0.2, head_len=0.2)
244
+ with pytest.raises(ValueError, match="along normal"):
245
+ scene.render()
246
+
247
+ def test_moves_with_a_part(self, scene: Scene, cam: Camera) -> None:
248
+ part = vecview.Part()
249
+ part.line_arrow(0, [(0, 0, 0), (1, 0, 0)], normal=(0, 0, 1), head_w=0.2, head_len=0.2)
250
+ scene.place(0, part, at=(0, 1, 0), rotate=((0, 0, 1), 90), scale=2)
251
+ expected = Scene(cam)
252
+ expected.line_arrow(0, [(0, 1, 0), (0, 3, 0)], normal=(0, 0, 1), head_w=0.4, head_len=0.4)
253
+ assert scene.to_svg_document() == expected.to_svg_document()
254
+
255
+ @pytest.mark.parametrize(
256
+ ("path", "kwargs", "match"),
257
+ [
258
+ ([(0, 0, 0), (0, 0, 0)], {}, "two distinct points"),
259
+ ([(0, 0, 0), (1, 0, 0)], {"at": 1.5}, "between 0 and 1"),
260
+ ([(0, 0, 0), (1, 0, 0)], {"normal": "viewer"}, "camera"),
261
+ ],
262
+ )
263
+ def test_is_checked_where_it_is_made(self, path: list, kwargs: dict, match: str) -> None:
264
+ args = {"normal": (0, 0, 1), "head_w": 0.2, "head_len": 0.2, **kwargs}
265
+ with pytest.raises(ValueError, match=match):
266
+ Scene().line_arrow(0, path, **args)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes