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

Side by Side Diff: lib/src/collision/broadphase/dynamic_tree.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 | « CHANGELOG.md ('k') | lib/src/collision/shapes/circle_shape.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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 assert(_nodeCount == _nodeCapacity); 449 assert(_nodeCount == _nodeCapacity);
450 450
451 List<DynamicTreeNode> old = _nodes; 451 List<DynamicTreeNode> old = _nodes;
452 _nodeCapacity *= 2; 452 _nodeCapacity *= 2;
453 _nodes = new List<DynamicTreeNode>(_nodeCapacity); 453 _nodes = new List<DynamicTreeNode>(_nodeCapacity);
454 BufferUtils.arraycopy(old, 0, _nodes, 0, old.length); 454 BufferUtils.arraycopy(old, 0, _nodes, 0, old.length);
455 455
456 // Build a linked list for the free list. 456 // Build a linked list for the free list.
457 for (int i = _nodeCapacity - 1; i >= _nodeCount; i--) { 457 for (int i = _nodeCapacity - 1; i >= _nodeCount; i--) {
458 _nodes[i] = new DynamicTreeNode(i); 458 _nodes[i] = new DynamicTreeNode(i);
459 _nodes[i].parent = 459 _nodes[i].parent = (i == _nodeCapacity - 1) ? null : _nodes[i + 1];
460 (i == _nodeCapacity - 1) ? null : _nodes[i + 1];
461 _nodes[i].height = -1; 460 _nodes[i].height = -1;
462 } 461 }
463 _freeList = _nodeCount; 462 _freeList = _nodeCount;
464 } 463 }
465 int nodeId = _freeList; 464 int nodeId = _freeList;
466 final DynamicTreeNode treeNode = _nodes[nodeId]; 465 final DynamicTreeNode treeNode = _nodes[nodeId];
467 _freeList = treeNode.parent != null ? treeNode.parent.id : NULL_NODE; 466 _freeList = treeNode.parent != null ? treeNode.parent.id : NULL_NODE;
468 467
469 treeNode.parent = null; 468 treeNode.parent = null;
470 treeNode.child1 = null; 469 treeNode.child1 = null;
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 _textVec.x, _textVec.y, "$node.id-${(spot + 1)}/$height", _color); 861 _textVec.x, _textVec.y, "$node.id-${(spot + 1)}/$height", _color);
863 862
864 if (node.child1 != null) { 863 if (node.child1 != null) {
865 drawTreeX(argDraw, node.child1, spot + 1, height); 864 drawTreeX(argDraw, node.child1, spot + 1, height);
866 } 865 }
867 if (node.child2 != null) { 866 if (node.child2 != null) {
868 drawTreeX(argDraw, node.child2, spot + 1, height); 867 drawTreeX(argDraw, node.child2, spot + 1, height);
869 } 868 }
870 } 869 }
871 } 870 }
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | lib/src/collision/shapes/circle_shape.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698