math-exercises 2.2.68 → 2.2.70
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/lib/exercises/math/calcul/arithmetics/divisorsList.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/divisorsList.js +2 -1
- package/lib/exercises/math/calcul/arithmetics/primeNumbers.d.ts.map +1 -1
- package/lib/exercises/math/calcul/arithmetics/primeNumbers.js +2 -1
- package/lib/exercises/math/calcul/fractions/fractionsOperations.d.ts.map +1 -1
- package/lib/exercises/math/calcul/fractions/fractionsOperations.js +1 -0
- package/lib/exercises/math/calculLitteral/equation/equationType1Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationType1Exercise.js +3 -6
- package/lib/exercises/math/calculLitteral/equation/equationType2Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationType2Exercise.js +3 -8
- package/lib/exercises/math/calculLitteral/equation/equationType3Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationType3Exercise.js +7 -9
- package/lib/exercises/math/calculLitteral/equation/equationType4Exercise.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/equation/equationType4Exercise.js +6 -19
- package/lib/exercises/math/calculLitteral/factorisation/factoByX.d.ts +8 -0
- package/lib/exercises/math/calculLitteral/factorisation/factoByX.d.ts.map +1 -0
- package/lib/exercises/math/calculLitteral/factorisation/factoByX.js +146 -0
- package/lib/exercises/math/calculLitteral/factorisation/index.d.ts +1 -0
- package/lib/exercises/math/calculLitteral/factorisation/index.d.ts.map +1 -1
- package/lib/exercises/math/calculLitteral/factorisation/index.js +1 -0
- package/lib/exercises/math/functions/absolute/absolueValueAffineEquation.d.ts +9 -0
- package/lib/exercises/math/functions/absolute/absolueValueAffineEquation.d.ts.map +1 -0
- package/lib/exercises/math/functions/absolute/absolueValueAffineEquation.js +175 -0
- package/lib/exercises/math/functions/absolute/index.d.ts +1 -0
- package/lib/exercises/math/functions/absolute/index.d.ts.map +1 -1
- package/lib/exercises/math/functions/absolute/index.js +1 -0
- package/lib/exercises/math/functions/trinoms/coefficientsIdentification.js +3 -3
- package/lib/exercises/math/functions/trinoms/findSecondRoot.d.ts +2 -2
- package/lib/exercises/math/functions/trinoms/findSecondRoot.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/findSecondRoot.js +5 -5
- package/lib/exercises/math/functions/trinoms/rootsProduct.d.ts +2 -2
- package/lib/exercises/math/functions/trinoms/rootsProduct.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/rootsProduct.js +7 -7
- package/lib/exercises/math/functions/trinoms/rootsSum.d.ts +2 -2
- package/lib/exercises/math/functions/trinoms/rootsSum.d.ts.map +1 -1
- package/lib/exercises/math/functions/trinoms/rootsSum.js +9 -10
- package/lib/exercises/math/functions/trinoms/trinomSignFromRoots.js +6 -6
- package/lib/exercises/math/geometry/areas/rightTriangleArea.d.ts +3 -1
- package/lib/exercises/math/geometry/areas/rightTriangleArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/rightTriangleArea.js +10 -22
- package/lib/exercises/math/geometry/areas/triangleArea.d.ts +6 -1
- package/lib/exercises/math/geometry/areas/triangleArea.d.ts.map +1 -1
- package/lib/exercises/math/geometry/areas/triangleArea.js +34 -48
- package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.d.ts.map +1 -1
- package/lib/exercises/math/geometry/euclidianConstructions/pointImageFromTranslation.js +4 -1
- package/lib/exercises/math/geometry/index.d.ts +1 -0
- package/lib/exercises/math/geometry/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/index.js +1 -0
- package/lib/exercises/math/geometry/pythagore/isTriangleRight.d.ts.map +1 -1
- package/lib/exercises/math/geometry/pythagore/pythagore.d.ts +0 -3
- package/lib/exercises/math/geometry/pythagore/pythagore.d.ts.map +1 -1
- package/lib/exercises/math/geometry/pythagore/pythagore.js +19 -25
- package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.d.ts +1 -2
- package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.d.ts.map +1 -1
- package/lib/exercises/math/geometry/pythagore/pythagoreCalcul.js +30 -65
- package/lib/exercises/math/geometry/quadrilaterals/index.d.ts +2 -0
- package/lib/exercises/math/geometry/quadrilaterals/index.d.ts.map +1 -0
- package/lib/exercises/math/geometry/quadrilaterals/index.js +17 -0
- package/lib/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.d.ts +14 -0
- package/lib/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.d.ts.map +1 -0
- package/lib/exercises/math/geometry/quadrilaterals/quadrilateralRecognition.js +221 -0
- package/lib/exercises/math/geometry/thales/index.d.ts.map +1 -1
- package/lib/exercises/math/geometry/thales/index.js +0 -1
- package/lib/exercises/math/geometry/thales/thales.js +2 -2
- package/lib/exercises/math/geometry/thales/thalesCalcul.d.ts +3 -4
- package/lib/exercises/math/geometry/thales/thalesCalcul.d.ts.map +1 -1
- package/lib/exercises/math/geometry/thales/thalesCalcul.js +69 -78
- package/lib/exercises/math/geometry/volumes/parallelepipedVolume.d.ts.map +1 -1
- package/lib/exercises/math/geometry/volumes/parallelepipedVolume.js +4 -3
- package/lib/exercises/math/geometry/volumes/sphereVolume.js +1 -1
- package/lib/exercises/math/trigonometry/trigonometry.d.ts +2 -3
- package/lib/exercises/math/trigonometry/trigonometry.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/trigonometry.js +32 -31
- package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.d.ts +3 -2
- package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/trigonometryAngleCalcul.js +18 -28
- package/lib/exercises/math/trigonometry/trigonometrySideCalcul.d.ts +5 -4
- package/lib/exercises/math/trigonometry/trigonometrySideCalcul.d.ts.map +1 -1
- package/lib/exercises/math/trigonometry/trigonometrySideCalcul.js +60 -56
- package/lib/exercises/pc/index.d.ts +0 -4
- package/lib/exercises/pc/index.d.ts.map +1 -1
- package/lib/exercises/pc/index.js +6 -4
- package/lib/exercises/utils/geogebra/toGGBCommandsProps.d.ts +1 -0
- package/lib/exercises/utils/geogebra/toGGBCommandsProps.d.ts.map +1 -1
- package/lib/exercises/vea/equationVEA.d.ts +2 -0
- package/lib/exercises/vea/equationVEA.d.ts.map +1 -0
- package/lib/exercises/vea/equationVEA.js +24 -0
- package/lib/exercises/vea/rationalVEA.d.ts.map +1 -1
- package/lib/exercises/vea/sqrtVEA.d.ts +6 -0
- package/lib/exercises/vea/sqrtVEA.d.ts.map +1 -0
- package/lib/exercises/vea/sqrtVEA.js +30 -0
- package/lib/geogebra/geogebraConstructor.d.ts +2 -0
- package/lib/geogebra/geogebraConstructor.d.ts.map +1 -1
- package/lib/geogebra/geogebraConstructor.js +7 -0
- package/lib/index.d.ts +31 -46
- package/lib/index.d.ts.map +1 -1
- package/lib/math/complex/complex.d.ts +1 -1
- package/lib/math/geometry/angle.d.ts +26 -0
- package/lib/math/geometry/angle.d.ts.map +1 -0
- package/lib/math/geometry/angle.js +73 -0
- package/lib/math/geometry/line.d.ts +5 -1
- package/lib/math/geometry/line.d.ts.map +1 -1
- package/lib/math/geometry/line.js +17 -0
- package/lib/math/geometry/parallelogram.d.ts +23 -0
- package/lib/math/geometry/parallelogram.d.ts.map +1 -0
- package/lib/math/geometry/parallelogram.js +70 -0
- package/lib/math/geometry/point.d.ts +3 -0
- package/lib/math/geometry/point.d.ts.map +1 -1
- package/lib/math/geometry/point.js +16 -0
- package/lib/math/geometry/quadrilateral.d.ts +15 -0
- package/lib/math/geometry/quadrilateral.d.ts.map +1 -0
- package/lib/math/geometry/quadrilateral.js +38 -0
- package/lib/math/geometry/rectangle.d.ts +24 -0
- package/lib/math/geometry/rectangle.d.ts.map +1 -0
- package/lib/math/geometry/rectangle.js +64 -0
- package/lib/math/geometry/rhombus.d.ts +19 -0
- package/lib/math/geometry/rhombus.d.ts.map +1 -0
- package/lib/math/geometry/rhombus.js +46 -0
- package/lib/math/geometry/rightTriangle.d.ts +31 -0
- package/lib/math/geometry/rightTriangle.d.ts.map +1 -0
- package/lib/math/geometry/rightTriangle.js +113 -0
- package/lib/math/geometry/segment.d.ts +24 -6
- package/lib/math/geometry/segment.d.ts.map +1 -1
- package/lib/math/geometry/segment.js +70 -4
- package/lib/math/geometry/square.d.ts +22 -0
- package/lib/math/geometry/square.d.ts.map +1 -0
- package/lib/math/geometry/square.js +43 -0
- package/lib/math/geometry/triangle.d.ts +45 -45
- package/lib/math/geometry/triangle.d.ts.map +1 -1
- package/lib/math/geometry/triangle.js +159 -186
- package/lib/math/geometry/vector.d.ts +2 -2
- package/lib/math/geometry/vector.d.ts.map +1 -1
- package/lib/math/geometry/vector.js +18 -9
- package/lib/math/numbers/nombre.d.ts +5 -0
- package/lib/math/numbers/nombre.d.ts.map +1 -1
- package/lib/math/numbers/nombre.js +12 -0
- package/lib/math/numbers/rationals/rational.d.ts +1 -1
- package/lib/math/numbers/reals/extendedRingElement.d.ts +1 -1
- package/lib/math/numbers/reals/real.d.ts.map +1 -1
- package/lib/math/numbers/reals/real.js +3 -0
- package/lib/math/polynomials/generalAffine.d.ts +13 -0
- package/lib/math/polynomials/generalAffine.d.ts.map +1 -1
- package/lib/math/polynomials/generalAffine.js +25 -1
- package/lib/math/polynomials/polynomial.d.ts +1 -1
- package/lib/math/polynomials/trinom.d.ts +2 -2
- package/lib/math/utils/geometry/pythagoricianTriplets.d.ts +1 -0
- package/lib/math/utils/geometry/pythagoricianTriplets.d.ts.map +1 -1
- package/lib/math/utils/geometry/pythagoricianTriplets.js +14 -1
- package/lib/math/utils/random/randfloat.d.ts +1 -1
- package/lib/math/utils/random/randfloat.d.ts.map +1 -1
- package/lib/math/utils/random/randfloat.js +8 -1
- package/lib/math/utils/random/randint.d.ts +8 -1
- package/lib/math/utils/random/randint.d.ts.map +1 -1
- package/lib/math/utils/random/randint.js +6 -1
- package/lib/playground.d.ts.map +1 -1
- package/lib/tree/nodes/functions/absNode.d.ts +2 -1
- package/lib/tree/nodes/functions/absNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/absNode.js +6 -1
- package/lib/tree/nodes/functions/functionNode.d.ts +2 -2
- package/lib/tree/nodes/functions/functionNode.d.ts.map +1 -1
- package/lib/tree/nodes/functions/oppositeNode.d.ts +5 -5
- package/lib/tree/nodes/functions/oppositeNode.d.ts.map +1 -1
- package/lib/tree/nodes/node.d.ts +3 -1
- package/lib/tree/nodes/node.d.ts.map +1 -1
- package/lib/tree/nodes/node.js +1 -0
- package/lib/tree/nodes/nodeConstructor.d.ts +3 -0
- package/lib/tree/nodes/nodeConstructor.d.ts.map +1 -1
- package/lib/tree/nodes/nodeConstructor.js +9 -1
- package/lib/tree/nodes/numbers/numberNode.d.ts +2 -0
- package/lib/tree/nodes/numbers/numberNode.d.ts.map +1 -1
- package/lib/tree/nodes/numbers/numberNode.js +6 -1
- package/lib/tree/nodes/operators/addNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/addNode.js +2 -1
- package/lib/tree/nodes/operators/fractionNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/fractionNode.js +6 -1
- package/lib/tree/nodes/operators/multiplyNode.d.ts.map +1 -1
- package/lib/tree/nodes/operators/multiplyNode.js +3 -3
- package/lib/tree/nodes/polynomials/trinomNode.d.ts +70 -0
- package/lib/tree/nodes/polynomials/trinomNode.d.ts.map +1 -0
- package/lib/tree/nodes/polynomials/trinomNode.js +156 -0
- package/lib/tree/nodes/variables/variableNode.d.ts.map +1 -1
- package/lib/tree/nodes/variables/variableNode.js +1 -1
- package/lib/tree/parsers/affineParser.d.ts.map +1 -1
- package/lib/tree/parsers/affineParser.js +1 -0
- package/lib/tree/parsers/discreteSetParser.d.ts +3 -0
- package/lib/tree/parsers/discreteSetParser.d.ts.map +1 -0
- package/lib/tree/parsers/discreteSetParser.js +23 -0
- package/lib/tree/parsers/equationSolutionParser.d.ts +1 -1
- package/lib/tree/parsers/equationSolutionParser.d.ts.map +1 -1
- package/lib/tree/parsers/equationSolutionParser.js +15 -4
- package/lib/tree/parsers/latexParser.d.ts +5 -1
- package/lib/tree/parsers/latexParser.d.ts.map +1 -1
- package/lib/tree/parsers/latexParser.js +17 -3
- package/lib/tree/parsers/monomParser.js +2 -2
- package/lib/tree/parsers/powerParser.d.ts +1 -1
- package/lib/tree/parsers/rationalParser.d.ts +1 -1
- package/lib/tree/parsers/rationalParser.d.ts.map +1 -1
- package/lib/tree/parsers/rationalParser.js +29 -24
- package/lib/tree/parsers/sqrtParser.d.ts +9 -0
- package/lib/tree/parsers/sqrtParser.d.ts.map +1 -0
- package/lib/tree/parsers/sqrtParser.js +52 -0
- package/lib/tree/parsers/trinomParser.d.ts +1 -1
- package/lib/tree/parsers/trinomParser.d.ts.map +1 -1
- package/lib/tree/parsers/trinomParser.js +14 -2
- package/lib/tree/utilities/functionComposition.d.ts +1 -1
- package/lib/tree/utilities/functionComposition.d.ts.map +1 -1
- package/lib/utils/arrays/rotation.d.ts +8 -0
- package/lib/utils/arrays/rotation.d.ts.map +1 -0
- package/lib/utils/arrays/rotation.js +17 -0
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -324,6 +324,9 @@ declare const mathExercises: (Exercise<{
|
|
|
324
324
|
c: number;
|
|
325
325
|
d: number;
|
|
326
326
|
isSubstract: boolean;
|
|
327
|
+
}, {}> | Exercise<{
|
|
328
|
+
a: number;
|
|
329
|
+
b: number;
|
|
327
330
|
}, {}> | Exercise<{
|
|
328
331
|
b: number;
|
|
329
332
|
c: number;
|
|
@@ -578,6 +581,9 @@ declare const mathExercises: (Exercise<{
|
|
|
578
581
|
a: number;
|
|
579
582
|
b: number;
|
|
580
583
|
isStrict: boolean;
|
|
584
|
+
}, {}> | Exercise<{
|
|
585
|
+
firstAffine: import("./math/polynomials/generalAffine").GeneralAffineIdentifiers;
|
|
586
|
+
secondAffine: import("./math/polynomials/generalAffine").GeneralAffineIdentifiers;
|
|
581
587
|
}, {}> | Exercise<{
|
|
582
588
|
xA: number;
|
|
583
589
|
yA: number;
|
|
@@ -795,11 +801,11 @@ declare const mathExercises: (Exercise<{
|
|
|
795
801
|
cIdentifiers: import("./tree/nodes/nodeConstructor").NodeIdentifiers;
|
|
796
802
|
isAsking: string;
|
|
797
803
|
}, {}> | Exercise<{
|
|
798
|
-
trinomIdentifiers: import("./
|
|
804
|
+
trinomIdentifiers: import("./tree/nodes/polynomials/trinomNode").TrinomNodeIdentifiers;
|
|
799
805
|
}, {}> | Exercise<{
|
|
800
|
-
trinomIdentifiers: import("./
|
|
806
|
+
trinomIdentifiers: import("./tree/nodes/polynomials/trinomNode").TrinomNodeIdentifiers;
|
|
801
807
|
}, {}> | Exercise<{
|
|
802
|
-
trinomIdentifiers: import("./
|
|
808
|
+
trinomIdentifiers: import("./tree/nodes/polynomials/trinomNode").TrinomNodeIdentifiers;
|
|
803
809
|
firstRootIdentifiers: import("./tree/nodes/nodeConstructor").NodeIdentifiers;
|
|
804
810
|
}, {}> | Exercise<{
|
|
805
811
|
a: number;
|
|
@@ -890,10 +896,14 @@ declare const mathExercises: (Exercise<{
|
|
|
890
896
|
length: number;
|
|
891
897
|
width: number;
|
|
892
898
|
}, {}> | Exercise<{
|
|
893
|
-
|
|
899
|
+
triangleIdentifiers: import("./math/geometry/triangle").TriangleIdentifiers;
|
|
894
900
|
}, {}> | Exercise<{
|
|
895
901
|
side: number;
|
|
896
|
-
}, {}> | Exercise<{
|
|
902
|
+
}, {}> | Exercise<{
|
|
903
|
+
triangleIdentifiers: import("./math/geometry/triangle").TriangleIdentifiers;
|
|
904
|
+
height: number;
|
|
905
|
+
base: number;
|
|
906
|
+
}, {}> | Exercise<{
|
|
897
907
|
randomSide: number;
|
|
898
908
|
}, {}> | Exercise<{
|
|
899
909
|
area: number;
|
|
@@ -979,13 +989,9 @@ declare const mathExercises: (Exercise<{
|
|
|
979
989
|
}, {}> | Exercise<{
|
|
980
990
|
perimeter: number;
|
|
981
991
|
}, {}> | Exercise<{
|
|
982
|
-
sideA: string;
|
|
983
|
-
sideB: string;
|
|
984
|
-
sideC: string;
|
|
985
992
|
triangleIdentifiers: import("./math/geometry/triangle").TriangleIdentifiers;
|
|
986
993
|
}, {}> | Exercise<{
|
|
987
|
-
|
|
988
|
-
sideLengths: number[];
|
|
994
|
+
sideAsked: number;
|
|
989
995
|
triangleIdentifiers: import("./math/geometry/triangle").TriangleIdentifiers;
|
|
990
996
|
}, {}> | Exercise<{
|
|
991
997
|
isRight: boolean;
|
|
@@ -1003,9 +1009,10 @@ declare const mathExercises: (Exercise<{
|
|
|
1003
1009
|
yC: number;
|
|
1004
1010
|
factor: number;
|
|
1005
1011
|
}, {}> | Exercise<{
|
|
1012
|
+
ratio: number;
|
|
1006
1013
|
triangleIdentifiers: import("./math/geometry/triangle").TriangleIdentifiers;
|
|
1007
|
-
|
|
1008
|
-
|
|
1014
|
+
insidePointsNames: string[];
|
|
1015
|
+
segmentAskedName: string;
|
|
1009
1016
|
isPapillon: boolean;
|
|
1010
1017
|
}, {
|
|
1011
1018
|
configurationType: string;
|
|
@@ -1163,6 +1170,11 @@ declare const mathExercises: (Exercise<{
|
|
|
1163
1170
|
}, {}> | Exercise<{
|
|
1164
1171
|
startPoint: number[];
|
|
1165
1172
|
vector: number[];
|
|
1173
|
+
}, {}> | Exercise<{
|
|
1174
|
+
shape: string;
|
|
1175
|
+
showDiagonals: boolean;
|
|
1176
|
+
drawAngles: boolean;
|
|
1177
|
+
shapeIdentifiers: import("./math/geometry/parallelogram").ParallelogramIdentifiers | import("./math/geometry/rhombus").RhombusIdentifiers | import("./math/geometry/rectangle").RectangleIdentifiers | import("./math/geometry/square").SquareIdentifiers;
|
|
1166
1178
|
}, {}> | Exercise<{
|
|
1167
1179
|
coeffs: number[];
|
|
1168
1180
|
to: string;
|
|
@@ -1615,20 +1627,18 @@ declare const mathExercises: (Exercise<{
|
|
|
1615
1627
|
mainValue: number;
|
|
1616
1628
|
isCos: boolean;
|
|
1617
1629
|
}, {}> | Exercise<{
|
|
1618
|
-
sideA: string;
|
|
1619
|
-
sideB: string;
|
|
1620
|
-
sideC: string;
|
|
1621
1630
|
randAngle: number;
|
|
1622
1631
|
randTrigo: number;
|
|
1632
|
+
triangleIdentifiers: import("./math/geometry/triangle").TriangleIdentifiers;
|
|
1623
1633
|
}, {}> | Exercise<{
|
|
1624
|
-
sideLengths: number[];
|
|
1625
1634
|
randAngle: number;
|
|
1626
|
-
|
|
1635
|
+
hiddenSide: number;
|
|
1636
|
+
triangleIdentifiers: import("./math/geometry/triangle").TriangleIdentifiers;
|
|
1627
1637
|
}, {}> | Exercise<{
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1638
|
+
sideAsked: number;
|
|
1639
|
+
givenSide: number;
|
|
1640
|
+
givenAngle: number;
|
|
1641
|
+
triangleIdentifiers: import("./math/geometry/triangle").TriangleIdentifiers;
|
|
1632
1642
|
}, {}> | Exercise<{
|
|
1633
1643
|
angleValue: number;
|
|
1634
1644
|
angleIdentifiers: import("./tree/nodes/nodeConstructor").NodeIdentifiers;
|
|
@@ -1779,22 +1789,6 @@ declare const pcExercises: (Exercise<{
|
|
|
1779
1789
|
signs: number[];
|
|
1780
1790
|
isLog10: boolean;
|
|
1781
1791
|
}, {}> | Exercise<{
|
|
1782
|
-
vertices: string[];
|
|
1783
|
-
xA: number;
|
|
1784
|
-
yA: number;
|
|
1785
|
-
xB: number;
|
|
1786
|
-
yB: number;
|
|
1787
|
-
xC: number;
|
|
1788
|
-
yC: number;
|
|
1789
|
-
factor: number;
|
|
1790
|
-
}, {}> | Exercise<{
|
|
1791
|
-
triangleIdentifiers: import("./math/geometry/triangle").TriangleIdentifiers;
|
|
1792
|
-
insidePointsIdentifiers: import("./math/geometry/point").PointIdentifiers[];
|
|
1793
|
-
segmentAsked: import("./math/geometry/segment").SegmentIdentifiers;
|
|
1794
|
-
isPapillon: boolean;
|
|
1795
|
-
}, {
|
|
1796
|
-
configurationType: string;
|
|
1797
|
-
}> | Exercise<{
|
|
1798
1792
|
xA: number;
|
|
1799
1793
|
xB: number;
|
|
1800
1794
|
yA: number;
|
|
@@ -1815,15 +1809,6 @@ declare const pcExercises: (Exercise<{
|
|
|
1815
1809
|
a: number;
|
|
1816
1810
|
b: number;
|
|
1817
1811
|
c: number;
|
|
1818
|
-
}, {}> | Exercise<{
|
|
1819
|
-
sideLengths: number[];
|
|
1820
|
-
randAngle: number;
|
|
1821
|
-
randSides: number[];
|
|
1822
|
-
}, {}> | Exercise<{
|
|
1823
|
-
sideLengths: number[];
|
|
1824
|
-
randAngle: number;
|
|
1825
|
-
randSide: number;
|
|
1826
|
-
randSideQuestion: number;
|
|
1827
1812
|
}, {}> | Exercise<{
|
|
1828
1813
|
reactionArray: import("./pc/constants/molecularChemistry/reaction").ReactionSpecies[];
|
|
1829
1814
|
}, {}> | Exercise<{
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,yBAAyB,CAAC;AAEjC,QAAA,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,yBAAyB,CAAC;AAEjC,QAAA,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
|
times(n: number): Complex;
|
|
19
19
|
opposite(): Complex;
|
|
20
20
|
conjugate(): Complex;
|
|
21
|
-
toArgumentTree():
|
|
21
|
+
toArgumentTree(): import("../../tree/nodes/numbers/constantNode").ConstantNode | NumberNode | FractionNode | OppositeNode<FractionNode> | undefined;
|
|
22
22
|
toModuleTree(): import("../../tree/nodes/algebraicNode").AlgebraicNode;
|
|
23
23
|
toTree(): ComplexNode;
|
|
24
24
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AlgebraicNode } from "../../tree/nodes/algebraicNode";
|
|
2
|
+
import { Point } from "./point";
|
|
3
|
+
type AngleProps = {
|
|
4
|
+
radianValueNode?: AlgebraicNode;
|
|
5
|
+
degreeValueNode?: AlgebraicNode;
|
|
6
|
+
};
|
|
7
|
+
export declare class Angle {
|
|
8
|
+
points: Point[];
|
|
9
|
+
radianValueNode?: AlgebraicNode;
|
|
10
|
+
degreeValueNode?: AlgebraicNode;
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
* @param points [pointA, pointB, pointC] with apex = B
|
|
14
|
+
*/
|
|
15
|
+
constructor(points: Point[], props?: AngleProps);
|
|
16
|
+
evaluate(inRadian?: boolean): number;
|
|
17
|
+
getValueNode(inDegree?: boolean): AlgebraicNode | import("../../tree/nodes/numbers/constantNode").ConstantNode | import("../../tree/nodes/numbers/numberNode").NumberNode;
|
|
18
|
+
isRight(): boolean;
|
|
19
|
+
toTex(): string;
|
|
20
|
+
toCommands(opts?: {
|
|
21
|
+
color?: string;
|
|
22
|
+
showValue?: boolean;
|
|
23
|
+
}): string[];
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=angle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"angle.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/angle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAM/D,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,KAAK,UAAU,GAAG;IAChB,eAAe,CAAC,EAAE,aAAa,CAAC;IAChC,eAAe,CAAC,EAAE,aAAa,CAAC;CACjC,CAAC;AACF,qBAAa,KAAK;IAChB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,eAAe,CAAC,EAAE,aAAa,CAAC;IAChC,eAAe,CAAC,EAAE,aAAa,CAAC;IAEhC;;;OAGG;gBACS,MAAM,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,EAAE,UAAU;IAkB/C,QAAQ,CAAC,QAAQ,UAAQ;IAiBzB,YAAY,CAAC,QAAQ,UAAQ;IAW7B,OAAO;IAIP,KAAK;IAGL,UAAU,CAAC,IAAI,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE;CAgB1D"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Angle = void 0;
|
|
4
|
+
const piNode_1 = require("../../tree/nodes/numbers/piNode");
|
|
5
|
+
const fractionNode_1 = require("../../tree/nodes/operators/fractionNode");
|
|
6
|
+
const multiplyNode_1 = require("../../tree/nodes/operators/multiplyNode");
|
|
7
|
+
const round_1 = require("../utils/round");
|
|
8
|
+
class Angle {
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param points [pointA, pointB, pointC] with apex = B
|
|
12
|
+
*/
|
|
13
|
+
constructor(points, props) {
|
|
14
|
+
this.points = points;
|
|
15
|
+
this.radianValueNode = props?.radianValueNode;
|
|
16
|
+
this.degreeValueNode = props?.degreeValueNode;
|
|
17
|
+
if (props?.radianValueNode && !props.degreeValueNode) {
|
|
18
|
+
this.degreeValueNode = (0, fractionNode_1.frac)((0, multiplyNode_1.multiply)(props.radianValueNode, (180).toTree()), piNode_1.PiNode);
|
|
19
|
+
}
|
|
20
|
+
if (props?.degreeValueNode && !props.radianValueNode) {
|
|
21
|
+
this.radianValueNode = (0, fractionNode_1.frac)((0, multiplyNode_1.multiply)(props.degreeValueNode, piNode_1.PiNode), (180).toTree());
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
evaluate(inRadian = false) {
|
|
25
|
+
if (this.degreeValueNode || this.radianValueNode) {
|
|
26
|
+
if (inRadian)
|
|
27
|
+
return this.radianValueNode.evaluate();
|
|
28
|
+
return this.degreeValueNode.evaluate();
|
|
29
|
+
}
|
|
30
|
+
const coords = this.points.map((p) => [p.x.evaluate(), p.y.evaluate()]);
|
|
31
|
+
const [x1, y1, x2, y2, x3, y3] = coords.flatMap((p) => p);
|
|
32
|
+
const angleBA = Math.atan2(y1 - y2, x1 - x2);
|
|
33
|
+
const angleBC = Math.atan2(y3 - y2, x3 - x2);
|
|
34
|
+
let angleRadians = angleBC - angleBA;
|
|
35
|
+
if (angleRadians < 0) {
|
|
36
|
+
angleRadians += 2 * Math.PI;
|
|
37
|
+
}
|
|
38
|
+
if (inRadian)
|
|
39
|
+
return (0, round_1.round)(angleRadians, 4);
|
|
40
|
+
return (0, round_1.round)(angleRadians * (180 / Math.PI), 4);
|
|
41
|
+
}
|
|
42
|
+
getValueNode(inDegree = false) {
|
|
43
|
+
if (this.degreeValueNode || this.radianValueNode) {
|
|
44
|
+
if (inDegree)
|
|
45
|
+
return this.degreeValueNode;
|
|
46
|
+
return this.radianValueNode;
|
|
47
|
+
}
|
|
48
|
+
const angle = this.evaluate();
|
|
49
|
+
if (inDegree)
|
|
50
|
+
return angle.toTree();
|
|
51
|
+
return (0, fractionNode_1.frac)((0, multiplyNode_1.multiply)(angle, piNode_1.PiNode), 180).simplify();
|
|
52
|
+
}
|
|
53
|
+
isRight() {
|
|
54
|
+
const value = this.evaluate();
|
|
55
|
+
return Math.abs(value) - 90 < 0.000001 || Math.abs(value) - 270 < 0.000001;
|
|
56
|
+
}
|
|
57
|
+
toTex() {
|
|
58
|
+
return `\\widehat{${this.points[0].name}${this.points[1].name}${this.points[2].name}}`;
|
|
59
|
+
}
|
|
60
|
+
toCommands(opts) {
|
|
61
|
+
const name = `angle_{${this.points[0].name}${this.points[1].name}${this.points[2].name}}`;
|
|
62
|
+
const cmds = [
|
|
63
|
+
`${name} = Angle(${this.points[0].name},${this.points[1].name},${this.points[2].name}, xAxis)`,
|
|
64
|
+
`ShowLabel(${name}, ${opts?.showValue ? "true" : "false"})`,
|
|
65
|
+
];
|
|
66
|
+
cmds.push(`SetCaption(${name}, "$\\footnotesize ${(0, round_1.round)(this.evaluate(), 1).frenchify() + "°"}$")`);
|
|
67
|
+
if (opts?.color) {
|
|
68
|
+
cmds.push(`SetColor(${name}, "${opts.color}")`);
|
|
69
|
+
}
|
|
70
|
+
return cmds;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
exports.Angle = Angle;
|
|
@@ -4,6 +4,7 @@ import { EqualNode } from "../../tree/nodes/equations/equalNode";
|
|
|
4
4
|
import { AddNode } from "../../tree/nodes/operators/addNode";
|
|
5
5
|
import { SubstractNode } from "../../tree/nodes/operators/substractNode";
|
|
6
6
|
import { Point, PointIdentifiers } from "./point";
|
|
7
|
+
import { Segment } from "./segment";
|
|
7
8
|
import { Vector } from "./vector";
|
|
8
9
|
export type LineIdentifiers = {
|
|
9
10
|
name?: string;
|
|
@@ -13,6 +14,7 @@ export type LineIdentifiers = {
|
|
|
13
14
|
export declare abstract class LineConstructor {
|
|
14
15
|
static random(name?: string): Line;
|
|
15
16
|
static fromIdentifiers(identifiers: LineIdentifiers): Line;
|
|
17
|
+
static fromSegment(segment: Segment): Line;
|
|
16
18
|
}
|
|
17
19
|
export declare class Line {
|
|
18
20
|
pointA: Point;
|
|
@@ -30,7 +32,9 @@ export declare class Line {
|
|
|
30
32
|
pointB: PointIdentifiers;
|
|
31
33
|
};
|
|
32
34
|
isParallele(line: Line): boolean;
|
|
35
|
+
getDirectorVector(): Vector;
|
|
33
36
|
getParallele(point: Point): Line;
|
|
37
|
+
getPerpendicular(point: Point): Line;
|
|
34
38
|
includes(point: Point, allowApprox?: boolean): boolean;
|
|
35
39
|
getRandomPoint(name?: string): Point;
|
|
36
40
|
getEquation: (u: Vector, a: Point) => EqualNode;
|
|
@@ -38,7 +42,7 @@ export declare class Line {
|
|
|
38
42
|
toCartesian(): AddNode;
|
|
39
43
|
toCartesianCoeffs(): {
|
|
40
44
|
a: AlgebraicNode;
|
|
41
|
-
b: import("../../tree/nodes/functions/oppositeNode").OppositeNode
|
|
45
|
+
b: import("../../tree/nodes/functions/oppositeNode").OppositeNode<AlgebraicNode>;
|
|
42
46
|
c: SubstractNode;
|
|
43
47
|
};
|
|
44
48
|
toTex(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/line.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AAEvF,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AAGjE,OAAO,EAAE,OAAO,EAAO,MAAM,oCAAoC,CAAC;AAMlE,OAAO,EACL,aAAa,EAEd,MAAM,0CAA0C,CAAC;AAKlD,OAAO,EAAE,KAAK,EAAoB,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,MAAM,EAAqB,MAAM,UAAU,CAAC;AAErD,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,EAAE,gBAAgB,CAAC;CAC1B,CAAC;AACF,8BAAsB,eAAe;IACnC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM;IAK3B,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,eAAe;
|
|
1
|
+
{"version":3,"file":"line.d.ts","sour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AY,CAAC,KAAK,EAAE,KAAK;IAYzB,gBAAgB,CAAC,KAAK,EAAE,KAAK;IAW7B,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,WAAW,GAAE,OAAe;IAenD,cAAc,CAAC,IAAI,CAAC,EAAE,MAAM;IAa5B,WAAW,MAAO,MAAM,KAAK,KAAK,KAAG,SAAS,CAmB5C;IAEF,oBAAoB,IAAI,SAAS;IAuBjC,WAAW;IAMX,iBAAiB;;;;;IAcjB,KAAK;IAGL,gBAAgB;IAIhB,aAAa,CACX,iBAAiB,EAAE,OAAO,EAC1B,EACE,OAAc,EACd,SAAiB,EACjB,yBAAgC,GACjC,GAAE,kBAAuB;IAqB5B,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,CAAC,EAAE,MAAM;CAW7C"}
|
|
@@ -23,6 +23,9 @@ class LineConstructor {
|
|
|
23
23
|
static fromIdentifiers(identifiers) {
|
|
24
24
|
return new Line(point_1.PointConstructor.fromIdentifiers(identifiers.pointA), point_1.PointConstructor.fromIdentifiers(identifiers.pointB), identifiers.name);
|
|
25
25
|
}
|
|
26
|
+
static fromSegment(segment) {
|
|
27
|
+
return new Line(segment.pointA, segment.pointB);
|
|
28
|
+
}
|
|
26
29
|
}
|
|
27
30
|
exports.LineConstructor = LineConstructor;
|
|
28
31
|
class Line {
|
|
@@ -73,6 +76,9 @@ class Line {
|
|
|
73
76
|
const lineVec = vector_1.VectorConstructor.fromPoints(line.pointA, line.pointB);
|
|
74
77
|
return vec.isColinear(lineVec);
|
|
75
78
|
}
|
|
79
|
+
getDirectorVector() {
|
|
80
|
+
return vector_1.VectorConstructor.fromPoints(this.pointA, this.pointB);
|
|
81
|
+
}
|
|
76
82
|
getParallele(point) {
|
|
77
83
|
if (this.isVertical) {
|
|
78
84
|
const y = (0, addNode_1.add)(point.y, 1).simplify();
|
|
@@ -84,6 +90,17 @@ class Line {
|
|
|
84
90
|
const secondPoint = new point_1.Point("P", x, y);
|
|
85
91
|
return new Line(point, secondPoint);
|
|
86
92
|
}
|
|
93
|
+
getPerpendicular(point) {
|
|
94
|
+
if (this.isVertical) {
|
|
95
|
+
const x = (0, addNode_1.add)(point.x, 1).simplify();
|
|
96
|
+
const secondPoint = new point_1.Point("P", x, point.y);
|
|
97
|
+
return new Line(point, secondPoint);
|
|
98
|
+
}
|
|
99
|
+
const vec = this.getDirectorVector();
|
|
100
|
+
const ortho = vec.getOrthogonal();
|
|
101
|
+
const secondPoint = ortho.getEndPoint(point);
|
|
102
|
+
return new Line(point, secondPoint);
|
|
103
|
+
}
|
|
87
104
|
includes(point, allowApprox = false) {
|
|
88
105
|
if (this.isVertical) {
|
|
89
106
|
if (allowApprox) {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Point, PointIdentifiers } from "./point";
|
|
2
|
+
import { Quadrilateral } from "./quadrilateral";
|
|
3
|
+
export declare abstract class ParallelogramConstructor {
|
|
4
|
+
static random(): Parallelogram;
|
|
5
|
+
static fromIdentifiers(identifiers: ParallelogramIdentifiers): Parallelogram;
|
|
6
|
+
}
|
|
7
|
+
export type ParallelogramIdentifiers = {
|
|
8
|
+
points: PointIdentifiers[];
|
|
9
|
+
};
|
|
10
|
+
export declare class Parallelogram extends Quadrilateral {
|
|
11
|
+
constructor(points: Point[]);
|
|
12
|
+
toIdentifiers(): ParallelogramIdentifiers;
|
|
13
|
+
drawDiagonals({ drawCenter, drawDecorations, isRectangle, isRhombus, }: {
|
|
14
|
+
drawCenter: boolean;
|
|
15
|
+
drawDecorations: boolean;
|
|
16
|
+
isRectangle?: boolean;
|
|
17
|
+
isRhombus?: boolean;
|
|
18
|
+
}): void;
|
|
19
|
+
drawSidesDecoration({ isRhombus }: {
|
|
20
|
+
isRhombus?: boolean;
|
|
21
|
+
}): void;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=parallelogram.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parallelogram.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/parallelogram.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAoB,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,8BAAsB,wBAAwB;IAC5C,MAAM,CAAC,MAAM;IA2Bb,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,wBAAwB;CAO7D;AAED,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC5B,CAAC;AAEF,qBAAa,aAAc,SAAQ,aAAa;gBAClC,MAAM,EAAE,KAAK,EAAE;IAG3B,aAAa,IAAI,wBAAwB;IAKzC,aAAa,CAAC,EACZ,UAAU,EACV,eAAe,EACf,WAAW,EACX,SAAS,GACV,EAAE;QACD,UAAU,EAAE,OAAO,CAAC;QACpB,eAAe,EAAE,OAAO,CAAC;QACzB,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB,GAAG,IAAI;IA6BR,mBAAmB,CAAC,EAAE,SAAS,EAAE,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI;CAclE"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Parallelogram = exports.ParallelogramConstructor = void 0;
|
|
4
|
+
const randfloat_1 = require("../utils/random/randfloat");
|
|
5
|
+
const point_1 = require("./point");
|
|
6
|
+
const quadrilateral_1 = require("./quadrilateral");
|
|
7
|
+
class ParallelogramConstructor {
|
|
8
|
+
static random() {
|
|
9
|
+
const angle = (0, randfloat_1.randfloat)(0, Math.PI / 2);
|
|
10
|
+
const additionalAngle = (0, randfloat_1.randfloat)(Math.PI / 4, (3 * Math.PI) / 4);
|
|
11
|
+
const xRand = (0, randfloat_1.randfloat)(5, 8);
|
|
12
|
+
const xRand2 = (0, randfloat_1.randfloat)(3, 8);
|
|
13
|
+
const origin = new point_1.Point("O", (0).toTree(), (0).toTree());
|
|
14
|
+
const A = new point_1.Point("A", (-xRand).toTree(), (0).toTree()).rotate(angle, origin);
|
|
15
|
+
const C = new point_1.Point("C", xRand.toTree(), (0).toTree()).rotate(angle, origin);
|
|
16
|
+
const yRand = (0, randfloat_1.randfloat)(3, 6);
|
|
17
|
+
const B = new point_1.Point("B", (-xRand2).toTree(), (0).toTree()).rotate(angle + additionalAngle, origin);
|
|
18
|
+
const D = new point_1.Point("D", xRand2.toTree(), (0).toTree()).rotate(angle + additionalAngle, origin);
|
|
19
|
+
return new Parallelogram([A, B, C, D]);
|
|
20
|
+
}
|
|
21
|
+
static fromIdentifiers(identifiers) {
|
|
22
|
+
return new Parallelogram(identifiers.points.map((point) => point_1.PointConstructor.fromIdentifiers(point)));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.ParallelogramConstructor = ParallelogramConstructor;
|
|
26
|
+
class Parallelogram extends quadrilateral_1.Quadrilateral {
|
|
27
|
+
constructor(points) {
|
|
28
|
+
super(points);
|
|
29
|
+
}
|
|
30
|
+
toIdentifiers() {
|
|
31
|
+
return {
|
|
32
|
+
points: this.points.map((point) => point.toIdentifiers()),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
drawDiagonals({ drawCenter, drawDecorations, isRectangle, isRhombus, }) {
|
|
36
|
+
super.drawDiagonals({ drawCenter, drawDecorations });
|
|
37
|
+
if (drawDecorations) {
|
|
38
|
+
this.commands.push(`midDiago1 = Segment(${this.points[0].name}, diagoCenter)`);
|
|
39
|
+
this.commands.push(`midDiago2 = Segment(${this.points[2].name}, diagoCenter)`);
|
|
40
|
+
this.commands.push(`midDiago3 = Segment(${this.points[1].name}, diagoCenter)`);
|
|
41
|
+
this.commands.push(`midDiago4 = Segment(${this.points[3].name}, diagoCenter)`);
|
|
42
|
+
const secondDeco = isRectangle ? 2 : 3;
|
|
43
|
+
this.commands.push(`SetDecoration(midDiago1, 2)`);
|
|
44
|
+
this.commands.push(`SetDecoration(midDiago2, 2)`);
|
|
45
|
+
this.commands.push(`SetDecoration(midDiago3, ${secondDeco})`);
|
|
46
|
+
this.commands.push(`SetDecoration(midDiago4, ${secondDeco})`);
|
|
47
|
+
}
|
|
48
|
+
isRhombus &&
|
|
49
|
+
this.commands.push(...[
|
|
50
|
+
`centerAngle = Angle(${this.points[0].name}, diagoCenter, ${this.points[1].name}, xAxis)`,
|
|
51
|
+
`ShowLabel(centerAngle, false)`,
|
|
52
|
+
]);
|
|
53
|
+
}
|
|
54
|
+
drawSidesDecoration({ isRhombus }) {
|
|
55
|
+
if (isRhombus) {
|
|
56
|
+
this.sides.forEach((side, index) => {
|
|
57
|
+
this.commands.push(`SetDecoration(${side.ggbName}, 2)`);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
this.sides.forEach((side, index) => {
|
|
62
|
+
if (index % 2 === 0)
|
|
63
|
+
this.commands.push(`SetDecoration(${side.ggbName}, 2)`);
|
|
64
|
+
if (index % 2 !== 0)
|
|
65
|
+
this.commands.push(`SetDecoration(${side.ggbName}, 3)`);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.Parallelogram = Parallelogram;
|
|
@@ -8,6 +8,7 @@ export type PointIdentifiers = {
|
|
|
8
8
|
y: NodeIdentifiers;
|
|
9
9
|
};
|
|
10
10
|
export declare abstract class PointConstructor {
|
|
11
|
+
static origin(name?: string): Point;
|
|
11
12
|
static random(name: string, min?: number, max?: number): Point;
|
|
12
13
|
static fromIdentifiers(identifiers: PointIdentifiers): Point;
|
|
13
14
|
static onSegment(A: Point, B: Point, name: string, { spacing, coefficient, }?: {
|
|
@@ -32,6 +33,8 @@ export declare class Point {
|
|
|
32
33
|
distanceTo(B: Point): number;
|
|
33
34
|
equals(B: Point): boolean;
|
|
34
35
|
isAligned(B: Point, C: Point): boolean;
|
|
36
|
+
toMathString(): string;
|
|
35
37
|
toGGBCommand({ isFixed, showLabel, style, size, color, }?: ToGGBCommandsProps): string[];
|
|
38
|
+
rotate(angle: number, center: Point): Point;
|
|
36
39
|
}
|
|
37
40
|
//# sourceMappingURL=point.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/point.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAG/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AACvF,OAAO,EAEL,eAAe,EAChB,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/point.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAG/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AACvF,OAAO,EAEL,eAAe,EAChB,MAAM,kCAAkC,CAAC;AAM1C,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,eAAe,CAAC;IACnB,CAAC,EAAE,eAAe,CAAC;CACpB,CAAC;AACF,8BAAsB,gBAAgB;IACpC,MAAM,CAAC,MAAM,CAAC,IAAI,SAAM;IAGxB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAM,EAAE,GAAG,SAAK,GAAG,KAAK;IAMvD,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,gBAAgB;IAQpD,MAAM,CAAC,SAAS,CACd,CAAC,EAAE,KAAK,EACR,CAAC,EAAE,KAAK,EACR,IAAI,EAAE,MAAM,EACZ,EACE,OAAa,EACb,WAAW,GACZ,GAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAO;IAQpD,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE;IAetC,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,MAAM;CAclC;AAED,qBAAa,KAAK;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,aAAa,CAAC;IACjB,CAAC,EAAE,aAAa,CAAC;gBACL,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,aAAa;IAM5D,KAAK,IAAI,MAAM;IAGf,aAAa,IAAI,gBAAgB;IAQjC,eAAe,IAAI,MAAM;IAGzB,QAAQ,IAAI,MAAM;IAIlB,UAAU,IAAI,MAAM;IAIpB,UAAU,IAAI,MAAM;IAIpB,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,SAAM,GAAG,KAAK;IAiBrC,UAAU,CAAC,CAAC,EAAE,KAAK,GAAG,MAAM;IAM5B,MAAM,CAAC,CAAC,EAAE,KAAK,GAAG,OAAO;IAGzB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK;IAK5B,YAAY;IAGZ,YAAY,CAAC,EACX,OAAc,EACd,SAAgB,EAChB,KAAK,EACL,IAAI,EACJ,KAAK,GACN,GAAE,kBAAuB;IAiB1B,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK;CAiBpC"}
|
|
@@ -8,7 +8,13 @@ const vector_1 = require("./vector");
|
|
|
8
8
|
const randint_1 = require("../utils/random/randint");
|
|
9
9
|
const nodeConstructor_1 = require("../../tree/nodes/nodeConstructor");
|
|
10
10
|
const randfloat_1 = require("../utils/random/randfloat");
|
|
11
|
+
const substractNode_1 = require("../../tree/nodes/operators/substractNode");
|
|
12
|
+
const multiplyNode_1 = require("../../tree/nodes/operators/multiplyNode");
|
|
13
|
+
const addNode_1 = require("../../tree/nodes/operators/addNode");
|
|
11
14
|
class PointConstructor {
|
|
15
|
+
static origin(name = "O") {
|
|
16
|
+
return new Point(name, new numberNode_1.NumberNode(0), new numberNode_1.NumberNode(0));
|
|
17
|
+
}
|
|
12
18
|
static random(name, min = -10, max = 11) {
|
|
13
19
|
const x = (0, randint_1.randint)(min, max);
|
|
14
20
|
const y = (0, randint_1.randint)(min, max);
|
|
@@ -103,6 +109,9 @@ class Point {
|
|
|
103
109
|
const AC = vector_1.VectorConstructor.fromPoints(this, C);
|
|
104
110
|
return AB.isColinear(AC);
|
|
105
111
|
}
|
|
112
|
+
toMathString() {
|
|
113
|
+
return `(${this.x.toMathString()}, ${this.y.toMathString()})`;
|
|
114
|
+
}
|
|
106
115
|
toGGBCommand({ isFixed = true, showLabel = true, style, size, color, } = {}) {
|
|
107
116
|
const commands = [
|
|
108
117
|
`${this.name} = (${this.x.toMathString()}, ${this.y.toMathString()})`,
|
|
@@ -120,5 +129,12 @@ class Point {
|
|
|
120
129
|
}
|
|
121
130
|
return commands;
|
|
122
131
|
}
|
|
132
|
+
rotate(angle, center) {
|
|
133
|
+
//x' = cos(t)*x -sin(t)*y
|
|
134
|
+
//y' = sin(t)*x + cos(t)*y
|
|
135
|
+
const cos = Math.cos(angle);
|
|
136
|
+
const sin = Math.sin(angle);
|
|
137
|
+
return new Point(this.name, (0, substractNode_1.substract)((0, multiplyNode_1.multiply)(cos, this.x).simplify(), (0, multiplyNode_1.multiply)(sin, this.y).simplify()).simplify(), (0, addNode_1.add)((0, multiplyNode_1.multiply)(sin, this.x).simplify(), (0, multiplyNode_1.multiply)(cos, this.y).simplify()).simplify());
|
|
138
|
+
}
|
|
123
139
|
}
|
|
124
140
|
exports.Point = Point;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Point } from "./point";
|
|
2
|
+
import { Segment } from "./segment";
|
|
3
|
+
export declare class Quadrilateral {
|
|
4
|
+
commands: string[];
|
|
5
|
+
points: Point[];
|
|
6
|
+
sides: Segment[];
|
|
7
|
+
name: string;
|
|
8
|
+
constructor(points: Point[]);
|
|
9
|
+
drawDiagonals({ drawCenter, drawDecorations, }: {
|
|
10
|
+
drawCenter: boolean;
|
|
11
|
+
drawDecorations: boolean;
|
|
12
|
+
}): void;
|
|
13
|
+
toGGBCommands(): string[];
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=quadrilateral.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quadrilateral.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/quadrilateral.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,qBAAa,aAAa;IACxB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;gBACD,MAAM,EAAE,KAAK,EAAE;IAuB3B,aAAa,CAAC,EACZ,UAAkB,EAClB,eAAuB,GACxB,EAAE;QACD,UAAU,EAAE,OAAO,CAAC;QACpB,eAAe,EAAE,OAAO,CAAC;KAC1B;IAcD,aAAa;CAGd"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Quadrilateral = void 0;
|
|
4
|
+
const segment_1 = require("./segment");
|
|
5
|
+
class Quadrilateral {
|
|
6
|
+
constructor(points) {
|
|
7
|
+
if (points.length !== 4)
|
|
8
|
+
throw new Error("Quadrilateral must have 4 points");
|
|
9
|
+
this.name = points.map((p) => p.name).join("");
|
|
10
|
+
this.points = points;
|
|
11
|
+
this.sides = [
|
|
12
|
+
new segment_1.Segment(points[0], points[1]),
|
|
13
|
+
new segment_1.Segment(points[1], points[2]),
|
|
14
|
+
new segment_1.Segment(points[2], points[3]),
|
|
15
|
+
new segment_1.Segment(points[3], points[0]),
|
|
16
|
+
];
|
|
17
|
+
this.commands = [
|
|
18
|
+
...points.flatMap((p) => p.toGGBCommand({
|
|
19
|
+
isFixed: true,
|
|
20
|
+
showLabel: true,
|
|
21
|
+
})),
|
|
22
|
+
...this.sides.flatMap((s) => s.toGGBCommands(false)),
|
|
23
|
+
];
|
|
24
|
+
}
|
|
25
|
+
drawDiagonals({ drawCenter = false, drawDecorations = false, }) {
|
|
26
|
+
const res = [];
|
|
27
|
+
res.push(`diago1 = Segment(${this.points[0].name}, ${this.points[2].name})`);
|
|
28
|
+
res.push(`diago2 = Segment(${this.points[1].name}, ${this.points[3].name})`);
|
|
29
|
+
if (drawCenter) {
|
|
30
|
+
res.push(`diagoCenter = Intersect(diago1, diago2)`);
|
|
31
|
+
}
|
|
32
|
+
this.commands.push(...res);
|
|
33
|
+
}
|
|
34
|
+
toGGBCommands() {
|
|
35
|
+
return this.commands;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.Quadrilateral = Quadrilateral;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Parallelogram } from "./parallelogram";
|
|
2
|
+
import { Point, PointIdentifiers } from "./point";
|
|
3
|
+
export declare abstract class RectangleConstructor {
|
|
4
|
+
static random(): Rectangle;
|
|
5
|
+
static fromIdentifiers(identifiers: RectangleIdentifiers): Rectangle;
|
|
6
|
+
}
|
|
7
|
+
export type RectangleIdentifiers = {
|
|
8
|
+
points: PointIdentifiers[];
|
|
9
|
+
};
|
|
10
|
+
export declare class Rectangle extends Parallelogram {
|
|
11
|
+
constructor(points: Point[]);
|
|
12
|
+
toIdentifiers(): RectangleIdentifiers;
|
|
13
|
+
drawDiagonals({ drawCenter, drawDecorations, isRhombus, }: {
|
|
14
|
+
drawCenter: boolean;
|
|
15
|
+
drawDecorations: boolean;
|
|
16
|
+
isRhombus?: boolean;
|
|
17
|
+
}): void;
|
|
18
|
+
drawSidesDecoration({ drawAngles, drawSidesLengths, isRhombus, }: {
|
|
19
|
+
drawAngles: boolean;
|
|
20
|
+
drawSidesLengths: boolean;
|
|
21
|
+
isRhombus?: boolean;
|
|
22
|
+
}): void;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=rectangle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rectangle.d.ts","sourceRoot":"","sources":["../../../src/math/geometry/rectangle.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAoB,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAIpE,8BAAsB,oBAAoB;IACxC,MAAM,CAAC,MAAM;IAyBb,MAAM,CAAC,eAAe,CAAC,WAAW,EAAE,oBAAoB;CAOzD;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,gBAAgB,EAAE,CAAC;CAC5B,CAAC;AACF,qBAAa,SAAU,SAAQ,aAAa;gBAC9B,MAAM,EAAE,KAAK,EAAE;IAG3B,aAAa,IAAI,oBAAoB;IAKrC,aAAa,CAAC,EACZ,UAAU,EACV,eAAe,EACf,SAAS,GACV,EAAE;QACD,UAAU,EAAE,OAAO,CAAC;QACpB,eAAe,EAAE,OAAO,CAAC;QACzB,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB,GAAG,IAAI;IASR,mBAAmB,CAAC,EAClB,UAAU,EACV,gBAAgB,EAChB,SAAS,GACV,EAAE;QACD,UAAU,EAAE,OAAO,CAAC;QACpB,gBAAgB,EAAE,OAAO,CAAC;QAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB,GAAG,IAAI;CA2BT"}
|