OLD | NEW |
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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 aabb.upperBound.y = py + radius; | 168 aabb.upperBound.y = py + radius; |
169 } | 169 } |
170 | 170 |
171 void computeMass(final MassData massData, final double density) { | 171 void computeMass(final MassData massData, final double density) { |
172 massData.mass = density * Math.PI * radius * radius; | 172 massData.mass = density * Math.PI * radius * radius; |
173 massData.center.x = p.x; | 173 massData.center.x = p.x; |
174 massData.center.y = p.y; | 174 massData.center.y = p.y; |
175 | 175 |
176 // inertia about the local origin | 176 // inertia about the local origin |
177 // massData.I = massData.mass * (0.5f * _radius * _radius + Vec2.dot(_p, _p)
); | 177 // massData.I = massData.mass * (0.5f * _radius * _radius + Vec2.dot(_p, _p)
); |
178 massData.I = massData.mass * | 178 massData.I = |
179 (0.5 * radius * radius + (p.x * p.x + p.y * p.y)); | 179 massData.mass * (0.5 * radius * radius + (p.x * p.x + p.y * p.y)); |
180 } | 180 } |
181 } | 181 } |
OLD | NEW |