Skip to content

Commit 739e0d1

Browse files
committed
Fix formatting
1 parent 908d619 commit 739e0d1

40 files changed

Lines changed: 269 additions & 208 deletions

packages/forge2d/example/web/domino_test.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ class DominoTest extends Demo {
4242

4343
for (var i = 0; i < 4; ++i) {
4444
for (var j = 0; j < numPerRow; j++) {
45-
bodyDef.position =
46-
Vector2(-14.75 + j * (29.5 / (numPerRow - 1)), 7.3 + 5 * i);
45+
bodyDef.position = Vector2(
46+
-14.75 + j * (29.5 / (numPerRow - 1)),
47+
7.3 + 5 * i,
48+
);
4749
if (i == 2 && j == 0) {
4850
bodyDef.angle = -.1;
4951
bodyDef.position.x += .1;

packages/forge2d/example/web/domino_tower.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ class DominoTower extends Demo {
9797
dominoHeight * .5 + (dominoHeight + 2 * dominoWidth) * .99 * j;
9898

9999
for (var i = 0; i < baseCount - j; ++i) {
100-
currX = i * 1.5 * dominoHeight -
100+
currX =
101+
i * 1.5 * dominoHeight -
101102
(1.5 * dominoHeight * (baseCount - j) / 2);
102103
dominoDensity *= 2.5;
103104
if (i == 0) {

packages/forge2d/lib/src/collision/aabb.dart

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,19 @@ class AABB {
1212
final Vector2 upperBound;
1313

1414
/// Creates the default object, with vertices at 0,0 and 0,0.
15-
AABB()
16-
: lowerBound = Vector2.zero(),
17-
upperBound = Vector2.zero();
15+
AABB() : lowerBound = Vector2.zero(), upperBound = Vector2.zero();
1816

1917
/// Copies from the given object.
2018
AABB.copy(AABB copy)
21-
: lowerBound = Vector2.copy(copy.lowerBound),
22-
upperBound = Vector2.copy(copy.upperBound);
19+
: lowerBound = Vector2.copy(copy.lowerBound),
20+
upperBound = Vector2.copy(copy.upperBound);
2321

2422
/// Creates an AABB object using the given bounding vertices.
2523
/// [lowerVertex] should be the bottom left vertex of the bounding box.
2624
/// [upperVertex] should be the top right vertex of the bounding box.
2725
AABB.withVec2(Vector2 lowerVertex, Vector2 upperVertex)
28-
: lowerBound = Vector2.copy(lowerVertex),
29-
upperBound = Vector2.copy(upperVertex);
26+
: lowerBound = Vector2.copy(lowerVertex),
27+
upperBound = Vector2.copy(upperVertex);
3028

3129
/// Sets this object from the given object.
3230
void set(AABB aabb) {
@@ -101,14 +99,18 @@ class AABB {
10199

102100
/// Combines another aabb with this one
103101
void combine(AABB aabb) {
104-
lowerBound.x =
105-
lowerBound.x < aabb.lowerBound.x ? lowerBound.x : aabb.lowerBound.x;
106-
lowerBound.y =
107-
lowerBound.y < aabb.lowerBound.y ? lowerBound.y : aabb.lowerBound.y;
108-
upperBound.x =
109-
upperBound.x > aabb.upperBound.x ? upperBound.x : aabb.upperBound.x;
110-
upperBound.y =
111-
upperBound.y > aabb.upperBound.y ? upperBound.y : aabb.upperBound.y;
102+
lowerBound.x = lowerBound.x < aabb.lowerBound.x
103+
? lowerBound.x
104+
: aabb.lowerBound.x;
105+
lowerBound.y = lowerBound.y < aabb.lowerBound.y
106+
? lowerBound.y
107+
: aabb.lowerBound.y;
108+
upperBound.x = upperBound.x > aabb.upperBound.x
109+
? upperBound.x
110+
: aabb.upperBound.x;
111+
upperBound.y = upperBound.y > aabb.upperBound.y
112+
? upperBound.y
113+
: aabb.upperBound.y;
112114
}
113115

114116
/// Does this aabb contain the provided AABB.

packages/forge2d/lib/src/collision/broadphase/dynamic_tree.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ class DynamicTree implements BroadPhaseStrategy {
151151
} else {
152152
if (_nodeStack.length - nodeStackIndex - 2 <= 0) {
153153
final previousSize = _nodeStack.length;
154-
_nodeStack = _nodeStack +
154+
_nodeStack =
155+
_nodeStack +
155156
List.generate(
156157
previousSize,
157158
(i) => DynamicTreeNode(previousSize + i),
@@ -269,7 +270,8 @@ class DynamicTree implements BroadPhaseStrategy {
269270
} else {
270271
if (_nodeStack.length - nodeStackIndex - 2 <= 0) {
271272
final previousSize = _nodeStack.length;
272-
_nodeStack = _nodeStack +
273+
_nodeStack =
274+
_nodeStack +
273275
List.generate(
274276
previousSize,
275277
(i) => DynamicTreeNode(previousSize + i),
@@ -429,7 +431,8 @@ class DynamicTree implements BroadPhaseStrategy {
429431
if (_freeList == nullNode) {
430432
assert(_nodeCount == _nodeCapacity);
431433

432-
_nodes = _nodes +
434+
_nodes =
435+
_nodes +
433436
List<DynamicTreeNode>.generate(
434437
_nodeCapacity,
435438
(i) => DynamicTreeNode(_nodeCapacity + i),

packages/forge2d/lib/src/collision/collision.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,8 @@ class Collision {
648648

649649
var pointCount = 0;
650650
for (var i = 0; i < settings.maxManifoldPoints; ++i) {
651-
final separation = normalx * _clipPoints2[i].v.x +
651+
final separation =
652+
normalx * _clipPoints2[i].v.x +
652653
normaly * _clipPoints2[i].v.y -
653654
frontOffset;
654655

@@ -1123,8 +1124,9 @@ class EdgePolygonCollider {
11231124
// Get polygonB in frameA
11241125
polygonB.count = polygonB2.vertices.length;
11251126
for (var i = 0; i < polygonB2.vertices.length; ++i) {
1126-
polygonB.vertices[i]
1127-
.setFrom(Transform.mulVec2(xf, polygonB2.vertices[i]));
1127+
polygonB.vertices[i].setFrom(
1128+
Transform.mulVec2(xf, polygonB2.vertices[i]),
1129+
);
11281130
polygonB.normals[i].setFrom(Rot.mulVec2(xf.q, polygonB2.normals[i]));
11291131
}
11301132

packages/forge2d/lib/src/collision/manifold_point.dart

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,14 @@ class ManifoldPoint {
2525
final ContactID id;
2626

2727
/// Blank manifold point with everything zeroed out.
28-
ManifoldPoint()
29-
: localPoint = Vector2.zero(),
30-
id = ContactID();
28+
ManifoldPoint() : localPoint = Vector2.zero(), id = ContactID();
3129

3230
/// Creates a manifold point as a copy of the given point.
3331
ManifoldPoint.copy(ManifoldPoint manifoldPoint)
34-
: localPoint = manifoldPoint.localPoint.clone(),
35-
normalImpulse = manifoldPoint.normalImpulse,
36-
tangentImpulse = manifoldPoint.tangentImpulse,
37-
id = ContactID.copy(manifoldPoint.id);
32+
: localPoint = manifoldPoint.localPoint.clone(),
33+
normalImpulse = manifoldPoint.normalImpulse,
34+
tangentImpulse = manifoldPoint.tangentImpulse,
35+
id = ContactID.copy(manifoldPoint.id);
3836

3937
/// Sets this manifold point form the given one.
4038
void set(ManifoldPoint manifoldPoint) {

packages/forge2d/lib/src/collision/shapes/circle_shape.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ class CircleShape extends Shape {
136136
massData.center.y = position.y;
137137

138138
// inertia about the local origin
139-
massData.I = massData.mass *
139+
massData.I =
140+
massData.mass *
140141
(0.5 * radius * radius +
141142
(position.x * position.x + position.y * position.y));
142143
}

packages/forge2d/lib/src/collision/shapes/mass_data.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ class MassData {
1818

1919
/// Copies from the given mass data.
2020
MassData.copy(MassData md)
21-
: mass = md.mass,
22-
center = md.center.clone(),
23-
I = md.I;
21+
: mass = md.mass,
22+
center = md.center.clone(),
23+
I = md.I;
2424

2525
void set(MassData md) {
2626
mass = md.mass;

packages/forge2d/lib/src/collision/time_of_impact.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@ class TimeOfImpact {
7777

7878
final totalRadius = proxyA.radius + proxyB.radius;
7979
// djm: whats with all these constants?
80-
final target =
81-
max(settings.linearSlop, totalRadius - 3.0 * settings.linearSlop);
80+
final target = max(
81+
settings.linearSlop,
82+
totalRadius - 3.0 * settings.linearSlop,
83+
);
8284
final tolerance = 0.25 * settings.linearSlop;
8385

8486
assert(target > tolerance);

packages/forge2d/lib/src/common/rot.dart

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ class Rot {
88

99
Rot({this.sin = 0.0, this.cos = 1.0});
1010

11-
Rot.withAngle(double angle)
12-
: sin = math.sin(angle),
13-
cos = math.cos(angle);
11+
Rot.withAngle(double angle) : sin = math.sin(angle), cos = math.cos(angle);
1412

1513
void setAngle(double angle) {
1614
sin = math.sin(angle);
@@ -49,16 +47,16 @@ class Rot {
4947
Rot clone() => Rot(sin: sin, cos: cos);
5048

5149
Rot.mul(Rot q, Rot r)
52-
: this(
53-
sin: q.sin * r.cos + q.cos * r.sin,
54-
cos: q.cos * r.cos - q.sin * r.sin,
55-
);
50+
: this(
51+
sin: q.sin * r.cos + q.cos * r.sin,
52+
cos: q.cos * r.cos - q.sin * r.sin,
53+
);
5654

5755
Rot.mulTrans(Rot q, Rot r)
58-
: this(
59-
sin: q.cos * r.sin - q.sin * r.cos,
60-
cos: q.cos * r.cos + q.sin * r.sin,
61-
);
56+
: this(
57+
sin: q.cos * r.sin - q.sin * r.cos,
58+
cos: q.cos * r.cos + q.sin * r.sin,
59+
);
6260

6361
static Vector2 mulVec2(Rot q, Vector2 v) {
6462
return Vector2(q.cos * v.x - q.sin * v.y, q.sin * v.x + q.cos * v.y);

0 commit comments

Comments
 (0)