@nakafa/aksara-contracts 8.4.0 → 8.8.0
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/dist/assessment/document.d.ts +1 -1
- package/dist/assessment/document.js +1 -1
- package/dist/assessment/figure.d.ts +1 -1
- package/dist/assessment/figure.js +1 -1
- package/dist/assessment/fit.d.ts +3 -3
- package/dist/assessment/fit.js +3 -3
- package/dist/assessment/locales.d.ts +1 -1
- package/dist/assessment/scoring.d.ts +1 -1
- package/dist/assessment/scoring.js +1 -1
- package/dist/cache/content.d.ts +1 -1
- package/dist/cache/content.js +1 -1
- package/dist/content.d.ts +3 -2
- package/dist/graph/identity.d.ts +1 -1
- package/dist/graph/identity.js +1 -1
- package/dist/hash/sha256.d.ts +16 -0
- package/dist/hash/sha256.js +164 -0
- package/dist/hash/stream.d.ts +7 -5
- package/dist/hash/stream.js +13 -18
- package/dist/math/boundary.js +3 -22
- package/dist/math/bounds.d.ts +1 -1
- package/dist/math/collision.d.ts +1 -1
- package/dist/math/coordinate.d.ts +6 -5
- package/dist/math/coordinate.js +2 -2
- package/dist/math/edge.d.ts +11 -0
- package/dist/math/edge.js +74 -0
- package/dist/math/formula/compile.d.ts +1 -1
- package/dist/math/formula/compile.js +1 -1
- package/dist/math/formula/contour.d.ts +1 -1
- package/dist/math/formula/contour.js +1 -1
- package/dist/math/formula/field.js +1 -1
- package/dist/math/formula/mesh.d.ts +1 -1
- package/dist/math/formula/mesh.js +1 -1
- package/dist/math/formula/names.d.ts +1 -1
- package/dist/math/formula/names.js +1 -1
- package/dist/math/formula/parse.d.ts +1 -1
- package/dist/math/formula/parse.js +1 -1
- package/dist/math/formula/plane.d.ts +2 -2
- package/dist/math/formula/plane.js +3 -3
- package/dist/math/formula/reader.d.ts +2 -1
- package/dist/math/formula/reader.js +1 -1
- package/dist/math/formula/region.d.ts +2 -2
- package/dist/math/formula/region.js +3 -3
- package/dist/math/formula/sample.d.ts +1 -1
- package/dist/math/formula/scan.d.ts +1 -1
- package/dist/math/formula/scan.js +1 -1
- package/dist/math/formula/slider.d.ts +2 -2
- package/dist/math/formula/slider.js +1 -1
- package/dist/math/formula/space.d.ts +1 -1
- package/dist/math/formula/space.js +1 -1
- package/dist/math/graph.d.ts +9 -0
- package/dist/math/graph.js +66 -0
- package/dist/math/plane.js +6 -0
- package/dist/math/precision.d.ts +1 -1
- package/dist/math/precision.js +1 -1
- package/dist/math/resolution.js +1 -1
- package/dist/math/scene.d.ts +2 -2
- package/dist/math/shape.d.ts +392 -0
- package/dist/math/shape.js +59 -0
- package/dist/math/straight.d.ts +13 -0
- package/dist/math/straight.js +26 -0
- package/dist/math/vector.d.ts +1 -1
- package/dist/preview/spec.js +1 -1
- package/dist/program/curriculum.d.ts +1 -1
- package/dist/program/curriculum.js +1 -1
- package/dist/program/snapshot/digest.d.ts +1 -1
- package/dist/program/snapshot/digest.js +2 -2
- package/dist/program/snapshot/hash.d.ts +2 -2
- package/dist/projection/digest.d.ts +1 -1
- package/dist/projection/digest.js +1 -1
- package/dist/projection/hash.js +1 -1
- package/dist/projection/material.d.ts +1 -1
- package/dist/projection/material.js +1 -1
- package/dist/projection/verify.js +1 -1
- package/dist/quran/identity.d.ts +2 -1
- package/dist/quran/provenance.d.ts +2 -2
- package/dist/quran/provenance.js +1 -1
- package/dist/quran/snapshot/hash.d.ts +1 -1
- package/dist/quran/snapshot/row/hash.d.ts +1 -1
- package/dist/quran/snapshot/row/hash.js +1 -1
- package/dist/quran/snapshot/spec.js +1 -1
- package/dist/quran/source.d.ts +2 -2
- package/dist/release/current/evidence.d.ts +1 -1
- package/dist/release/current/evidence.js +1 -1
- package/dist/release/current/state.d.ts +1 -1
- package/dist/release/current/state.js +1 -1
- package/dist/release/head.js +1 -1
- package/dist/release/items.d.ts +1 -1
- package/dist/release/items.js +1 -1
- package/dist/release/policy.d.ts +1 -1
- package/dist/release/policy.js +1 -1
- package/dist/release/result/digest.d.ts +3 -3
- package/dist/release/result/digest.js +2 -2
- package/dist/release/rollback/digest.d.ts +1 -1
- package/dist/release/rollback/digest.js +1 -1
- package/dist/release/route/digest.d.ts +1 -1
- package/dist/release/route/digest.js +1 -1
- package/dist/release/snapshot/evidence/assessment.d.ts +1 -1
- package/dist/release/snapshot/evidence/assessment.js +1 -1
- package/dist/release/snapshot/evidence/program.d.ts +1 -1
- package/dist/release/snapshot/evidence/program.js +1 -1
- package/dist/release/snapshot/evidence/quran.d.ts +1 -1
- package/dist/release/snapshot/evidence/quran.js +1 -1
- package/dist/release/snapshot/evidence/requirement.d.ts +3 -2
- package/dist/release/snapshot/evidence/requirement.js +1 -1
- package/dist/release/snapshot/spec.d.ts +2 -2
- package/dist/release/snapshot/spec.js +1 -1
- package/dist/release/snapshot/verify.d.ts +1 -1
- package/dist/release/snapshot/verify.js +1 -1
- package/dist/release/spec.d.ts +1 -1
- package/dist/release/verify.d.ts +1 -1
- package/dist/release/verify.js +1 -1
- package/dist/renderer/compatibility.d.ts +1 -1
- package/dist/renderer/compatibility.js +2 -2
- package/dist/renderer/contract.d.ts +1 -1
- package/dist/renderer/contract.js +1 -1
- package/dist/runtime/spec.js +2 -2
- package/dist/signature/spec.d.ts +3 -2
- package/dist/signature/verify.d.ts +2 -1
- package/dist/transport/request.d.ts +1 -1
- package/dist/visual/base/math.d.ts +1 -1
- package/dist/visual/base/media.d.ts +1 -1
- package/dist/visual/biology/bacteria.d.ts +1 -1
- package/dist/visual/biology/bacteria.js +1 -1
- package/dist/visual/biology/blood.d.ts +91 -0
- package/dist/visual/biology/blood.js +55 -0
- package/dist/visual/biology/cell.d.ts +1 -1
- package/dist/visual/biology/climate.d.ts +1 -1
- package/dist/visual/biology/climate.js +1 -1
- package/dist/visual/biology/ecology.d.ts +1 -1
- package/dist/visual/biology/heart.d.ts +92 -0
- package/dist/visual/biology/heart.js +54 -0
- package/dist/visual/biology/mitochondrion.d.ts +91 -0
- package/dist/visual/biology/mitochondrion.js +45 -0
- package/dist/visual/biology/muscle.d.ts +103 -0
- package/dist/visual/biology/muscle.js +62 -0
- package/dist/visual/biology/neuron.d.ts +97 -0
- package/dist/visual/biology/neuron.js +48 -0
- package/dist/visual/biology/paddy.d.ts +100 -0
- package/dist/visual/biology/paddy.js +54 -0
- package/dist/visual/biology/physiology.d.ts +1 -1
- package/dist/visual/biology/physiology.js +1 -1
- package/dist/visual/biology/plant.d.ts +1 -1
- package/dist/visual/biology/plant.js +1 -1
- package/dist/visual/biology/synapse.d.ts +101 -0
- package/dist/visual/biology/synapse.js +46 -0
- package/dist/visual/biology/vessel.d.ts +104 -0
- package/dist/visual/biology/vessel.js +60 -0
- package/dist/visual/biology/yeast.d.ts +108 -0
- package/dist/visual/biology/yeast.js +61 -0
- package/dist/visual/biology.d.ts +1 -1
- package/dist/visual/catalog.d.ts +2177 -778
- package/dist/visual/catalog.js +28 -0
- package/dist/visual/chemistry/atom.d.ts +1 -1
- package/dist/visual/chemistry/atom.js +1 -1
- package/dist/visual/chemistry/balance.d.ts +1 -1
- package/dist/visual/chemistry/balance.js +1 -1
- package/dist/visual/chemistry/bonding.d.ts +1 -1
- package/dist/visual/chemistry/discovery.d.ts +1 -1
- package/dist/visual/chemistry/electrochemistry.d.ts +1 -1
- package/dist/visual/chemistry/electrochemistry.js +1 -1
- package/dist/visual/chemistry/electron.d.ts +1 -1
- package/dist/visual/chemistry/electron.js +1 -1
- package/dist/visual/chemistry/laws.d.ts +1 -1
- package/dist/visual/chemistry/laws.js +1 -1
- package/dist/visual/chemistry/particles.d.ts +1 -1
- package/dist/visual/chemistry/periodic.d.ts +1 -1
- package/dist/visual/chemistry/periodic.js +1 -1
- package/dist/visual/chemistry/rate.d.ts +1 -1
- package/dist/visual/chemistry/rate.js +1 -1
- package/dist/visual/chemistry/reaction.d.ts +1 -1
- package/dist/visual/chemistry/reaction.js +1 -1
- package/dist/visual/chemistry/titration.d.ts +1 -1
- package/dist/visual/chemistry/titration.js +1 -1
- package/dist/visual/mathematics/chance.d.ts +1 -1
- package/dist/visual/mathematics/chance.js +1 -1
- package/dist/visual/mathematics/chart.d.ts +1 -1
- package/dist/visual/mathematics/charts.d.ts +1 -1
- package/dist/visual/mathematics/function.d.ts +1 -1
- package/dist/visual/mathematics/journey.d.ts +118 -0
- package/dist/visual/mathematics/journey.js +125 -0
- package/dist/visual/mathematics/logic.d.ts +90 -0
- package/dist/visual/mathematics/logic.js +49 -0
- package/dist/visual/mathematics/network.d.ts +101 -0
- package/dist/visual/mathematics/network.js +97 -0
- package/dist/visual/mathematics/numeral.d.ts +82 -1
- package/dist/visual/mathematics/numeral.js +49 -1
- package/dist/visual/mathematics/sets.d.ts +92 -0
- package/dist/visual/mathematics/sets.js +95 -0
- package/dist/visual/physics/braking.d.ts +1 -1
- package/dist/visual/physics/braking.js +1 -1
- package/dist/visual/physics/circuit.d.ts +1 -1
- package/dist/visual/physics/circular.d.ts +1 -1
- package/dist/visual/physics/circular.js +1 -1
- package/dist/visual/physics/dynamics.d.ts +1 -1
- package/dist/visual/physics/dynamics.js +1 -1
- package/dist/visual/physics/efficiency.d.ts +1 -1
- package/dist/visual/physics/efficiency.js +1 -1
- package/dist/visual/physics/electronics.d.ts +1 -1
- package/dist/visual/physics/falling.d.ts +1 -1
- package/dist/visual/physics/falling.js +1 -1
- package/dist/visual/physics/field.d.ts +1 -1
- package/dist/visual/physics/fluid.d.ts +1 -1
- package/dist/visual/physics/fluid.js +1 -1
- package/dist/visual/physics/force.d.ts +1 -1
- package/dist/visual/physics/gravity.d.ts +1 -1
- package/dist/visual/physics/heat.d.ts +1 -1
- package/dist/visual/physics/heat.js +1 -1
- package/dist/visual/physics/instrument.d.ts +1 -1
- package/dist/visual/physics/light.d.ts +1 -1
- package/dist/visual/physics/light.js +1 -1
- package/dist/visual/physics/measurement.d.ts +1 -1
- package/dist/visual/physics/measurement.js +1 -1
- package/dist/visual/physics/motion.d.ts +1 -1
- package/dist/visual/physics/nuclear.d.ts +1 -1
- package/dist/visual/physics/parabolic.d.ts +1 -1
- package/dist/visual/physics/position.d.ts +1 -1
- package/dist/visual/physics/position.js +1 -1
- package/dist/visual/physics/power.d.ts +1 -1
- package/dist/visual/physics/power.js +1 -1
- package/dist/visual/physics/precision.d.ts +1 -1
- package/dist/visual/physics/precision.js +1 -1
- package/dist/visual/physics/product.d.ts +1 -1
- package/dist/visual/physics/reading.d.ts +1 -1
- package/dist/visual/physics/reading.js +1 -1
- package/dist/visual/physics/record.d.ts +1 -1
- package/dist/visual/physics/record.js +1 -1
- package/dist/visual/physics/relative.d.ts +1 -1
- package/dist/visual/physics/relative.js +1 -1
- package/dist/visual/physics/solar.d.ts +1 -1
- package/dist/visual/physics/solar.js +1 -1
- package/dist/visual/physics/thermodynamics.d.ts +117 -0
- package/dist/visual/physics/thermodynamics.js +95 -0
- package/dist/visual/physics/vector.d.ts +1 -1
- package/dist/visual/physics/vector.js +1 -1
- package/dist/visual/physics/velocity.d.ts +1 -1
- package/dist/visual/physics/wave.d.ts +1 -1
- package/dist/visual/politics.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Array as Arr, MutableList, Option, Result, Schema } from "effect";
|
|
2
2
|
import { at, expect, finished, here, peek, problemAt, startReader, } from "#contracts/math/formula/reader";
|
|
3
|
-
import { FormulaFunctionSchema
|
|
3
|
+
import { FormulaFunctionSchema } from "#contracts/math/formula/syntax";
|
|
4
4
|
/** How tightly each operator holds its operands; implicit products bind like `*`. */
|
|
5
5
|
const SUM = 10;
|
|
6
6
|
const PRODUCT = 20;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Option, Result, Schema } from "effect";
|
|
2
2
|
import type { PlaneCurveObjectSchemas } from "#contracts/math/curve";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import type { SampleBox, SamplePoint } from "#contracts/math/formula/box";
|
|
4
|
+
import type { FormulaEvaluator, FormulaScope } from "#contracts/math/formula/compile";
|
|
5
5
|
import type { PlaneFormulaPoint } from "#contracts/math/formula/field";
|
|
6
6
|
import type { FormulaError } from "#contracts/math/formula/syntax";
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Array as Arr, Option, Result, Schema } from "effect";
|
|
2
|
-
import { SamplePointSchema
|
|
3
|
-
import { compileFormula
|
|
4
|
-
import { contourLines
|
|
2
|
+
import { SamplePointSchema } from "#contracts/math/formula/box";
|
|
3
|
+
import { compileFormula } from "#contracts/math/formula/compile";
|
|
4
|
+
import { contourLines } from "#contracts/math/formula/contour";
|
|
5
5
|
import { SampleGridSchema } from "#contracts/math/formula/mesh";
|
|
6
6
|
import { readFormula, readRelation } from "#contracts/math/formula/parse";
|
|
7
7
|
import { regionGeometry } from "#contracts/math/formula/region";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Option, Result, Schema } from "effect";
|
|
2
|
-
import {
|
|
2
|
+
import type { FormulaProblem } from "#contracts/math/formula/syntax";
|
|
3
|
+
import { FormulaError } from "#contracts/math/formula/syntax";
|
|
3
4
|
/**
|
|
4
5
|
* The tokens of one formula and the reader's place in them: the token it
|
|
5
6
|
* stands at and how many absolute bars are open around it.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Array as Arr, Option, Result, Schema } from "effect";
|
|
2
|
-
import { FormulaError
|
|
2
|
+
import { FormulaError } from "#contracts/math/formula/syntax";
|
|
3
3
|
import { FormulaTokenSchema, tokenizeFormula, } from "#contracts/math/formula/token";
|
|
4
4
|
/**
|
|
5
5
|
* The tokens of one formula and the reader's place in them: the token it
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Result } from "effect";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { SampleBox } from "#contracts/math/formula/box";
|
|
3
|
+
import type { FormulaScope } from "#contracts/math/formula/compile";
|
|
4
4
|
/** The region where every inequality holds, with each edge marked strict or not. */
|
|
5
5
|
export declare function regionGeometry(inequalities: readonly [string, ...string[]], box: SampleBox, scope: FormulaScope): Result.Result<{
|
|
6
6
|
boundary: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Array as Arr, MutableList, Option, Order, Result, Schema, } from "effect";
|
|
2
|
-
import { SamplePointSchema
|
|
3
|
-
import { compileFormula
|
|
4
|
-
import { contourFill, contourLines
|
|
2
|
+
import { SamplePointSchema } from "#contracts/math/formula/box";
|
|
3
|
+
import { compileFormula } from "#contracts/math/formula/compile";
|
|
4
|
+
import { contourFill, contourLines } from "#contracts/math/formula/contour";
|
|
5
5
|
import { readRelation } from "#contracts/math/formula/parse";
|
|
6
6
|
import { someCell } from "#contracts/math/formula/scan";
|
|
7
7
|
/** How far a boundary piece lies from one inequality's edge, and whether that edge is strict. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { SampleBox, SamplePoint, SampleRange } from "#contracts/math/formula/box";
|
|
2
2
|
/** One visible, unbroken run of a sampled curve, in authored coordinates. */
|
|
3
3
|
export type SampleBranch = readonly SamplePoint[];
|
|
4
4
|
/** Where a curve stands for one parameter value; NaN where it is undefined. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SampleBox } from "#contracts/math/formula/box";
|
|
2
|
-
import {
|
|
2
|
+
import type { SampleField } from "#contracts/math/formula/contour";
|
|
3
3
|
/** The field's values at the four corners of one cell, counterclockwise from the bottom left. */
|
|
4
4
|
export type CellValues = readonly [number, number, number, number];
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Array as Arr, MutableHashMap, Option } from "effect";
|
|
2
|
-
import { CONTOUR_CELLS
|
|
2
|
+
import { CONTOUR_CELLS } from "#contracts/math/formula/contour";
|
|
3
3
|
/** The field at every corner of one grid column, bottom to top. */
|
|
4
4
|
function columnValues(field, box, cells, column) {
|
|
5
5
|
const dx = (box.x.max - box.x.min) / cells;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { Schema } from "effect";
|
|
2
|
+
import type { FormulaParameter, FormulaReadout } from "#contracts/math/formula/field";
|
|
3
3
|
import type { PlaneLabelAnchor } from "#contracts/math/plane";
|
|
4
4
|
/**
|
|
5
5
|
* Reports every label position or readout formula that reads a name other
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Array as Arr } from "effect";
|
|
2
|
-
import { isPlaneFormulaPoint
|
|
2
|
+
import { isPlaneFormulaPoint } from "#contracts/math/formula/field";
|
|
3
3
|
import { expression, strayIssues } from "#contracts/math/formula/scope";
|
|
4
4
|
/**
|
|
5
5
|
* Reports every label position or readout formula that reads a name other
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Result } from "effect";
|
|
2
2
|
import type { SampleBox } from "#contracts/math/formula/box";
|
|
3
3
|
import type { FormulaScope } from "#contracts/math/formula/compile";
|
|
4
|
-
import {
|
|
4
|
+
import type { FormulaGeometry } from "#contracts/math/formula/plane";
|
|
5
5
|
import type { FormulaError } from "#contracts/math/formula/syntax";
|
|
6
6
|
import type { SpaceSolidObjectSchemas } from "#contracts/math/solid";
|
|
7
7
|
/** The space objects a formula or a face defines. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Array as Arr, Result } from "effect";
|
|
2
2
|
import { sampleGrid } from "#contracts/math/formula/mesh";
|
|
3
|
-
import { compileText, evaluateWith
|
|
3
|
+
import { compileText, evaluateWith } from "#contracts/math/formula/plane";
|
|
4
4
|
import { sampleCurve } from "#contracts/math/formula/sample";
|
|
5
5
|
const FULL_TURN = { max: 2 * Math.PI, min: 0 };
|
|
6
6
|
/** Moves one point by an offset. */
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import type { PlaneMathObject } from "#contracts/math/plane";
|
|
3
|
+
/**
|
|
4
|
+
* Guardrail G4: a parametric curve that traces a graph y = f(x) is written as
|
|
5
|
+
* a function. A function reads as the graph it is, takes its domain in x, and
|
|
6
|
+
* lets a scene scale each axis on its own, while a parametric curve keeps one
|
|
7
|
+
* scale for both, as a circle needs.
|
|
8
|
+
*/
|
|
9
|
+
export declare function graphAsParametricIssues(objects: readonly PlaneMathObject[]): readonly Schema.FilterIssue[];
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Array as Arr, Match, Option, Result, Schema } from "effect";
|
|
2
|
+
import { readAffine } from "#contracts/math/formula/affine";
|
|
3
|
+
import { readFormula } from "#contracts/math/formula/parse";
|
|
4
|
+
import { FormulaNodeSchema } from "#contracts/math/formula/syntax";
|
|
5
|
+
/** Whether two formulas are the same tree. */
|
|
6
|
+
const sameFormula = Schema.toEquivalence(FormulaNodeSchema);
|
|
7
|
+
/** The formulas directly below a node of a formula. */
|
|
8
|
+
function children(node) {
|
|
9
|
+
return Match.value(node).pipe(Match.discriminatorsExhaustive("kind")({
|
|
10
|
+
binary: ({ left, right }) => [left, right],
|
|
11
|
+
call: ({ args }) => args,
|
|
12
|
+
logarithm: ({ base, value }) => [base, value],
|
|
13
|
+
name: () => [],
|
|
14
|
+
negate: ({ operand }) => [operand],
|
|
15
|
+
number: () => [],
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
/** Whether a formula reads t anywhere outside the copies of `inside` it holds. */
|
|
19
|
+
function readsTOutside(node, inside) {
|
|
20
|
+
return (!sameFormula(node, inside) &&
|
|
21
|
+
((node.kind === "name" && node.name === "t") ||
|
|
22
|
+
Arr.some(children(node), (child) => readsTOutside(child, inside))));
|
|
23
|
+
}
|
|
24
|
+
/** Whether a formula reads t at all. */
|
|
25
|
+
function readsT(node) {
|
|
26
|
+
return ((node.kind === "name" && node.name === "t") ||
|
|
27
|
+
Arr.some(children(node), readsT));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* How a parametric curve traces a graph y = f(x), if it does: its x changes at
|
|
31
|
+
* one constant rate in t (`x = t - 6`), or its y reads t only through the
|
|
32
|
+
* formula of its x (`x = exp(t)`, `y = log_2(exp(t))`). Either way each x
|
|
33
|
+
* meets the curve at one height.
|
|
34
|
+
*/
|
|
35
|
+
function graphTrace(x, y) {
|
|
36
|
+
return Option.all([
|
|
37
|
+
Result.getSuccess(readFormula(x)),
|
|
38
|
+
Result.getSuccess(readFormula(y)),
|
|
39
|
+
]).pipe(Option.flatMap(([across, up]) => {
|
|
40
|
+
if (Option.exists(readAffine(across, ["t"]), ({ terms }) => (terms.t ?? 0) !== 0)) {
|
|
41
|
+
return Option.some("whose x changes at one constant rate in t");
|
|
42
|
+
}
|
|
43
|
+
return readsT(across) && !readsTOutside(up, across)
|
|
44
|
+
? Option.some("whose y reads t only through its x")
|
|
45
|
+
: Option.none();
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Guardrail G4: a parametric curve that traces a graph y = f(x) is written as
|
|
50
|
+
* a function. A function reads as the graph it is, takes its domain in x, and
|
|
51
|
+
* lets a scene scale each axis on its own, while a parametric curve keeps one
|
|
52
|
+
* scale for both, as a circle needs.
|
|
53
|
+
*/
|
|
54
|
+
export function graphAsParametricIssues(objects) {
|
|
55
|
+
return Arr.flatMap(objects, (object, index) => object.kind === "parametric"
|
|
56
|
+
? Option.match(graphTrace(object.x, object.y), {
|
|
57
|
+
onNone: () => [],
|
|
58
|
+
onSome: (trace) => [
|
|
59
|
+
{
|
|
60
|
+
issue: `Expected the parametric curve "${object.id}", ${trace} (x = ${object.x}), to be written as { kind: "function", formula, domain }: it is the graph y = f(x), and a graph lets each axis scale on its own.`,
|
|
61
|
+
path: ["objects", index],
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
})
|
|
65
|
+
: []);
|
|
66
|
+
}
|
package/dist/math/plane.js
CHANGED
|
@@ -3,11 +3,14 @@ import { ArcStartDegreesSchema, ArcSweepDegreesSchema, GEOMETRY_TOLERANCE, hasUn
|
|
|
3
3
|
import { strictBoundaryIssues } from "#contracts/math/boundary";
|
|
4
4
|
import { planeBoundsIssues } from "#contracts/math/bounds";
|
|
5
5
|
import { PlaneCurveObjectSchemas } from "#contracts/math/curve";
|
|
6
|
+
import { inventedEdgeIssues } from "#contracts/math/edge";
|
|
6
7
|
import { FormulaParameterSchema, FormulaReadoutSchema, PlaneFormulaPointSchema, } from "#contracts/math/formula/field";
|
|
7
8
|
import { formulaScopeIssues, parameterScope, planeFormulaFields, } from "#contracts/math/formula/scope";
|
|
8
9
|
import { sliderFormulaIssues } from "#contracts/math/formula/slider";
|
|
10
|
+
import { graphAsParametricIssues } from "#contracts/math/graph";
|
|
9
11
|
import { MATH_LINE_MESSAGE, MATH_POLYLINE_MESSAGE, MATH_RAY_MESSAGE, MATH_SEGMENT_MESSAGE, MATH_VECTOR_MESSAGE, MathObjectFields, MathStrokeFields, mathLabelAnchorFields, } from "#contracts/math/object";
|
|
10
12
|
import { planeResolutionIssues } from "#contracts/math/resolution";
|
|
13
|
+
import { figureAspectIssues } from "#contracts/math/shape";
|
|
11
14
|
/** Checks a plane polygon has non-zero signed area. */
|
|
12
15
|
function hasPlaneArea(vertices) {
|
|
13
16
|
const offsets = normalizedPlaneOffsets(vertices);
|
|
@@ -176,4 +179,7 @@ export const PlaneMathVisualSchema = Schema.Struct({
|
|
|
176
179
|
...planeBoundsIssues(frame, objects, labels, parameterScope(parameters)),
|
|
177
180
|
...planeResolutionIssues(frame, objects, labels, view),
|
|
178
181
|
...strictBoundaryIssues(objects),
|
|
182
|
+
...graphAsParametricIssues(objects),
|
|
183
|
+
...inventedEdgeIssues(frame, objects),
|
|
184
|
+
...figureAspectIssues(frame, objects, view),
|
|
179
185
|
])));
|
package/dist/math/precision.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BigDecimal } from "effect";
|
|
2
2
|
import type { PlanePoint, SpacePoint } from "#contracts/math/base";
|
|
3
3
|
import type { AxisRange } from "#contracts/math/extent";
|
|
4
|
-
import {
|
|
4
|
+
import type { AxisTraversal, InfinitePathKind } from "#contracts/math/intersection";
|
|
5
5
|
export type RenderThreshold = BigDecimal.BigDecimal;
|
|
6
6
|
/** Returns the exact width of one finite authored axis. */
|
|
7
7
|
export declare function axisSpan(range: AxisRange): BigDecimal.BigDecimal;
|
package/dist/math/precision.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BigDecimal, Array as EffectArray, Record as Rec } from "effect";
|
|
2
|
-
import { infinitePathInterval
|
|
2
|
+
import { infinitePathInterval } from "#contracts/math/intersection";
|
|
3
3
|
import { decimal, makeRatio } from "#contracts/math/rational";
|
|
4
4
|
const FLOAT32_RESOLUTION = BigDecimal.fromStringUnsafe("0.00000011920928955078125");
|
|
5
5
|
const TWO = BigDecimal.fromBigInt(2n);
|
package/dist/math/resolution.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Array as Arr, MutableHashMap, Schema } from "effect";
|
|
2
2
|
import { arcCurvatureUnresolved, arcEndpointAxesUnresolved, arcEndpointsUnresolved, } from "#contracts/math/arc";
|
|
3
3
|
import { concentricRadiusCollisionPaths, coordinateCollisionPaths, } from "#contracts/math/collision";
|
|
4
|
-
import { pathAxes, ScenePathSchema
|
|
4
|
+
import { pathAxes, ScenePathSchema } from "#contracts/math/coordinate";
|
|
5
5
|
import { axisEnvelopePairs, axisSpan, measureUnresolved, polygonAltitudeUnresolved, quadraticCurvatureUnresolved, renderThreshold, spanUnresolved, visiblePathResolvable, } from "#contracts/math/precision";
|
|
6
6
|
import { planeSceneCoordinates, spaceSceneCoordinates, } from "#contracts/math/scene";
|
|
7
7
|
import { encodeJsonText } from "#contracts/text/json";
|
package/dist/math/scene.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BigDecimal } from "effect";
|
|
2
|
-
import {
|
|
2
|
+
import type { ScenePath } from "#contracts/math/coordinate";
|
|
3
3
|
import type { PlaneLabelAnchor, PlaneMathFrame, PlaneMathObject } from "#contracts/math/plane";
|
|
4
|
-
import {
|
|
4
|
+
import type { RenderThreshold } from "#contracts/math/precision";
|
|
5
5
|
import type { SpaceLabelAnchor, SpaceMathFrame, SpaceMathObject, SpaceMathView } from "#contracts/math/space";
|
|
6
6
|
/** Owns one stable path for radial geometry-resolution failures. */
|
|
7
7
|
export declare function radialGeometryPath(kind: "arc" | "circle", index: number): ScenePath;
|