@vived/app 2.11.2 → 2.15.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.
Files changed (87) hide show
  1. package/lib/Entities/Babylon.d.ts +1 -2
  2. package/lib/Entities/Babylon.js +6 -7
  3. package/lib/Entities/DevicePreview.d.ts +1 -1
  4. package/lib/Entities/DevicePreview.js +5 -5
  5. package/lib/Entities/FocusCamera.d.ts +1 -1
  6. package/lib/Entities/FocusCamera.js +19 -19
  7. package/lib/Entities/MemoizedBoolean.d.ts +1 -0
  8. package/lib/Entities/MemoizedBoolean.js +3 -0
  9. package/lib/Entities/MemoizedNumber.d.ts +1 -0
  10. package/lib/Entities/MemoizedNumber.js +3 -0
  11. package/lib/Entities/MemoizedString.d.ts +1 -0
  12. package/lib/Entities/MemoizedString.js +3 -0
  13. package/lib/Entities/MemoizedVector2.d.ts +4 -7
  14. package/lib/Entities/MemoizedVector2.js +9 -23
  15. package/lib/Entities/MemoizedVector3.d.ts +4 -9
  16. package/lib/Entities/MemoizedVector3.js +9 -32
  17. package/lib/Entities/MouseInput.d.ts +11 -5
  18. package/lib/Entities/MouseInput.js +24 -9
  19. package/lib/Entities/ParametricLine.d.ts +1 -1
  20. package/lib/Entities/ParametricLine.js +8 -8
  21. package/lib/Entities/ParametricPlane.d.ts +3 -3
  22. package/lib/Entities/ParametricPlane.js +10 -10
  23. package/lib/Entities/QuestionChallenge.d.ts +21 -0
  24. package/lib/Entities/QuestionChallenge.js +103 -0
  25. package/lib/Entities/QuestionChallengeAnswer.d.ts +32 -0
  26. package/lib/Entities/QuestionChallengeAnswer.js +51 -0
  27. package/lib/Entities/TouchInput.d.ts +16 -8
  28. package/lib/Entities/TouchInput.js +56 -27
  29. package/lib/Entities/index.d.ts +2 -6
  30. package/lib/Entities/index.js +2 -6
  31. package/lib/PresentationManagers/FocusCameraPM.d.ts +2 -1
  32. package/lib/PresentationManagers/FocusCameraPM.js +4 -4
  33. package/lib/PresentationManagers/QuestionChallenge/AuthorQuestionChallengeAnswerPM.d.ts +24 -0
  34. package/lib/PresentationManagers/QuestionChallenge/AuthorQuestionChallengeAnswerPM.js +65 -0
  35. package/lib/PresentationManagers/QuestionChallenge/AuthorQuestionChallengePM.d.ts +17 -0
  36. package/lib/PresentationManagers/QuestionChallenge/AuthorQuestionChallengePM.js +46 -0
  37. package/lib/PresentationManagers/QuestionChallenge/QuestionChallengeAnswerPM.d.ts +17 -0
  38. package/lib/PresentationManagers/QuestionChallenge/QuestionChallengeAnswerPM.js +51 -0
  39. package/lib/PresentationManagers/QuestionChallenge/QuestionChallengePM.d.ts +15 -0
  40. package/lib/PresentationManagers/QuestionChallenge/QuestionChallengePM.js +34 -0
  41. package/lib/PresentationManagers/QuestionChallenge/index.d.ts +4 -0
  42. package/lib/PresentationManagers/QuestionChallenge/index.js +16 -0
  43. package/lib/PresentationManagers/index.d.ts +1 -0
  44. package/lib/PresentationManagers/index.js +1 -0
  45. package/lib/UseCases/FocusCamera/BumpDollyFocusCamera.d.ts +2 -1
  46. package/lib/UseCases/FocusCamera/BumpDollyFocusCamera.js +4 -3
  47. package/lib/UseCases/FocusCamera/LerpFocusCamera.js +2 -2
  48. package/lib/UseCases/FocusCamera/PinchDollyFocusCamera.d.ts +2 -1
  49. package/lib/UseCases/FocusCamera/PinchDollyFocusCamera.js +4 -3
  50. package/lib/UseCases/FocusCamera/PixelDollyFocusCamera.d.ts +2 -1
  51. package/lib/UseCases/FocusCamera/PixelDollyFocusCamera.js +5 -5
  52. package/lib/UseCases/FocusCamera/PixelOrbitFocusCamera.d.ts +2 -1
  53. package/lib/UseCases/FocusCamera/PixelOrbitFocusCamera.js +2 -1
  54. package/lib/UseCases/FocusCamera/PixelPlanePanFocusCamera.d.ts +2 -1
  55. package/lib/UseCases/FocusCamera/PixelPlanePanFocusCamera.js +4 -4
  56. package/lib/UseCases/FocusCamera/SerializeFocusCamera.js +2 -2
  57. package/lib/UseCases/QuestionChallenge/SerializeQuestionChallenge.d.ts +25 -0
  58. package/lib/UseCases/QuestionChallenge/SerializeQuestionChallenge.js +70 -0
  59. package/lib/UseCases/QuestionChallenge/index.d.ts +4 -0
  60. package/lib/UseCases/QuestionChallenge/index.js +16 -0
  61. package/lib/UseCases/QuestionChallenge/setQuesionChallengeAnswerFeedback.d.ts +2 -0
  62. package/lib/UseCases/QuestionChallenge/setQuesionChallengeAnswerFeedback.js +16 -0
  63. package/lib/UseCases/QuestionChallenge/setQuesionChallengeAnswerText.d.ts +2 -0
  64. package/lib/UseCases/QuestionChallenge/setQuesionChallengeAnswerText.js +16 -0
  65. package/lib/UseCases/QuestionChallenge/toggleQuesionChallengeAnswerIsCorrect.d.ts +2 -0
  66. package/lib/UseCases/QuestionChallenge/toggleQuesionChallengeAnswerIsCorrect.js +16 -0
  67. package/lib/UseCases/index.d.ts +1 -0
  68. package/lib/UseCases/index.js +1 -0
  69. package/lib/ValueObjects/Angle.d.ts +8 -0
  70. package/lib/ValueObjects/Angle.js +22 -0
  71. package/lib/ValueObjects/Color.d.ts +23 -0
  72. package/lib/ValueObjects/Color.js +791 -0
  73. package/lib/ValueObjects/LineSegment2D.d.ts +12 -0
  74. package/lib/ValueObjects/LineSegment2D.js +58 -0
  75. package/lib/ValueObjects/ParametricLine.d.ts +27 -0
  76. package/lib/ValueObjects/ParametricLine.js +66 -0
  77. package/lib/ValueObjects/ParametricPlane.d.ts +20 -0
  78. package/lib/ValueObjects/ParametricPlane.js +64 -0
  79. package/lib/ValueObjects/Vector2.d.ts +22 -0
  80. package/lib/ValueObjects/Vector2.js +87 -0
  81. package/lib/ValueObjects/Vector3.d.ts +25 -0
  82. package/lib/ValueObjects/Vector3.js +91 -0
  83. package/lib/ValueObjects/index.d.ts +7 -0
  84. package/lib/ValueObjects/index.js +19 -0
  85. package/lib/index.d.ts +2 -0
  86. package/lib/index.js +3 -1
  87. package/package.json +1 -1
@@ -0,0 +1,12 @@
1
+ import { Vector2 } from "./Vector2";
2
+ export declare class LineSegment2D {
3
+ private _start;
4
+ get start(): Vector2;
5
+ private _end;
6
+ get end(): Vector2;
7
+ get length(): number;
8
+ get direction(): Vector2;
9
+ getPositionAtPercent(percent: number): Vector2;
10
+ intersect(otherLine: LineSegment2D, tolerance?: number): Vector2 | undefined;
11
+ constructor(start: Vector2, end: Vector2);
12
+ }
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LineSegment2D = void 0;
4
+ const Vector2_1 = require("./Vector2");
5
+ class LineSegment2D {
6
+ constructor(start, end) {
7
+ this._start = start;
8
+ this._end = end;
9
+ }
10
+ get start() {
11
+ return this._start;
12
+ }
13
+ get end() {
14
+ return this._end;
15
+ }
16
+ get length() {
17
+ return Vector2_1.Vector2.subtract(this._start, this._end).magnitued;
18
+ }
19
+ get direction() {
20
+ return Vector2_1.Vector2.subtract(this._end, this._start).unit;
21
+ }
22
+ getPositionAtPercent(percent) {
23
+ const dir = this.direction;
24
+ const length = percent * this.length;
25
+ const localPos = Vector2_1.Vector2.newVectorOfLength(dir, length);
26
+ return Vector2_1.Vector2.add(this._start, localPos);
27
+ }
28
+ intersect(otherLine, tolerance = 0) {
29
+ // See https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection
30
+ const x1 = this.start.x;
31
+ const y1 = this.start.y;
32
+ const x2 = this.end.x;
33
+ const y2 = this.end.y;
34
+ const x3 = otherLine.start.x;
35
+ const y3 = otherLine.start.y;
36
+ const x4 = otherLine.end.x;
37
+ const y4 = otherLine.end.y;
38
+ const denominator = (x1 - x2) * (y3 - y4) - (y1 - y2) * (x3 - x4);
39
+ if (denominator === 0) {
40
+ return undefined;
41
+ }
42
+ const tNumerator = (x1 - x3) * (y3 - y4) - (y1 - y3) * (x3 - x4);
43
+ const t = tNumerator / denominator;
44
+ const tTolearnce = tolerance / this.length;
45
+ if (t < -tTolearnce || t > 1 + tTolearnce) {
46
+ return undefined;
47
+ }
48
+ const uNumerator = (x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3);
49
+ const u = uNumerator / denominator;
50
+ const uTolearnce = tolerance / otherLine.length;
51
+ if (u < -uTolearnce || u > 1 + uTolearnce)
52
+ return undefined;
53
+ const px = x1 + t * (x2 - x1);
54
+ const py = y1 + t * (y2 - y1);
55
+ return new Vector2_1.Vector2(px, py);
56
+ }
57
+ }
58
+ exports.LineSegment2D = LineSegment2D;
@@ -0,0 +1,27 @@
1
+ import { Vector3 } from "../ValueObjects/Vector3";
2
+ export interface LineParameters {
3
+ x0: number;
4
+ y0: number;
5
+ z0: number;
6
+ a: number;
7
+ b: number;
8
+ c: number;
9
+ }
10
+ export declare class ParametricLine {
11
+ static FromTwoPoint(p1: Vector3, p2: Vector3): ParametricLine;
12
+ static FromPointDirection(point: Vector3, direction: Vector3): ParametricLine;
13
+ static Forward(): ParametricLine;
14
+ static Backward(): ParametricLine;
15
+ static Up(): ParametricLine;
16
+ static Down(): ParametricLine;
17
+ static Left(): ParametricLine;
18
+ static Right(): ParametricLine;
19
+ static getPointAtDistance(line: ParametricLine, distance: number): Vector3;
20
+ readonly x0: number;
21
+ readonly y0: number;
22
+ readonly z0: number;
23
+ readonly a: number;
24
+ readonly b: number;
25
+ readonly c: number;
26
+ constructor(parameters: LineParameters);
27
+ }
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ParametricLine = void 0;
4
+ const Vector3_1 = require("../ValueObjects/Vector3");
5
+ class ParametricLine {
6
+ constructor(parameters) {
7
+ this.x0 = parameters.x0;
8
+ this.y0 = parameters.y0;
9
+ this.z0 = parameters.z0;
10
+ this.a = parameters.a;
11
+ this.b = parameters.b;
12
+ this.c = parameters.c;
13
+ }
14
+ // See https://planetcalc.com/8253/
15
+ static FromTwoPoint(p1, p2) {
16
+ const dir = Vector3_1.Vector3.subtract(p2, p1).unit;
17
+ return this.FromPointDirection(p1, dir);
18
+ }
19
+ static FromPointDirection(point, direction) {
20
+ return new ParametricLine({
21
+ x0: point.x,
22
+ y0: point.y,
23
+ z0: point.z,
24
+ a: direction.x,
25
+ b: direction.y,
26
+ c: direction.z,
27
+ });
28
+ }
29
+ static Forward() {
30
+ const p = Vector3_1.Vector3.zero();
31
+ const d = new Vector3_1.Vector3(0, 0, 1);
32
+ return this.FromPointDirection(p, d);
33
+ }
34
+ static Backward() {
35
+ const p = Vector3_1.Vector3.zero();
36
+ const d = new Vector3_1.Vector3(0, 0, -1);
37
+ return this.FromPointDirection(p, d);
38
+ }
39
+ static Up() {
40
+ const p = Vector3_1.Vector3.zero();
41
+ const d = new Vector3_1.Vector3(0, 1, 0);
42
+ return this.FromPointDirection(p, d);
43
+ }
44
+ static Down() {
45
+ const p = Vector3_1.Vector3.zero();
46
+ const d = new Vector3_1.Vector3(0, -1, 0);
47
+ return this.FromPointDirection(p, d);
48
+ }
49
+ static Left() {
50
+ const p = Vector3_1.Vector3.zero();
51
+ const d = new Vector3_1.Vector3(-1, 0, 0);
52
+ return this.FromPointDirection(p, d);
53
+ }
54
+ static Right() {
55
+ const p = Vector3_1.Vector3.zero();
56
+ const d = new Vector3_1.Vector3(1, 0, 0);
57
+ return this.FromPointDirection(p, d);
58
+ }
59
+ static getPointAtDistance(line, distance) {
60
+ const x = line.x0 + line.a * distance;
61
+ const y = line.y0 + line.b * distance;
62
+ const z = line.z0 + line.c * distance;
63
+ return new Vector3_1.Vector3(x, y, z);
64
+ }
65
+ }
66
+ exports.ParametricLine = ParametricLine;
@@ -0,0 +1,20 @@
1
+ import { ParametricLine } from "./ParametricLine";
2
+ import { Vector3 } from "../ValueObjects/Vector3";
3
+ export interface PlaneParameters {
4
+ a: number;
5
+ b: number;
6
+ c: number;
7
+ d: number;
8
+ }
9
+ export declare class ParametricPlane {
10
+ private point;
11
+ private normal;
12
+ static FromPointNormal(point: Vector3, normal: Vector3): ParametricPlane;
13
+ static FromThreePoints(A: Vector3, B: Vector3, C: Vector3): ParametricPlane;
14
+ static XY(): ParametricPlane;
15
+ static ZX(): ParametricPlane;
16
+ static YZ(): ParametricPlane;
17
+ getParameters(): PlaneParameters;
18
+ intersectLine(line: ParametricLine): Vector3 | undefined;
19
+ constructor(point: Vector3, normal: Vector3);
20
+ }
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ParametricPlane = void 0;
4
+ const ParametricLine_1 = require("./ParametricLine");
5
+ const Vector3_1 = require("../ValueObjects/Vector3");
6
+ class ParametricPlane {
7
+ constructor(point, normal) {
8
+ this.point = point;
9
+ this.normal = normal;
10
+ }
11
+ static FromPointNormal(point, normal) {
12
+ return new ParametricPlane(point, normal);
13
+ }
14
+ static FromThreePoints(A, B, C) {
15
+ const point = A;
16
+ const AB = Vector3_1.Vector3.subtract(B, A);
17
+ const AC = Vector3_1.Vector3.subtract(C, A);
18
+ const normal = Vector3_1.Vector3.cross(AB, AC);
19
+ return new ParametricPlane(point, normal);
20
+ }
21
+ static XY() {
22
+ const p = Vector3_1.Vector3.zero();
23
+ const n = new Vector3_1.Vector3(0, 0, 1);
24
+ return new ParametricPlane(p, n);
25
+ }
26
+ static ZX() {
27
+ const p = Vector3_1.Vector3.zero();
28
+ const n = new Vector3_1.Vector3(0, 1, 0);
29
+ return new ParametricPlane(p, n);
30
+ }
31
+ static YZ() {
32
+ const p = Vector3_1.Vector3.zero();
33
+ const n = new Vector3_1.Vector3(1, 0, 0);
34
+ return new ParametricPlane(p, n);
35
+ }
36
+ getParameters() {
37
+ const a = this.normal.x;
38
+ const b = this.normal.y;
39
+ const c = this.normal.z;
40
+ let d = Vector3_1.Vector3.dot(this.point, this.normal);
41
+ if (d !== 0) {
42
+ d *= -1;
43
+ }
44
+ return {
45
+ a,
46
+ b,
47
+ c,
48
+ d,
49
+ };
50
+ }
51
+ intersectLine(line) {
52
+ const { x0, y0, z0, a, b, c } = line;
53
+ const { a: A, b: B, c: C, d: D } = this.getParameters();
54
+ const tNumerator = -(A * x0 + B * y0 + C * z0 + D);
55
+ const tDenominator = A * a + B * b + C * c;
56
+ if (tDenominator === 0) {
57
+ return undefined;
58
+ }
59
+ const t = tNumerator / tDenominator;
60
+ const intersect = ParametricLine_1.ParametricLine.getPointAtDistance(line, t);
61
+ return intersect;
62
+ }
63
+ }
64
+ exports.ParametricPlane = ParametricPlane;
@@ -0,0 +1,22 @@
1
+ import { Angle } from ".";
2
+ export declare class Vector2 {
3
+ static zero(): Vector2;
4
+ static one(): Vector2;
5
+ static equal(a: Vector2, b: Vector2): boolean;
6
+ static add(a: Vector2, b: Vector2): Vector2;
7
+ static subtract(a: Vector2, b: Vector2): Vector2;
8
+ static close: (a: Vector2, b: Vector2, threshold?: number) => boolean;
9
+ static rotate: (vec: Vector2, angle: Angle) => Vector2;
10
+ static scale: (vector: Vector2, scale: number) => Vector2;
11
+ static newVectorOfLength: (vector: Vector2, length: number) => Vector2;
12
+ static dot: (a: Vector2, b: Vector2) => number;
13
+ static angleBetween: (a: Vector2, b: Vector2) => Angle;
14
+ static cross: (a: Vector2, b: Vector2) => number;
15
+ readonly x: number;
16
+ readonly y: number;
17
+ get magnitued(): number;
18
+ get unit(): Vector2;
19
+ get theta(): number;
20
+ get array(): [number, number];
21
+ constructor(x: number, y: number);
22
+ }
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Vector2 = void 0;
4
+ const _1 = require(".");
5
+ class Vector2 {
6
+ constructor(x, y) {
7
+ this.x = x;
8
+ this.y = y;
9
+ }
10
+ static zero() {
11
+ return new Vector2(0, 0);
12
+ }
13
+ static one() {
14
+ return new Vector2(1, 1);
15
+ }
16
+ static equal(a, b) {
17
+ if (a.x !== b.x)
18
+ return false;
19
+ if (a.y !== b.y)
20
+ return false;
21
+ return true;
22
+ }
23
+ static add(a, b) {
24
+ return new Vector2(a.x + b.x, a.y + b.y);
25
+ }
26
+ static subtract(a, b) {
27
+ return new Vector2(a.x - b.x, a.y - b.y);
28
+ }
29
+ get magnitued() {
30
+ const xSqr = this.x * this.x;
31
+ const ySqr = this.y * this.y;
32
+ const magnitude = Math.sqrt(xSqr + ySqr);
33
+ return magnitude;
34
+ }
35
+ get unit() {
36
+ const mag = this.magnitued;
37
+ if (mag === 0) {
38
+ return Vector2.zero();
39
+ }
40
+ const unitX = this.x / mag;
41
+ const unitY = this.y / mag;
42
+ return new Vector2(unitX, unitY);
43
+ }
44
+ get theta() {
45
+ return (Math.atan2(this.y, this.x) * 180) / Math.PI;
46
+ }
47
+ get array() {
48
+ return [this.x, this.y];
49
+ }
50
+ }
51
+ exports.Vector2 = Vector2;
52
+ Vector2.close = (a, b, threshold = 0.01) => {
53
+ const diff = Vector2.subtract(a, b);
54
+ const diffMag = diff.magnitued;
55
+ if (diffMag < threshold)
56
+ return true;
57
+ else
58
+ return false;
59
+ };
60
+ Vector2.rotate = (vec, angle) => {
61
+ const x = vec.x * Math.cos(angle.radians) - vec.y * Math.sin(angle.radians);
62
+ const y = vec.x * Math.sin(angle.radians) + vec.y * Math.cos(angle.radians);
63
+ return new Vector2(x, y);
64
+ };
65
+ Vector2.scale = (vector, scale) => {
66
+ const x = scale * vector.x;
67
+ const y = scale * vector.y;
68
+ return new Vector2(x, y);
69
+ };
70
+ Vector2.newVectorOfLength = (vector, length) => {
71
+ const unit = vector.unit;
72
+ const x = length * unit.x;
73
+ const y = length * unit.y;
74
+ return new Vector2(x, y);
75
+ };
76
+ Vector2.dot = (a, b) => {
77
+ return a.x * b.x + a.y * b.y;
78
+ };
79
+ Vector2.angleBetween = (a, b) => {
80
+ const dot = Vector2.dot(a, b);
81
+ const magnitues = a.magnitued * b.magnitued;
82
+ const angRadians = Math.acos(dot / magnitues);
83
+ return _1.Angle.fromRadians(angRadians);
84
+ };
85
+ Vector2.cross = (a, b) => {
86
+ return a.x * b.y - a.y * b.x;
87
+ };
@@ -0,0 +1,25 @@
1
+ export declare class Vector3 {
2
+ static zero(): Vector3;
3
+ static one(): Vector3;
4
+ static right(length?: number): Vector3;
5
+ static left(length?: number): Vector3;
6
+ static up(length?: number): Vector3;
7
+ static down(length?: number): Vector3;
8
+ static forward(length?: number): Vector3;
9
+ static backward(length?: number): Vector3;
10
+ static fromArray(values: [number, number, number]): Vector3;
11
+ static add: (a: Vector3, b: Vector3) => Vector3;
12
+ static subtract: (a: Vector3, b: Vector3) => Vector3;
13
+ static equal: (a: Vector3, b: Vector3) => boolean;
14
+ static close: (a: Vector3, b: Vector3, tolerance?: number) => boolean;
15
+ static cross: (a: Vector3, b: Vector3) => Vector3;
16
+ static dot: (a: Vector3, b: Vector3) => number;
17
+ static newVectorOfLength: (vec: Vector3, length: number) => Vector3;
18
+ readonly x: number;
19
+ readonly y: number;
20
+ readonly z: number;
21
+ get magnitued(): number;
22
+ get unit(): Vector3;
23
+ get array(): [number, number, number];
24
+ constructor(x: number, y: number, z: number);
25
+ }
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Vector3 = void 0;
4
+ class Vector3 {
5
+ constructor(x, y, z) {
6
+ this.x = x;
7
+ this.y = y;
8
+ this.z = z;
9
+ }
10
+ static zero() {
11
+ return new Vector3(0, 0, 0);
12
+ }
13
+ static one() {
14
+ return new Vector3(1, 1, 1);
15
+ }
16
+ static right(length = 1) {
17
+ return new Vector3(length, 0, 0);
18
+ }
19
+ static left(length = 1) {
20
+ return new Vector3(-length, 0, 0);
21
+ }
22
+ static up(length = 1) {
23
+ return new Vector3(0, length, 0);
24
+ }
25
+ static down(length = 1) {
26
+ return new Vector3(0, -length, 0);
27
+ }
28
+ static forward(length = 1) {
29
+ return new Vector3(0, 0, length);
30
+ }
31
+ static backward(length = 1) {
32
+ return new Vector3(0, 0, -length);
33
+ }
34
+ static fromArray(values) {
35
+ return new Vector3(values[0], values[1], values[2]);
36
+ }
37
+ get magnitued() {
38
+ const xSqr = this.x * this.x;
39
+ const ySqr = this.y * this.y;
40
+ const zSqr = this.z * this.z;
41
+ const magnitude = Math.sqrt(xSqr + ySqr + zSqr);
42
+ return magnitude;
43
+ }
44
+ get unit() {
45
+ const mag = this.magnitued;
46
+ if (mag === 0) {
47
+ return Vector3.zero();
48
+ }
49
+ const unitX = this.x / mag;
50
+ const unitY = this.y / mag;
51
+ const unitZ = this.z / mag;
52
+ return new Vector3(unitX, unitY, unitZ);
53
+ }
54
+ get array() {
55
+ return [this.x, this.y, this.z];
56
+ }
57
+ }
58
+ exports.Vector3 = Vector3;
59
+ Vector3.add = (a, b) => {
60
+ return new Vector3(a.x + b.x, a.y + b.y, a.z + b.z);
61
+ };
62
+ Vector3.subtract = (a, b) => {
63
+ return new Vector3(a.x - b.x, a.y - b.y, a.z - b.z);
64
+ };
65
+ Vector3.equal = (a, b) => {
66
+ if (a.x === b.x && a.y === b.y && a.z === b.z)
67
+ return true;
68
+ else
69
+ return false;
70
+ };
71
+ Vector3.close = (a, b, tolerance = 0.01) => {
72
+ const diff = Vector3.subtract(a, b);
73
+ const diffMag = diff.magnitued;
74
+ if (diffMag < tolerance)
75
+ return true;
76
+ else
77
+ return false;
78
+ };
79
+ Vector3.cross = (a, b) => {
80
+ const x = a.y * b.z - a.z * b.y;
81
+ const y = a.z * b.x - a.x * b.z;
82
+ const z = a.x * b.y - a.y * b.x;
83
+ return new Vector3(x, y, z);
84
+ };
85
+ Vector3.dot = (a, b) => {
86
+ return a.x * b.x + a.y * b.y + a.z * b.z;
87
+ };
88
+ Vector3.newVectorOfLength = (vec, length) => {
89
+ const unit = vec.unit;
90
+ return new Vector3(length * unit.x, length * unit.y, length * unit.z);
91
+ };
@@ -0,0 +1,7 @@
1
+ export * from "./Color";
2
+ export * from "./LineSegment2D";
3
+ export * from "./Vector2";
4
+ export * from "./Angle";
5
+ export * from "./Vector3";
6
+ export * from "./ParametricLine";
7
+ export * from "./ParametricPlane";
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("./Color"), exports);
14
+ __exportStar(require("./LineSegment2D"), exports);
15
+ __exportStar(require("./Vector2"), exports);
16
+ __exportStar(require("./Angle"), exports);
17
+ __exportStar(require("./Vector3"), exports);
18
+ __exportStar(require("./ParametricLine"), exports);
19
+ __exportStar(require("./ParametricPlane"), exports);
package/lib/index.d.ts CHANGED
@@ -4,4 +4,6 @@ import * as AppUCs from "./UseCases";
4
4
  export { AppUCs };
5
5
  import * as AppEntities from "./Entities";
6
6
  export { AppEntities };
7
+ import * as AppValueObjects from "./ValueObjects";
8
+ export { AppValueObjects };
7
9
  export * from "./Utilities";
package/lib/index.js CHANGED
@@ -10,11 +10,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
10
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.AppEntities = exports.AppUCs = exports.AppPMs = void 0;
13
+ exports.AppValueObjects = exports.AppEntities = exports.AppUCs = exports.AppPMs = void 0;
14
14
  const AppPMs = require("./PresentationManagers");
15
15
  exports.AppPMs = AppPMs;
16
16
  const AppUCs = require("./UseCases");
17
17
  exports.AppUCs = AppUCs;
18
18
  const AppEntities = require("./Entities");
19
19
  exports.AppEntities = AppEntities;
20
+ const AppValueObjects = require("./ValueObjects");
21
+ exports.AppValueObjects = AppValueObjects;
20
22
  __exportStar(require("./Utilities"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vived/app",
3
- "version": "2.11.2",
3
+ "version": "2.15.1",
4
4
  "description": "Public package for the VIVED Learning App system",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",