Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Side by Side Diff: lib/src/dynamics/contacts/contact_solver.dart

Issue 1138063003: pkg/box2d: 0.2.0 release (Closed) Base URL: https://github.com/google/dbox2d.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/src/dynamics/contacts/contact.dart ('k') | lib/src/dynamics/joints/distance_joint.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /******************************************************************************* 1 /*******************************************************************************
2 * Copyright (c) 2015, Daniel Murphy, Google 2 * Copyright (c) 2015, Daniel Murphy, Google
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without modificati on, 5 * Redistribution and use in source and binary forms, with or without modificati on,
6 * are permitted provided that the following conditions are met: 6 * are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright notice, 7 * * Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer. 8 * this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright notice, 9 * * Redistributions in binary form must reproduce the above copyright notice,
10 * this list of conditions and the following disclaimer in the documentation 10 * this list of conditions and the following disclaimer in the documentation
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 } 66 }
67 67
68 void init(ContactSolverDef def) { 68 void init(ContactSolverDef def) {
69 // System.out.println("Initializing contact solver"); 69 // System.out.println("Initializing contact solver");
70 _step = def.step; 70 _step = def.step;
71 _count = def.count; 71 _count = def.count;
72 72
73 if (_positionConstraints.length < _count) { 73 if (_positionConstraints.length < _count) {
74 List<ContactPositionConstraint> old = _positionConstraints; 74 List<ContactPositionConstraint> old = _positionConstraints;
75 _positionConstraints = new List<ContactPositionConstraint>( 75 _positionConstraints =
76 Math.max(old.length * 2, _count)); 76 new List<ContactPositionConstraint>(Math.max(old.length * 2, _count));
77 BufferUtils.arraycopy(old, 0, _positionConstraints, 0, old.length); 77 BufferUtils.arraycopy(old, 0, _positionConstraints, 0, old.length);
78 for (int i = old.length; i < _positionConstraints.length; i++) { 78 for (int i = old.length; i < _positionConstraints.length; i++) {
79 _positionConstraints[i] = new ContactPositionConstraint(); 79 _positionConstraints[i] = new ContactPositionConstraint();
80 } 80 }
81 } 81 }
82 82
83 if (_velocityConstraints.length < _count) { 83 if (_velocityConstraints.length < _count) {
84 List<ContactVelocityConstraint> old = _velocityConstraints; 84 List<ContactVelocityConstraint> old = _velocityConstraints;
85 _velocityConstraints = new List<ContactVelocityConstraint>( 85 _velocityConstraints =
86 Math.max(old.length * 2, _count)); 86 new List<ContactVelocityConstraint>(Math.max(old.length * 2, _count));
87 BufferUtils.arraycopy(old, 0, _velocityConstraints, 0, old.length); 87 BufferUtils.arraycopy(old, 0, _velocityConstraints, 0, old.length);
88 for (int i = old.length; i < _velocityConstraints.length; i++) { 88 for (int i = old.length; i < _velocityConstraints.length; i++) {
89 _velocityConstraints[i] = new ContactVelocityConstraint(); 89 _velocityConstraints[i] = new ContactVelocityConstraint();
90 } 90 }
91 } 91 }
92 92
93 _positions = def.positions; 93 _positions = def.positions;
94 _velocities = def.velocities; 94 _velocities = def.velocities;
95 _contacts = def.contacts; 95 _contacts = def.contacts;
96 96
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 separation = 1132 separation =
1133 tempx * normal.x + tempy * normal.y - pc.radiusA - pc.radiusB; 1133 tempx * normal.x + tempy * normal.y - pc.radiusA - pc.radiusB;
1134 point.x = clipPointx; 1134 point.x = clipPointx;
1135 point.y = clipPointy; 1135 point.y = clipPointy;
1136 normal.x *= -1; 1136 normal.x *= -1;
1137 normal.y *= -1; 1137 normal.y *= -1;
1138 break; 1138 break;
1139 } 1139 }
1140 } 1140 }
1141 } 1141 }
OLDNEW
« no previous file with comments | « lib/src/dynamics/contacts/contact.dart ('k') | lib/src/dynamics/joints/distance_joint.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698