Category : simulation

int Electra2D::Collision() { for (std::list<Entity>::iterator affecting = entities.begin(); affecting != entities.end(); ++affecting) { for (std::list<Entity>::iterator affected = entities.begin(); affected != entities.end(); ++affected) { if (affecting->type == DrawTypes::Circle && affected->type == DrawTypes::Circle && affecting->object->id != affected->object->id) { float distance = affected->pos.getDistance(affecting->pos); float limit = ((ObjectCircle*)affected->object)->radius + ((ObjectCircle*)affecting->object)->radius; if (distance <= limit) { Vector2 SP = affected->velocity ..

Read more

I’m currently doing a basic simulation problem in USACO. I’m pretty sure I’ve done the algorithm for this problem correctly, however, when I try to assign values to array, I get the error: run: line 1: 3 Segmentation fault (core dumped) LD_LIBRARY_PATH=/usr/local/gcc-9.2.0/lib64 ./a.out. This is my code: #include <iostream> #include<string> #include <cstdio> #include <cstdlib> #include ..

Read more

I am trying to read a GDML file with G4GDMLParser: … G4GDMLParser parser; parser.Read(G4Str_Filename, fValidate); But it gives an error: … G4GDML: Reading materials… G4GDML: Reading solids… Evaluator : syntax error ——– EEEE ——- G4Exception-START ——– EEEE ——- *** G4Exception : InvalidExpression issued by : G4GDMLEvaluator::Evaluate() Error in expression: 40.0 *** Fatal Exception *** core ..

Read more