VisibleSim icon indicating copy to clipboard operation
VisibleSim copied to clipboard

Fix illegal module insertion bug

Open kazogihara opened this issue 3 years ago • 0 comments

Description

I added arguments and conditional branches for nonconnector spots. So buffer overruns no longer occur when right-clicking on non-connector spots

Fixes # (issue) https://github.com/ProgrammableMatterProject/VisibleSim/issues/13

Type of change

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] This change requires a documentation update

How Has This Been Tested?

I rerun the same steps and configuration as when the bug occurred.

  • Video https://www.youtube.com/watch?v=yDDtSmibJMk&ab_channel=TEMMIEHOIHOI

  • log

Thread 1 "myMotionTest" hit Breakpoint 1, Catoms3D::Catoms3DBlock::getNeighborPos (this=0x77ec7940, connectorID=184 '\270', pos=...)
    at robots/catoms3D/catoms3DBlock.cpp:160
160         bool Catoms3DBlock::getNeighborPos(uint8_t connectorID, Cell3DPosition &pos) const {
(gdb) n
161             Vector3D realPos;
(gdb) n
163             Catoms3DWorld *wrl = getWorld();
(gdb) n
164             const Vector3D bs = wrl->lattice->gridScale;
(gdb) n
166             realPos.set(tabConnectorPositions[connectorID], 3, 1);
(gdb) p bs
$1 = {_pt = {10, 10, 10, 0}}
(gdb) n
167             realPos *= bs;
(gdb) p realPos
$2 = {_pt = {0, 0, 0, 1}}
(gdb) n
168             realPos.set(3,1.0); // A vérifier
(gdb) n
169             realPos = ((Catoms3DGlBlock *) ptrGlBlock)->mat * realPos;
(gdb) p realPos
$3 = {_pt = {0, 0, 0, 1}}
(gdb) n
170             if (realPos[2] < 0) return false;
(gdb) p realPos
$4 = {_pt = {20, 20, 10.6066017, 1}}

Test Configuration:

  • VisibleSim version: https://github.com/ProgrammableMatterProject/VisibleSim/commit/727ea58aecd45a3bf9a4a321bc41c61de5d5aa69

Checklist:

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my own code
  • [x] I have commented my code, particularly in hard-to-understand areas
  • [x] I have made corresponding changes to the documentation
  • [x] My changes generate no new warnings
  • [x] I have added tests that prove my fix is effective or that my feature works
  • [x] New and existing unit tests pass locally with my changes
  • [x] Any dependent changes have been merged and published in downstream modules

kazogihara avatar Oct 27 '22 07:10 kazogihara