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

refactor: remove unnecessary and redundant declarations, that don't m… #300

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
21 changes: 7 additions & 14 deletions dist/planck-with-testbed.js
Original file line number Diff line number Diff line change
Expand Up @@ -5549,8 +5549,7 @@
transformVec2(pointA$2, xfA$1, localPointA_1);
transformVec2(pointB$2, xfB$1, localPointB_1);
subVec2(this.m_axis, pointB$2, pointA$2);
var s = normalizeVec2Length(this.m_axis);
return s;
return normalizeVec2Length(this.m_axis);
}
else if (cache.indexA[0] === cache.indexA[1]) {
// Two points on B and one on A.
Expand Down Expand Up @@ -5607,8 +5606,7 @@
copyVec2(localPointB, this.m_proxyB.getVertex(this.indexB));
transformVec2(pointA$2, xfA$1, localPointA);
transformVec2(pointB$2, xfB$1, localPointB);
var sep = dotVec2(pointB$2, this.m_axis) - dotVec2(pointA$2, this.m_axis);
return sep;
return dotVec2(pointB$2, this.m_axis) - dotVec2(pointA$2, this.m_axis);
}
case SeparationFunctionType.e_faceA: {
rotVec2(normal$3, xfA$1.q, this.m_axis);
Expand All @@ -5620,8 +5618,7 @@
}
copyVec2(localPointB, this.m_proxyB.getVertex(this.indexB));
transformVec2(pointB$2, xfB$1, localPointB);
var sep = dotVec2(pointB$2, normal$3) - dotVec2(pointA$2, normal$3);
return sep;
return dotVec2(pointB$2, normal$3) - dotVec2(pointA$2, normal$3);
}
case SeparationFunctionType.e_faceB: {
rotVec2(normal$3, xfB$1.q, this.m_axis);
Expand All @@ -5633,8 +5630,7 @@
}
copyVec2(localPointA, this.m_proxyA.getVertex(this.indexA));
transformVec2(pointA$2, xfA$1, localPointA);
var sep = dotVec2(pointA$2, normal$3) - dotVec2(pointB$2, normal$3);
return sep;
return dotVec2(pointA$2, normal$3) - dotVec2(pointB$2, normal$3);
}
default:
if (find) {
Expand Down Expand Up @@ -14855,11 +14851,10 @@
if (!refMemoById[value.__sid]) {
refQueue.push(value);
var index = json.length + refQueue.length;
var ref = {
refMemoById[value.__sid] = {
refIndex: index,
refType: typeName
};
refMemoById[value.__sid] = ref;
}
return refMemoById[value.__sid];
}
Expand Down Expand Up @@ -14953,13 +14948,11 @@
var refIndex = ref.refIndex;
if (!deserializedRefMemoByIndex[refIndex]) {
var data = json[refIndex];
var obj = deserializeWithHooks(classHint, data, context);
deserializedRefMemoByIndex[refIndex] = obj;
deserializedRefMemoByIndex[refIndex] = deserializeWithHooks(classHint, data, context);
}
return deserializedRefMemoByIndex[refIndex];
}
var root = deserializeWithHooks(rootClass, json[0], null);
return root;
return deserializeWithHooks(rootClass, json[0], null);
};
this.options = __assign$1(__assign$1({}, DEFAULT_OPTIONS), options);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/planck-with-testbed.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/planck-with-testbed.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/planck-with-testbed.min.js.map

Large diffs are not rendered by default.

21 changes: 7 additions & 14 deletions dist/planck-with-testbed.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5543,8 +5543,7 @@ var SeparationFunction = /** @class */ (function () {
transformVec2(pointA$2, xfA$1, localPointA_1);
transformVec2(pointB$2, xfB$1, localPointB_1);
subVec2(this.m_axis, pointB$2, pointA$2);
var s = normalizeVec2Length(this.m_axis);
return s;
return normalizeVec2Length(this.m_axis);
}
else if (cache.indexA[0] === cache.indexA[1]) {
// Two points on B and one on A.
Expand Down Expand Up @@ -5601,8 +5600,7 @@ var SeparationFunction = /** @class */ (function () {
copyVec2(localPointB, this.m_proxyB.getVertex(this.indexB));
transformVec2(pointA$2, xfA$1, localPointA);
transformVec2(pointB$2, xfB$1, localPointB);
var sep = dotVec2(pointB$2, this.m_axis) - dotVec2(pointA$2, this.m_axis);
return sep;
return dotVec2(pointB$2, this.m_axis) - dotVec2(pointA$2, this.m_axis);
}
case SeparationFunctionType.e_faceA: {
rotVec2(normal$3, xfA$1.q, this.m_axis);
Expand All @@ -5614,8 +5612,7 @@ var SeparationFunction = /** @class */ (function () {
}
copyVec2(localPointB, this.m_proxyB.getVertex(this.indexB));
transformVec2(pointB$2, xfB$1, localPointB);
var sep = dotVec2(pointB$2, normal$3) - dotVec2(pointA$2, normal$3);
return sep;
return dotVec2(pointB$2, normal$3) - dotVec2(pointA$2, normal$3);
}
case SeparationFunctionType.e_faceB: {
rotVec2(normal$3, xfB$1.q, this.m_axis);
Expand All @@ -5627,8 +5624,7 @@ var SeparationFunction = /** @class */ (function () {
}
copyVec2(localPointA, this.m_proxyA.getVertex(this.indexA));
transformVec2(pointA$2, xfA$1, localPointA);
var sep = dotVec2(pointA$2, normal$3) - dotVec2(pointB$2, normal$3);
return sep;
return dotVec2(pointA$2, normal$3) - dotVec2(pointB$2, normal$3);
}
default:
if (find) {
Expand Down Expand Up @@ -14849,11 +14845,10 @@ var Serializer = /** @class */ (function () {
if (!refMemoById[value.__sid]) {
refQueue.push(value);
var index = json.length + refQueue.length;
var ref = {
refMemoById[value.__sid] = {
refIndex: index,
refType: typeName
};
refMemoById[value.__sid] = ref;
}
return refMemoById[value.__sid];
}
Expand Down Expand Up @@ -14947,13 +14942,11 @@ var Serializer = /** @class */ (function () {
var refIndex = ref.refIndex;
if (!deserializedRefMemoByIndex[refIndex]) {
var data = json[refIndex];
var obj = deserializeWithHooks(classHint, data, context);
deserializedRefMemoByIndex[refIndex] = obj;
deserializedRefMemoByIndex[refIndex] = deserializeWithHooks(classHint, data, context);
}
return deserializedRefMemoByIndex[refIndex];
}
var root = deserializeWithHooks(rootClass, json[0], null);
return root;
return deserializeWithHooks(rootClass, json[0], null);
};
this.options = __assign$1(__assign$1({}, DEFAULT_OPTIONS), options);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/planck-with-testbed.mjs.map

Large diffs are not rendered by default.

21 changes: 7 additions & 14 deletions dist/planck.js
Original file line number Diff line number Diff line change
Expand Up @@ -5549,8 +5549,7 @@
transformVec2(pointA$2, xfA$1, localPointA_1);
transformVec2(pointB$2, xfB$1, localPointB_1);
subVec2(this.m_axis, pointB$2, pointA$2);
var s = normalizeVec2Length(this.m_axis);
return s;
return normalizeVec2Length(this.m_axis);
}
else if (cache.indexA[0] === cache.indexA[1]) {
// Two points on B and one on A.
Expand Down Expand Up @@ -5607,8 +5606,7 @@
copyVec2(localPointB, this.m_proxyB.getVertex(this.indexB));
transformVec2(pointA$2, xfA$1, localPointA);
transformVec2(pointB$2, xfB$1, localPointB);
var sep = dotVec2(pointB$2, this.m_axis) - dotVec2(pointA$2, this.m_axis);
return sep;
return dotVec2(pointB$2, this.m_axis) - dotVec2(pointA$2, this.m_axis);
}
case SeparationFunctionType.e_faceA: {
rotVec2(normal$3, xfA$1.q, this.m_axis);
Expand All @@ -5620,8 +5618,7 @@
}
copyVec2(localPointB, this.m_proxyB.getVertex(this.indexB));
transformVec2(pointB$2, xfB$1, localPointB);
var sep = dotVec2(pointB$2, normal$3) - dotVec2(pointA$2, normal$3);
return sep;
return dotVec2(pointB$2, normal$3) - dotVec2(pointA$2, normal$3);
}
case SeparationFunctionType.e_faceB: {
rotVec2(normal$3, xfB$1.q, this.m_axis);
Expand All @@ -5633,8 +5630,7 @@
}
copyVec2(localPointA, this.m_proxyA.getVertex(this.indexA));
transformVec2(pointA$2, xfA$1, localPointA);
var sep = dotVec2(pointA$2, normal$3) - dotVec2(pointB$2, normal$3);
return sep;
return dotVec2(pointA$2, normal$3) - dotVec2(pointB$2, normal$3);
}
default:
if (find) {
Expand Down Expand Up @@ -14855,11 +14851,10 @@
if (!refMemoById[value.__sid]) {
refQueue.push(value);
var index = json.length + refQueue.length;
var ref = {
refMemoById[value.__sid] = {
refIndex: index,
refType: typeName
};
refMemoById[value.__sid] = ref;
}
return refMemoById[value.__sid];
}
Expand Down Expand Up @@ -14953,13 +14948,11 @@
var refIndex = ref.refIndex;
if (!deserializedRefMemoByIndex[refIndex]) {
var data = json[refIndex];
var obj = deserializeWithHooks(classHint, data, context);
deserializedRefMemoByIndex[refIndex] = obj;
deserializedRefMemoByIndex[refIndex] = deserializeWithHooks(classHint, data, context);
}
return deserializedRefMemoByIndex[refIndex];
}
var root = deserializeWithHooks(rootClass, json[0], null);
return root;
return deserializeWithHooks(rootClass, json[0], null);
};
this.options = __assign(__assign({}, DEFAULT_OPTIONS), options);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/planck.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/planck.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/planck.min.js.map

Large diffs are not rendered by default.

21 changes: 7 additions & 14 deletions dist/planck.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5543,8 +5543,7 @@ var SeparationFunction = /** @class */ (function () {
transformVec2(pointA$2, xfA$1, localPointA_1);
transformVec2(pointB$2, xfB$1, localPointB_1);
subVec2(this.m_axis, pointB$2, pointA$2);
var s = normalizeVec2Length(this.m_axis);
return s;
return normalizeVec2Length(this.m_axis);
}
else if (cache.indexA[0] === cache.indexA[1]) {
// Two points on B and one on A.
Expand Down Expand Up @@ -5601,8 +5600,7 @@ var SeparationFunction = /** @class */ (function () {
copyVec2(localPointB, this.m_proxyB.getVertex(this.indexB));
transformVec2(pointA$2, xfA$1, localPointA);
transformVec2(pointB$2, xfB$1, localPointB);
var sep = dotVec2(pointB$2, this.m_axis) - dotVec2(pointA$2, this.m_axis);
return sep;
return dotVec2(pointB$2, this.m_axis) - dotVec2(pointA$2, this.m_axis);
}
case SeparationFunctionType.e_faceA: {
rotVec2(normal$3, xfA$1.q, this.m_axis);
Expand All @@ -5614,8 +5612,7 @@ var SeparationFunction = /** @class */ (function () {
}
copyVec2(localPointB, this.m_proxyB.getVertex(this.indexB));
transformVec2(pointB$2, xfB$1, localPointB);
var sep = dotVec2(pointB$2, normal$3) - dotVec2(pointA$2, normal$3);
return sep;
return dotVec2(pointB$2, normal$3) - dotVec2(pointA$2, normal$3);
}
case SeparationFunctionType.e_faceB: {
rotVec2(normal$3, xfB$1.q, this.m_axis);
Expand All @@ -5627,8 +5624,7 @@ var SeparationFunction = /** @class */ (function () {
}
copyVec2(localPointA, this.m_proxyA.getVertex(this.indexA));
transformVec2(pointA$2, xfA$1, localPointA);
var sep = dotVec2(pointA$2, normal$3) - dotVec2(pointB$2, normal$3);
return sep;
return dotVec2(pointA$2, normal$3) - dotVec2(pointB$2, normal$3);
}
default:
if (find) {
Expand Down Expand Up @@ -14849,11 +14845,10 @@ var Serializer = /** @class */ (function () {
if (!refMemoById[value.__sid]) {
refQueue.push(value);
var index = json.length + refQueue.length;
var ref = {
refMemoById[value.__sid] = {
refIndex: index,
refType: typeName
};
refMemoById[value.__sid] = ref;
}
return refMemoById[value.__sid];
}
Expand Down Expand Up @@ -14947,13 +14942,11 @@ var Serializer = /** @class */ (function () {
var refIndex = ref.refIndex;
if (!deserializedRefMemoByIndex[refIndex]) {
var data = json[refIndex];
var obj = deserializeWithHooks(classHint, data, context);
deserializedRefMemoByIndex[refIndex] = obj;
deserializedRefMemoByIndex[refIndex] = deserializeWithHooks(classHint, data, context);
}
return deserializedRefMemoByIndex[refIndex];
}
var root = deserializeWithHooks(rootClass, json[0], null);
return root;
return deserializeWithHooks(rootClass, json[0], null);
};
this.options = __assign(__assign({}, DEFAULT_OPTIONS), options);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/planck.mjs.map

Large diffs are not rendered by default.

12 changes: 4 additions & 8 deletions src/collision/TimeOfImpact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,7 @@ class SeparationFunction {
matrix.transformVec2(pointA, xfA, localPointA);
matrix.transformVec2(pointB, xfB, localPointB);
matrix.subVec2(this.m_axis, pointB, pointA);
const s = matrix.normalizeVec2Length(this.m_axis);
return s;
return matrix.normalizeVec2Length(this.m_axis);

} else if (cache.indexA[0] === cache.indexA[1]) {
// Two points on B and one on A.
Expand Down Expand Up @@ -450,8 +449,7 @@ class SeparationFunction {
matrix.transformVec2(pointA, xfA, localPointA);
matrix.transformVec2(pointB, xfB, localPointB);

const sep = matrix.dotVec2(pointB, this.m_axis) - matrix.dotVec2(pointA, this.m_axis);
return sep;
return matrix.dotVec2(pointB, this.m_axis) - matrix.dotVec2(pointA, this.m_axis);
}

case SeparationFunctionType.e_faceA: {
Expand All @@ -468,8 +466,7 @@ class SeparationFunction {
matrix.copyVec2(localPointB, this.m_proxyB.getVertex(this.indexB));
matrix.transformVec2(pointB, xfB, localPointB);

const sep = matrix.dotVec2(pointB, normal) - matrix.dotVec2(pointA, normal);
return sep;
return matrix.dotVec2(pointB, normal) - matrix.dotVec2(pointA, normal);
}

case SeparationFunctionType.e_faceB: {
Expand All @@ -486,8 +483,7 @@ class SeparationFunction {
matrix.copyVec2(localPointA, this.m_proxyA.getVertex(this.indexA));
matrix.transformVec2(pointA, xfA, localPointA);

const sep = matrix.dotVec2(pointA, normal) - matrix.dotVec2(pointB, normal);
return sep;
return matrix.dotVec2(pointA, normal) - matrix.dotVec2(pointB, normal);
}

default:
Expand Down
10 changes: 3 additions & 7 deletions src/serializer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,10 @@ export class Serializer<T> {
if (!refMemoById[value.__sid]) {
refQueue.push(value);
const index = json.length + refQueue.length;
const ref = {
refMemoById[value.__sid] = {
refIndex: index,
refType: typeName
};
refMemoById[value.__sid] = ref;
}
return refMemoById[value.__sid];
}
Expand Down Expand Up @@ -227,15 +226,12 @@ export class Serializer<T> {
const refIndex = ref.refIndex;
if (!deserializedRefMemoByIndex[refIndex]) {
const data = json[refIndex];
const obj = deserializeWithHooks(classHint, data, context);
deserializedRefMemoByIndex[refIndex] = obj;
deserializedRefMemoByIndex[refIndex] = deserializeWithHooks(classHint, data, context);
}
return deserializedRefMemoByIndex[refIndex];
}

const root = deserializeWithHooks(rootClass, json[0], null);

return root;
return deserializeWithHooks(rootClass, json[0], null);
};

static toJson: (root: World) => SerializedType;
Expand Down