Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: solve math design circular dependency #488

Merged
merged 2 commits into from
Sep 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/design/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@
"dist/**/*",
"types/**/*"
],
"types": "types/index.d.ts"
"types": "types/index.d.ts",
"dependencies": {
"@oasis-engine/math": "0.5.2"
}
}
5 changes: 1 addition & 4 deletions packages/math/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,5 @@
"files": [
"dist/**/*",
"types/**/*"
],
"devDependencies": {
"@oasis-engine/design": "0.5.2"
}
]
}
2 changes: 1 addition & 1 deletion packages/math/src/BoundingBox.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IClone } from "@oasis-engine/design";
import { IClone } from "./IClone";
import { BoundingSphere } from "./BoundingSphere";
import { Matrix } from "./Matrix";
import { Vector3 } from "./Vector3";
Expand Down
2 changes: 1 addition & 1 deletion packages/math/src/BoundingFrustum.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IClone } from "@oasis-engine/design";
import { IClone } from "./IClone";
import { BoundingBox } from "./BoundingBox";
import { BoundingSphere } from "./BoundingSphere";
import { CollisionUtil } from "./CollisionUtil";
Expand Down
2 changes: 1 addition & 1 deletion packages/math/src/BoundingSphere.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IClone } from "@oasis-engine/design";
import { IClone } from "./IClone";
import { BoundingBox } from "./BoundingBox";
import { Vector3 } from "./Vector3";

Expand Down
2 changes: 1 addition & 1 deletion packages/math/src/Color.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IClone } from "@oasis-engine/design";
import { IClone } from "./IClone";
import { MathUtil } from "./MathUtil";

/**
Expand Down
16 changes: 16 additions & 0 deletions packages/math/src/IClone.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
* Clone interface.
*/
export interface IClone {
/**
* Clone and return object.
* @returns Clone object
*/
clone(): Object;

/**
* Clone to the target object.
* @param target - Target object
*/
cloneTo(target: Object): Object;
}
2 changes: 1 addition & 1 deletion packages/math/src/Matrix.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IClone } from "@oasis-engine/design";
import { IClone } from "./IClone";
import { MathUtil } from "./MathUtil";
import { Matrix3x3 } from "./Matrix3x3";
import { Quaternion } from "./Quaternion";
Expand Down
2 changes: 1 addition & 1 deletion packages/math/src/Matrix3x3.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IClone } from "@oasis-engine/design";
import { IClone } from "./IClone";
import { MathUtil } from "./MathUtil";
import { Matrix } from "./Matrix";
import { Quaternion } from "./Quaternion";
Expand Down
2 changes: 1 addition & 1 deletion packages/math/src/Plane.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IClone } from "@oasis-engine/design";
import { IClone } from "./IClone";
import { Vector3 } from "./Vector3";

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/math/src/Quaternion.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IClone } from "@oasis-engine/design";
import { IClone } from "./IClone";
import { MathUtil } from "./MathUtil";
import { Matrix3x3 } from "./Matrix3x3";
import { Vector3 } from "./Vector3";
Expand Down
2 changes: 1 addition & 1 deletion packages/math/src/Rect.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IClone } from "@oasis-engine/design";
import { IClone } from "./IClone";

// A 2d rectangle defined by x and y position, width and height.
export class Rect implements IClone {
Expand Down
5 changes: 3 additions & 2 deletions packages/math/src/SphericalHarmonics3.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IClone } from "@oasis-engine/design";
import { IClone } from "./IClone";
import { Color } from "./Color";
import { Vector3 } from "./Vector3";

Expand Down Expand Up @@ -203,7 +203,8 @@ export class SphericalHarmonics3 implements IClone {
* @param out - The specified SphericalHarmonics3
* @returns The specified SphericalHarmonics3
*/
cloneTo(out: SphericalHarmonics3): void {
cloneTo(out: SphericalHarmonics3): SphericalHarmonics3 {
this.toArray(out.coefficients);
return out;
}
}
2 changes: 1 addition & 1 deletion packages/math/src/Vector2.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IClone } from "@oasis-engine/design";
import { IClone } from "./IClone";
import { MathUtil } from "./MathUtil";

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/math/src/Vector3.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IClone } from "@oasis-engine/design";
import { IClone } from "./IClone";
import { MathUtil } from "./MathUtil";
import { Matrix } from "./Matrix";
import { Quaternion } from "./Quaternion";
Expand Down
2 changes: 1 addition & 1 deletion packages/math/src/Vector4.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IClone } from "@oasis-engine/design";
import { IClone } from "./IClone";
import { MathUtil } from "./MathUtil";
import { Matrix } from "./Matrix";
import { Quaternion } from "./Quaternion";
Expand Down