vecview 0.4.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.
- {vecview-0.4.0 → vecview-0.6.0}/AGENTS.md +6 -2
- {vecview-0.4.0 → vecview-0.6.0}/CHANGELOG.md +35 -0
- {vecview-0.4.0 → vecview-0.6.0}/PKG-INFO +24 -17
- {vecview-0.4.0 → vecview-0.6.0}/README.md +22 -16
- {vecview-0.4.0 → vecview-0.6.0}/docs/development.md +6 -4
- {vecview-0.4.0 → vecview-0.6.0}/docs/gallery/aharonov_bohm_ring.svg +4 -4
- {vecview-0.4.0 → vecview-0.6.0}/docs/gallery/altermagnetic_dot.svg +1 -1
- {vecview-0.4.0 → vecview-0.6.0}/docs/gallery/bloch_sphere.svg +1 -1
- {vecview-0.4.0 → vecview-0.6.0}/docs/gallery/brillouin_zone.svg +1 -1
- {vecview-0.4.0 → vecview-0.6.0}/docs/gallery/dirac_cone.svg +1 -1
- {vecview-0.4.0 → vecview-0.6.0}/docs/gallery/fullerene.svg +1 -1
- {vecview-0.4.0 → vecview-0.6.0}/docs/gallery/kitaev_chain.svg +1 -1
- {vecview-0.4.0 → vecview-0.6.0}/docs/gallery/mirror_planes.svg +1 -1
- {vecview-0.4.0 → vecview-0.6.0}/docs/gallery/perovskite.svg +1 -1
- {vecview-0.4.0 → vecview-0.6.0}/docs/gallery/skyrmion.svg +1 -1
- {vecview-0.4.0 → vecview-0.6.0}/docs/gallery/slab_polarizer.svg +1 -1
- {vecview-0.4.0 → vecview-0.6.0}/docs/gallery/solenoid.svg +1 -1
- {vecview-0.4.0 → vecview-0.6.0}/docs/index.md +1 -1
- {vecview-0.4.0 → vecview-0.6.0}/docs/scenes.md +54 -2
- {vecview-0.4.0 → vecview-0.6.0}/docs/shapes.md +42 -4
- {vecview-0.4.0 → vecview-0.6.0}/examples/aharonov_bohm_ring.py +7 -12
- {vecview-0.4.0 → vecview-0.6.0}/pyproject.toml +2 -1
- {vecview-0.4.0 → vecview-0.6.0}/src/vecview/__init__.py +3 -1
- {vecview-0.4.0 → vecview-0.6.0}/src/vecview/_canvas.py +70 -1
- vecview-0.6.0/src/vecview/_cut.py +121 -0
- {vecview-0.4.0 → vecview-0.6.0}/src/vecview/_drawing.py +123 -1
- vecview-0.6.0/src/vecview/_face.py +34 -0
- vecview-0.6.0/src/vecview/_line_art.py +120 -0
- {vecview-0.4.0 → vecview-0.6.0}/src/vecview/_place.py +5 -0
- {vecview-0.4.0 → vecview-0.6.0}/src/vecview/_vec.py +24 -0
- {vecview-0.4.0 → vecview-0.6.0}/src/vecview/shapes.py +145 -131
- {vecview-0.4.0 → vecview-0.6.0}/tests/test_arrows.py +112 -1
- {vecview-0.4.0 → vecview-0.6.0}/tests/test_parts.py +2 -0
- {vecview-0.4.0 → vecview-0.6.0}/tests/test_shapes.py +102 -0
- {vecview-0.4.0 → vecview-0.6.0}/tests/test_solids.py +71 -0
- {vecview-0.4.0 → vecview-0.6.0}/.gitignore +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/LICENSE +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/docs/animation.md +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/docs/cameras.md +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/docs/embedding.md +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/docs/gallery.md +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/docs/images/readme.svg +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/docs/outlines.md +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/docs/readme_figure.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/examples/README.md +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/examples/__main__.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/examples/altermagnetic_dot.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/examples/bloch_sphere.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/examples/brillouin_zone.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/examples/dirac_cone.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/examples/fullerene.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/examples/kitaev_chain.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/examples/mirror_planes.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/examples/pendulum.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/examples/perovskite.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/examples/rotating_dipole.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/examples/skyrmion.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/examples/slab_polarizer.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/examples/solenoid.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/src/vecview/_animation_refs.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/src/vecview/_animation_svg.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/src/vecview/_elements.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/src/vecview/_numeric.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/src/vecview/_occlusion.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/src/vecview/_planar.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/src/vecview/_solid_drawing.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/src/vecview/_solids.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/src/vecview/_tracks.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/src/vecview/_transforms.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/src/vecview/_types.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/src/vecview/animation.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/src/vecview/camera.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/src/vecview/outlines.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/src/vecview/projections.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/src/vecview/py.typed +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/src/vecview/scene.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/tests/test_animation.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/tests/test_camera.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/tests/test_document.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/tests/test_occlusion.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/tests/test_outlines.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/tests/test_package_metadata.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/tests/test_planes.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/tests/test_projections.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/tests/test_regions.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/tests/test_scene.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/tests/test_tracked_scenes.py +0 -0
- {vecview-0.4.0 → vecview-0.6.0}/zensical.toml +0 -0
|
@@ -38,8 +38,12 @@ on its own side.
|
|
|
38
38
|
`_animation_svg.py` and `_animation_refs.py`. `_drawing.py` imports it only
|
|
39
39
|
to check what `slot` is given, and `_occlusion.py` only for a type.
|
|
40
40
|
`shapes.py`, `camera.py`, `projections.py`, `_place.py`,
|
|
41
|
-
`_solid_drawing.py`, `_planar.py`, `_tracks.py`,
|
|
42
|
-
do.
|
|
41
|
+
`_solid_drawing.py`, `_planar.py`, `_tracks.py`, `_transforms.py`, `_face.py`,
|
|
42
|
+
`_cut.py`, and `_line_art.py` never do.
|
|
43
|
+
- `shapes.py` re-exports `Face` from `_face.py`, which `_cut.py` (cutting a
|
|
44
|
+
solid open) shares, and `cut` from `_cut.py`. `_line_art.py` decides which
|
|
45
|
+
edges of a faceted solid to ink from which faces face the camera, which the
|
|
46
|
+
canvas passes in: numbers only, tested without a camera.
|
|
43
47
|
- `animation.py` samples a pure time-to-scene callback through the static
|
|
44
48
|
renderer and writes once what every frame draws alike. A scene holding tracks
|
|
45
49
|
is that callback underneath: a drawing call given a `Track` anywhere in its
|
|
@@ -5,6 +5,41 @@ 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
|
+
|
|
22
|
+
## [0.5.0] - 2026-11-09
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- `revolve(profile, *, sweep_deg=(0, 360), axis=(0, 0, 1), origin=(0, 0, 0), n=96)`:
|
|
27
|
+
an `(r, z)` profile, with holes if it has them, turned about an axis into a
|
|
28
|
+
closed solid of faceted walls. A partial turn is capped by the profile as
|
|
29
|
+
faces `"start"` and `"end"`, the section of a cutaway. Facets are named
|
|
30
|
+
`"side-{i}-{j}"` by profile edge and step; facets beside the axis are
|
|
31
|
+
triangles.
|
|
32
|
+
- `Scene.line_art(layer, faces, *, crease_deg=30.0, back=None, **style)`: a
|
|
33
|
+
solid's silhouette, creases, and open rims as continuous lines, without the
|
|
34
|
+
seams between facets, so a faceted solid reads as curved and any solid can
|
|
35
|
+
be drawn as a technical drawing. On a closed solid the far side takes the
|
|
36
|
+
`back` style; in a sorted layer, anything in front hides lines exactly.
|
|
37
|
+
|
|
38
|
+
### Fixed
|
|
39
|
+
|
|
40
|
+
- `vecview.shapes.__all__` lists `extrude`, which `from vecview.shapes import *`
|
|
41
|
+
missed.
|
|
42
|
+
|
|
8
43
|
## [0.4.0] - 2026-10-16
|
|
9
44
|
|
|
10
45
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: vecview
|
|
3
|
-
Version: 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.
|
|
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.
|
|
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.
|
|
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.
|
|
@@ -160,6 +164,8 @@ native element or group:
|
|
|
160
164
|
- `highlight="#fff"` shades any of them with a gradient: a fill style, fixed on
|
|
161
165
|
screen, not a lighting model.
|
|
162
166
|
|
|
167
|
+
`line_art(layer, faces)` inks any faceted solid as a technical drawing --
|
|
168
|
+
silhouette, creases, and rims, without the seams between facets -- and
|
|
163
169
|
`edges(layer, faces, back={...})` draws a convex solid's edges and dashes the
|
|
164
170
|
hidden ones, and `sphere_curve` splits a curve on a sphere where it passes behind.
|
|
165
171
|
Labels can be `svg.TSpan` runs, for subscripts.
|
|
@@ -192,6 +198,7 @@ cameras, styles, or SVG, which keeps them testable as numbers:
|
|
|
192
198
|
| `surface_faces(x, y, z)` | the quads of a sampled surface, such as a band structure |
|
|
193
199
|
| `convex_polyhedron(vertices)` | a Brillouin zone or coordination polyhedron from its corners |
|
|
194
200
|
| `trim_corners(faces, r)` | faces cut back from atoms sitting on their corners |
|
|
201
|
+
| `revolve(profile, sweep_deg=...)` | an `(r, z)` profile turned about an axis, whole or part-way with its section capped: a lathe |
|
|
195
202
|
| `cut(faces, origin, normal)` | a solid cut open by a plane, the cut capped: a cutaway |
|
|
196
203
|
| `in_plane_dir(angle_deg, u, v)` | a unit direction at an angle within a plane |
|
|
197
204
|
|
|
@@ -263,7 +270,7 @@ scene.slot(
|
|
|
263
270
|
a string, rendered by the active camera. That method is the whole embedding
|
|
264
271
|
contract: any tool that accepts an object exposing it can place a scene, without
|
|
265
272
|
VecView knowing about the tool. The fitted viewBox usually does *not* start at
|
|
266
|
-
`0, 0`, so a consumer must honour its origin. See [Embedding a scene](https://github.com/maiani/vecview/blob/v0.
|
|
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).
|
|
267
274
|
|
|
268
275
|
In Jupyter a scene displays itself inline. Rasterizing and PDF export are out of
|
|
269
276
|
scope; they belong to whatever assembles the final page.
|
|
@@ -285,11 +292,11 @@ vecview.Animation(scene, duration=6.283, view_box=(-150, -110, 300, 220)).save("
|
|
|
285
292
|
|
|
286
293
|
`Track` with keyframes and easing, turning parts about a pivot, and frame
|
|
287
294
|
callbacks for anything else are in `vecview.animation`; see the [animation
|
|
288
|
-
guide](https://github.com/maiani/vecview/blob/v0.
|
|
295
|
+
guide](https://github.com/maiani/vecview/blob/v0.6.0/docs/animation.md).
|
|
289
296
|
|
|
290
297
|
## Examples
|
|
291
298
|
|
|
292
|
-
The [gallery](https://github.com/maiani/vecview/blob/v0.
|
|
299
|
+
The [gallery](https://github.com/maiani/vecview/blob/v0.6.0/docs/gallery.md) has the static figures everyone draws — a perovskite
|
|
293
300
|
cell, the fcc Brillouin zone, C60, the Bloch sphere, a Dirac cone, a skyrmion, a
|
|
294
301
|
solenoid, crossing mirror planes, an Aharonov–Bohm ring, and two device sketches — and two
|
|
295
302
|
animations, a pendulum and a rotating dipole radiating. Each is one
|
|
@@ -304,7 +311,7 @@ uv run python examples/slab_polarizer.py --projection all # all five
|
|
|
304
311
|
uv run python examples/altermagnetic_dot.py --projection all # a device sketch, under four cameras
|
|
305
312
|
```
|
|
306
313
|
|
|
307
|
-
See [examples/README.md](https://github.com/maiani/vecview/blob/v0.
|
|
314
|
+
See [examples/README.md](https://github.com/maiani/vecview/blob/v0.6.0/examples/README.md) for the full list and what each
|
|
308
315
|
needs; several typeset their labels with
|
|
309
316
|
[VecTeX](https://github.com/maiani/vectex), which needs TeX.
|
|
310
317
|
|
|
@@ -340,15 +347,15 @@ VecView depends on none of them and contains no code specific to any of them.
|
|
|
340
347
|
|
|
341
348
|
## Documentation
|
|
342
349
|
|
|
343
|
-
- [Overview](https://github.com/maiani/vecview/blob/v0.
|
|
344
|
-
- [Cameras](https://github.com/maiani/vecview/blob/v0.
|
|
345
|
-
- [Scenes and layers](https://github.com/maiani/vecview/blob/v0.
|
|
346
|
-
- [Shapes](https://github.com/maiani/vecview/blob/v0.
|
|
347
|
-
- [Outlines](https://github.com/maiani/vecview/blob/v0.
|
|
348
|
-
- [Animation](https://github.com/maiani/vecview/blob/v0.
|
|
349
|
-
- [Gallery](https://github.com/maiani/vecview/blob/v0.
|
|
350
|
-
- [Embedding a scene](https://github.com/maiani/vecview/blob/v0.
|
|
351
|
-
- [Development](https://github.com/maiani/vecview/blob/v0.
|
|
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)
|
|
352
359
|
|
|
353
360
|
## License
|
|
354
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.
|
|
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.
|
|
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.
|
|
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.
|
|
@@ -130,6 +133,8 @@ native element or group:
|
|
|
130
133
|
- `highlight="#fff"` shades any of them with a gradient: a fill style, fixed on
|
|
131
134
|
screen, not a lighting model.
|
|
132
135
|
|
|
136
|
+
`line_art(layer, faces)` inks any faceted solid as a technical drawing --
|
|
137
|
+
silhouette, creases, and rims, without the seams between facets -- and
|
|
133
138
|
`edges(layer, faces, back={...})` draws a convex solid's edges and dashes the
|
|
134
139
|
hidden ones, and `sphere_curve` splits a curve on a sphere where it passes behind.
|
|
135
140
|
Labels can be `svg.TSpan` runs, for subscripts.
|
|
@@ -162,6 +167,7 @@ cameras, styles, or SVG, which keeps them testable as numbers:
|
|
|
162
167
|
| `surface_faces(x, y, z)` | the quads of a sampled surface, such as a band structure |
|
|
163
168
|
| `convex_polyhedron(vertices)` | a Brillouin zone or coordination polyhedron from its corners |
|
|
164
169
|
| `trim_corners(faces, r)` | faces cut back from atoms sitting on their corners |
|
|
170
|
+
| `revolve(profile, sweep_deg=...)` | an `(r, z)` profile turned about an axis, whole or part-way with its section capped: a lathe |
|
|
165
171
|
| `cut(faces, origin, normal)` | a solid cut open by a plane, the cut capped: a cutaway |
|
|
166
172
|
| `in_plane_dir(angle_deg, u, v)` | a unit direction at an angle within a plane |
|
|
167
173
|
|
|
@@ -233,7 +239,7 @@ scene.slot(
|
|
|
233
239
|
a string, rendered by the active camera. That method is the whole embedding
|
|
234
240
|
contract: any tool that accepts an object exposing it can place a scene, without
|
|
235
241
|
VecView knowing about the tool. The fitted viewBox usually does *not* start at
|
|
236
|
-
`0, 0`, so a consumer must honour its origin. See [Embedding a scene](https://github.com/maiani/vecview/blob/v0.
|
|
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).
|
|
237
243
|
|
|
238
244
|
In Jupyter a scene displays itself inline. Rasterizing and PDF export are out of
|
|
239
245
|
scope; they belong to whatever assembles the final page.
|
|
@@ -255,11 +261,11 @@ vecview.Animation(scene, duration=6.283, view_box=(-150, -110, 300, 220)).save("
|
|
|
255
261
|
|
|
256
262
|
`Track` with keyframes and easing, turning parts about a pivot, and frame
|
|
257
263
|
callbacks for anything else are in `vecview.animation`; see the [animation
|
|
258
|
-
guide](https://github.com/maiani/vecview/blob/v0.
|
|
264
|
+
guide](https://github.com/maiani/vecview/blob/v0.6.0/docs/animation.md).
|
|
259
265
|
|
|
260
266
|
## Examples
|
|
261
267
|
|
|
262
|
-
The [gallery](https://github.com/maiani/vecview/blob/v0.
|
|
268
|
+
The [gallery](https://github.com/maiani/vecview/blob/v0.6.0/docs/gallery.md) has the static figures everyone draws — a perovskite
|
|
263
269
|
cell, the fcc Brillouin zone, C60, the Bloch sphere, a Dirac cone, a skyrmion, a
|
|
264
270
|
solenoid, crossing mirror planes, an Aharonov–Bohm ring, and two device sketches — and two
|
|
265
271
|
animations, a pendulum and a rotating dipole radiating. Each is one
|
|
@@ -274,7 +280,7 @@ uv run python examples/slab_polarizer.py --projection all # all five
|
|
|
274
280
|
uv run python examples/altermagnetic_dot.py --projection all # a device sketch, under four cameras
|
|
275
281
|
```
|
|
276
282
|
|
|
277
|
-
See [examples/README.md](https://github.com/maiani/vecview/blob/v0.
|
|
283
|
+
See [examples/README.md](https://github.com/maiani/vecview/blob/v0.6.0/examples/README.md) for the full list and what each
|
|
278
284
|
needs; several typeset their labels with
|
|
279
285
|
[VecTeX](https://github.com/maiani/vectex), which needs TeX.
|
|
280
286
|
|
|
@@ -310,15 +316,15 @@ VecView depends on none of them and contains no code specific to any of them.
|
|
|
310
316
|
|
|
311
317
|
## Documentation
|
|
312
318
|
|
|
313
|
-
- [Overview](https://github.com/maiani/vecview/blob/v0.
|
|
314
|
-
- [Cameras](https://github.com/maiani/vecview/blob/v0.
|
|
315
|
-
- [Scenes and layers](https://github.com/maiani/vecview/blob/v0.
|
|
316
|
-
- [Shapes](https://github.com/maiani/vecview/blob/v0.
|
|
317
|
-
- [Outlines](https://github.com/maiani/vecview/blob/v0.
|
|
318
|
-
- [Animation](https://github.com/maiani/vecview/blob/v0.
|
|
319
|
-
- [Gallery](https://github.com/maiani/vecview/blob/v0.
|
|
320
|
-
- [Embedding a scene](https://github.com/maiani/vecview/blob/v0.
|
|
321
|
-
- [Development](https://github.com/maiani/vecview/blob/v0.
|
|
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)
|
|
322
328
|
|
|
323
329
|
## License
|
|
324
330
|
|
|
@@ -54,8 +54,10 @@ dimetric, and trimetric cases.
|
|
|
54
54
|
Rasterizing, PDF, and TeX belong to a consumer, not here. A test enforces
|
|
55
55
|
this. `shapely` clips polygons and `contourpy` traces depth contours; both
|
|
56
56
|
load only when they are first needed.
|
|
57
|
-
- **Keep the three-way split**: `shapes` knows only numbers,
|
|
58
|
-
`
|
|
57
|
+
- **Keep the three-way split**: `shapes` knows only numbers, and so do its
|
|
58
|
+
private helpers `_face` (the `Face` record), `_cut`, and `_line_art` (which
|
|
59
|
+
edges of a faceted solid to ink, given which faces face the camera); `camera`
|
|
60
|
+
and `projections` know projection; and `scene` and `animation`, with their
|
|
59
61
|
private rendering modules (`_elements`, `_canvas`, `_solids`,
|
|
60
62
|
`_animation_svg`, `_animation_refs`), are the only code that touches
|
|
61
63
|
`svg.py`. Geometry that needs a camera to be computed does not belong in
|
|
@@ -132,8 +134,8 @@ uv run zensical build
|
|
|
132
134
|
`.github/workflows/publish.yml` publishes tags named `v<version>`. It checks
|
|
133
135
|
that the tag matches `pyproject.toml`, runs the CI matrix against that tag,
|
|
134
136
|
builds both distributions (the wheel from the sdist), and runs
|
|
135
|
-
`twine check --strict` before publishing the same artifacts.
|
|
136
|
-
|
|
137
|
+
`twine check --strict` before publishing the same artifacts. Every job, Python
|
|
138
|
+
3.12 to 3.15, must pass.
|
|
137
139
|
|
|
138
140
|
Publishing goes through a
|
|
139
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
|
|
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.
|
|
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="
|
|
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="
|
|
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"/>
|
|
@@ -2247,7 +2247,7 @@
|
|
|
2247
2247
|
<cc:Work>
|
|
2248
2248
|
<dc:creator>
|
|
2249
2249
|
<cc:Agent>
|
|
2250
|
-
<dc:title>VecView v0.
|
|
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>
|
|
@@ -2938,7 +2938,7 @@
|
|
|
2938
2938
|
<cc:Work>
|
|
2939
2939
|
<dc:creator>
|
|
2940
2940
|
<cc:Agent>
|
|
2941
|
-
<dc:title>VecView v0.
|
|
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>
|
|
@@ -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.
|
|
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
|
|
|
@@ -343,11 +371,35 @@ consumer selects.
|
|
|
343
371
|
## Hidden lines
|
|
344
372
|
|
|
345
373
|
```python
|
|
374
|
+
scene.line_art(layer, faces, *, crease_deg=30.0, back=None, **style)
|
|
346
375
|
scene.edges(layer, faces, back=None, back_layer=None, separate=False, trim=0.0, **style)
|
|
347
376
|
scene.sphere_curve(layer, center, points3, closed=False, back=None, back_layer=None, **style)
|
|
348
377
|
```
|
|
349
378
|
|
|
350
|
-
`
|
|
379
|
+
`line_art` inks any solid given as faces the way a technical drawing would:
|
|
380
|
+
its silhouette, where a face toward the camera meets one away from it; its
|
|
381
|
+
creases, where faces meet at more than `crease_deg`; and the rim of an open
|
|
382
|
+
surface. The seams between facets of one smooth surface are left out, so a
|
|
383
|
+
solid from [`revolve`](shapes.md#turned-solids) or `surface_faces` reads as
|
|
384
|
+
curved, and the drawn edges are joined into continuous lines. On a closed
|
|
385
|
+
solid, lines whose faces all face away are on the far side: dropped, or drawn
|
|
386
|
+
with `{**style, **back}`. What else hides a line — another solid, or a fold of
|
|
387
|
+
this one — is found exactly in a [sorted layer](#sorting-by-depth), where the
|
|
388
|
+
solid's own faces, drawn unstroked in the same layer, hide what is behind them;
|
|
389
|
+
there a near-side line takes the `back` style where a surface hides it:
|
|
390
|
+
|
|
391
|
+
```python
|
|
392
|
+
body = vecview.revolve(profile, sweep_deg=(45, 315))
|
|
393
|
+
scene.faces(20, body, fill="white")
|
|
394
|
+
scene.line_art(20, body, stroke="#222", back={"stroke_dasharray": "3 2"}, id="body")
|
|
395
|
+
scene.sort_by_depth(20)
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
The silhouette changes with the view, so each camera recomputes it. Raise
|
|
399
|
+
`crease_deg` for a coarsely faceted surface whose seams would otherwise count as
|
|
400
|
+
creases.
|
|
401
|
+
|
|
402
|
+
`edges` draws every edge of a convex solid, visible ones with `style`. An edge is
|
|
351
403
|
visible when either face it bounds faces the camera, which is exact for a convex
|
|
352
404
|
solid. Hidden edges are dropped unless `back` is given, in which case they get
|
|
353
405
|
`{**style, **back}` — the crystallographer's dashed back edges — on `back_layer`,
|
|
@@ -380,7 +432,7 @@ dashed = {"stroke_dasharray": "3 3"}
|
|
|
380
432
|
scene.sphere_curve(20, (0, 0, 0), equator, closed=True, back=dashed, back_layer=5, stroke="#333")
|
|
381
433
|
```
|
|
382
434
|
|
|
383
|
-
An `id` becomes `{id}-front` and `{id}-back` for
|
|
435
|
+
An `id` becomes `{id}-front` and `{id}-back` for all three calls, suffixed `-0`, `-1`,
|
|
384
436
|
… per edge when `separate`. Both re-split for
|
|
385
437
|
[each camera](#rendering-one-scene-several-ways).
|
|
386
438
|
|