Пример #1
0
/*
 * This function is executed in a parallel region based on layer_nr.
 * When modifying make sure any changes does not introduce data races.
 *
 * this function may only read/write the skin and infill from the *current* layer.
 */
void SkinInfillAreaComputation::calculateBottomSkin(const SliceLayerPart& part, int min_infill_area, Polygons& downskin)
{
    if (static_cast<int>(layer_nr - bottom_layer_count) >= 0 && bottom_layer_count > 0)
    {
        Polygons not_air = getWalls(part, layer_nr - bottom_layer_count, bottom_reference_wall_idx).offset(bottom_reference_wall_expansion);
        if (!no_small_gaps_heuristic)
        {
            for (int downskin_layer_nr = layer_nr - bottom_layer_count + 1; downskin_layer_nr < layer_nr; downskin_layer_nr++)
            {
                not_air = not_air.intersection(getWalls(part, downskin_layer_nr, bottom_reference_wall_idx).offset(bottom_reference_wall_expansion));
            }
        }
        if (min_infill_area > 0)
        {
            not_air.removeSmallAreas(min_infill_area);
        }
        downskin = downskin.difference(not_air); // skin overlaps with the walls
    }
}
Пример #2
0
/*
 * This function is executed in a parallel region based on layer_nr.
 * When modifying make sure any changes does not introduce data races.
 *
 * this function may only read/write the skin and infill from the *current* layer.
 */
void SkinInfillAreaComputation::generateRoofing(SliceLayerPart& part)
{
    int roofing_layer_count = mesh.getSettingAsCount("roofing_layer_count");
    const unsigned int wall_idx = std::min(2, mesh.getSettingAsCount("wall_line_count"));

    for (SkinPart& skin_part : part.skin_parts)
    {
        Polygons roofing;
        if (roofing_layer_count > 0)
        {
            Polygons no_air_above = getWalls(part, layer_nr + roofing_layer_count, wall_idx);
            if (!no_small_gaps_heuristic)
            {
                for (int layer_nr_above = layer_nr + 1; layer_nr_above < layer_nr + roofing_layer_count; layer_nr_above++)
                {
                    Polygons outlines_above = getWalls(part, layer_nr_above, wall_idx);
                    no_air_above = no_air_above.intersection(outlines_above);
                }
            }
            if (layer_nr > 0)
            {
                // if the skin has air below it then cutting it into regions could cause a region
                // to be wholely or partly above air and it may not be printable so restrict
                // the regions that have air above (the visible regions) to not include any area that
                // has air below (fixes https://github.com/Ultimaker/Cura/issues/2656)

                // set air_below to the skin area for the current layer that has air below it
                Polygons air_below = getWalls(part, layer_nr, wall_idx).difference(getWalls(part, layer_nr - 1, wall_idx));

                if (!air_below.empty())
                {
                    // add the polygons that have air below to the no air above polygons
                    no_air_above = no_air_above.unionPolygons(air_below);
                }
            }
            skin_part.roofing_fill = skin_part.inner_infill.difference(no_air_above);
            skin_part.inner_infill = skin_part.inner_infill.intersection(no_air_above);
        }
    }
}
Пример #3
0
PointList Board::getFutureBlasts() const {
	PointList bombs = getBombs();
	bombs.splice(bombs.end(), findAll(Element(LL("OTHER_BOMB_BOMBERMAN"))));
	bombs.splice(bombs.end(), findAll(Element(LL("BOMB_BOMBERMAN"))));

	PointList rslt;
	PointList walls = getWalls();
	for (auto bmb : bombs) {
		rslt.push_back(bmb);
		PointList bombSurrs = bmb.getSurrounds(size);
		for (auto surr : bombSurrs) {
			if (std::find(walls.begin(), walls.end(), surr) == walls.end()) {
				rslt.push_back(surr);
			}
		}
	}

	return removeDuplicates(rslt);
}
Пример #4
0
bool BaseAI::startTurn()
{
  int count = 0;
  count = getWallCount();
  walls.clear();
  walls.resize(count);
  for(int i = 0; i < count; i++)
  {
    walls[i] = Wall(getWalls()+i);
  }
  count = getCrateCount();
  crates.clear();
  crates.resize(count);
  for(int i = 0; i < count; i++)
  {
    crates[i] = Crate(getCrates()+i);
  }
  count = getWeaponCount();
  weapons.clear();
  weapons.resize(count);
  for(int i = 0; i < count; i++)
  {
    weapons[i] = Weapon(getWeapons()+i);
  }
  count = getHumanCount();
  humans.clear();
  humans.resize(count);
  for(int i = 0; i < count; i++)
  {
    humans[i] = Human(getHumans()+i);
  }
  count = getZombieCount();
  zombies.clear();
  zombies.resize(count);
  for(int i = 0; i < count; i++)
  {
    zombies[i] = Zombie(getZombies()+i);
  }
  count = getAirstrikeCount();
  airstrikes.clear();
  airstrikes.resize(count);
  for(int i = 0; i < count; i++)
  {
    airstrikes[i] = Airstrike(getAirstrikes()+i);
  }
  count = getSpawnzoneCount();
  spawnzones.clear();
  spawnzones.resize(count);
  for(int i = 0; i < count; i++)
  {
    spawnzones[i] = Spawnzone(getSpawnzones()+i);
  }

  if(turnNum() == 1)
  {
    init();
    if(!isHuman())
    {
      return true;
     }
  }

  if(isHuman())
  {
    return runHuman();
  }
  else
  {
    return runZombie();
  }
}