@altpsyche/maths 0.9.3 → 0.9.5
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.
- package/README.md +37 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -195,11 +195,11 @@ decides which of those a piece is, by counting how many times the other path win
|
|
|
195
195
|
`areaOf` says how much a path encloses, in closed form rather than by sampling, which is what every
|
|
196
196
|
claim above is checked against.
|
|
197
197
|
|
|
198
|
-
<img src="docs/boolean-strip.svg" width="
|
|
198
|
+
<img src="docs/boolean-strip.svg" width="820" alt="Four moments in two rows, each showing the three panels, as the small disc walks from clear of the large one, through touching it at one point, through overlapping it, to sitting wholly inside it.">
|
|
199
199
|
|
|
200
|
-
Four times of one figure. A small disc walks across a larger one: clear of it, touching
|
|
201
|
-
point, crossing it at two, and wholly inside it. Those are the four cases this kind of code
|
|
202
|
-
silently wrong, which is why the demo walks through all of them rather than drawing one.
|
|
200
|
+
Four times of one figure, in two rows. A small disc walks across a larger one: clear of it, touching
|
|
201
|
+
it at one point, crossing it at two, and wholly inside it. Those are the four cases this kind of code
|
|
202
|
+
gets silently wrong, which is why the demo walks through all of them rather than drawing one.
|
|
203
203
|
|
|
204
204
|
Two shapes that share an edge are combined by which way each of them runs over it. Two paths walking
|
|
205
205
|
a shared stretch the same way have their solid on the same side of it, so the stretch is on the edge
|
|
@@ -212,23 +212,51 @@ When the pieces kept will not join into a loop, the operation stops and says how
|
|
|
212
212
|
ends of the run it had are. That happens when an input crosses itself, which these do not take. A
|
|
213
213
|
shape drawn with a gap in it and nothing said about it is the one failure a caller cannot see.
|
|
214
214
|
|
|
215
|
+
## A turn about a point
|
|
216
|
+
|
|
217
|
+
<img src="docs/rotate.svg" width="720" alt="Two panels side by side, each an L-shaped block turned part way round with a dot marking the point it turns about. In the left panel the dot sits at the middle of the block's own box. In the right it sits off to one side, so the block swings round it. A word rides with the block in both panels and stays upright.">
|
|
218
|
+
|
|
219
|
+
`rotate(target, angle)` turns the marks a name reaches, over a span of the timeline. The point it
|
|
220
|
+
turns about is the middle of the box round those marks unless a figure names one, and it is read off
|
|
221
|
+
them as they arrive rather than after the turn has moved them. The box round a turned shape is not the
|
|
222
|
+
turned box, so reading it back afterwards would let the pivot drift and the turn would stop being a
|
|
223
|
+
turn.
|
|
224
|
+
|
|
225
|
+
The left panel takes that default and spins where it stands. The right panel is given a point off to
|
|
226
|
+
one side, so the same shape swings round it instead. The furthest corner of the left shape stays 1.00
|
|
227
|
+
figure units from its pivot at every time and the right one's stays 2.34, which is what makes the two
|
|
228
|
+
read as different motions rather than as the same one twice.
|
|
229
|
+
|
|
230
|
+
A word rides with the shape in both panels and stays upright the whole way round. A mark carries no
|
|
231
|
+
rotation of its own, so turning the words would be work in both painters for a label that is easier to
|
|
232
|
+
read left as it is, which is the same reason a number line takes a direction rather than being turned
|
|
233
|
+
on its side.
|
|
234
|
+
|
|
235
|
+
A turn does not thicken a line. A stroke's width is multiplied by how much the transform stretches a
|
|
236
|
+
length, and a rotation stretches nothing, where `scale` stretches by the factor it grew by.
|
|
237
|
+
|
|
238
|
+
<img src="docs/rotate-strip.svg" width="820" alt="Four frames in two rows, each showing both panels, at nothing, a quarter, a half and three quarters of the way round.">
|
|
239
|
+
|
|
240
|
+
The quarters of the turn. The whole turn is left off the strip because it draws the picture that
|
|
241
|
+
nothing draws: this is the first figure here to declare itself a loop, and `loops(figure)` is the gate
|
|
242
|
+
behind that flag, comparing the marks at the duration against the marks at zero.
|
|
243
|
+
|
|
215
244
|
## The animations
|
|
216
245
|
|
|
217
246
|
`fadeIn`, `fadeOut`, `fadeTo`, `draw`, `morph`, `morphEquation`, `countTo`, `moveBy`, `rotate`,
|
|
218
247
|
`scale`, `growFrom`, `moveAlong`, `indicate`, `flash` and `circumscribe`. A `Timeline` plays them in order, plays several `together`, or
|
|
219
248
|
`stagger`s a row so its parts arrive one after another.
|
|
220
249
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
itself rather than from the points the curve is written from.
|
|
250
|
+
`boundsOf` is the box a turn and a growth are worked about, found from where each piece of the curve
|
|
251
|
+
turns back on itself rather than from the points the curve is written from.
|
|
224
252
|
|
|
225
253
|
`moveAlong` carries a mark along a path at one speed, measured by the path's length. Even steps in a
|
|
226
254
|
curve's own parameter are uneven steps along the curve: a step covers more of it where the curve is
|
|
227
255
|
moving fast, which on a quarter circle is a 6.9% difference between the longest step and the shortest
|
|
228
256
|
and on the demo's own walk is 82%.
|
|
229
257
|
|
|
230
|
-
|
|
231
|
-
|
|
258
|
+
Every picture here is written by `svgMarkup`, which needs no browser, so `npm run demos` regenerates
|
|
259
|
+
all six and a test compares the bytes against the committed files.
|
|
232
260
|
|
|
233
261
|
## What it is built on
|
|
234
262
|
|
package/package.json
CHANGED