Category : 2d

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 drawing a 2D tilemap using OpenGL and I will like to be able to know where the position of the mouse corresponds into my scene. This is what I currently have: To draw this screen this projection is used glm::mat4 projection = glm::perspective( glm::radians(45.0f), (float)screenWidth / (float)screenHeight, 1.0f, 100.0f ); Then this camera is ..

Read more

I’m drawing a 2D tilemap using OpenGL and I will like to be able to know where the position of the mouse corresponds into my scene. This is what I currently have: To draw this screen this projection is used glm::mat4 projection = glm::perspective( glm::radians(45.0f), (float)screenWidth / (float)screenHeight, 1.0f, 100.0f ); Then this camera is ..

Read more

I’m trying to build a simple 2D application on the Windows Console using C++ to display various primitives so I started with the most basic one: a triangle. I can display the triangle’s outline and vertices correctly but I’m having problems with filling it. I have come across some rasterization algorithms presented here: http://www.sunshine2k.de/coding/java/TriangleRasterization/TriangleRasterization.html and ..

Read more

I am currently trying to parallelise the ‘scatter’ and ‘connect’ part of 2D Transmission Line Matrix(TLM) in CUDA Programming. I require only to use x-dimension threads. I am stuck and have no idea how to program the ‘connect’ part. For example, I use 8196threads to solve 100 x 100nodes problems. My threads will be limited ..

Read more