@altpsyche/maths 0.4.0 → 0.4.1

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.
@@ -19,7 +19,7 @@ import { interval } from '../values/interval.js';
19
19
  import { vec2 } from '../values/vec2.js';
20
20
  import { pointOf, scaled } from './scale.js';
21
21
  import { group, shape } from './node.js';
22
- import { line, rect, straight } from './path.js';
22
+ import { line, polygon, straight } from './path.js';
23
23
  /**
24
24
  * How many pieces a curve is cut into when a figure does not say.
25
25
  *
@@ -199,9 +199,12 @@ export function riemannBars(name, coords, of, options = {}) {
199
199
  if (!Number.isFinite(y))
200
200
  continue;
201
201
  const top = interval.clampTo(coords.y.graph, y);
202
+ // Built from its four corners rather than from a corner and a size. A bar
203
+ // whose top is held on the graph's own edge has that edge as an exact
204
+ // number, and adding a height back on to the near corner overshoots it.
202
205
  const corner = pointOf(coords, left, foot);
203
206
  const far = pointOf(coords, right, top);
204
- children.push(shape(String(bar), rect(corner, far.x - corner.x, far.y - corner.y), {}));
207
+ children.push(shape(String(bar), polygon([corner, vec2(far.x, corner.y), far, vec2(corner.x, far.y)]), {}));
205
208
  }
206
209
  return group(name, children, { style: { fill: options.fill, stroke: options.stroke } });
207
210
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altpsyche/maths",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "The mathematics AltPsyche's figures are drawn from: vectors, matrices, curves, and a value walked over time.",
5
5
  "license": "MIT",
6
6
  "author": "Siva",