std::vector<Instance*> Layer::getInstancesInCircleSegment(const ModelCoordinate& center, uint16_t radius, int32_t sangle, int32_t eangle) {
		std::vector<Instance*> instances;
		ExactModelCoordinate exactCenter(center.x, center.y);
		std::vector<Instance*> tmpInstances = getInstancesInCircle(center, radius);
		int32_t s = (sangle + 360) % 360;
		int32_t e = (eangle + 360) % 360;
		bool greater = (s > e) ? true : false;
		for (std::vector<Instance*>::iterator it = tmpInstances.begin(); it != tmpInstances.end(); ++it) {
			int32_t angle = getAngleBetween(exactCenter, intPt2doublePt((*it)->getLocationRef().getLayerCoordinates()));
			if (greater) {
				if (angle >= s || angle <= e) {
					instances.push_back(*it);
				}
			} else {
				if (angle >= s && angle <= e) {
					instances.push_back(*it);
				}
			}
		}
		return instances;
	}
Exemplo n.º 2
0
	ExactModelCoordinate CellGrid::toMapCoordinates(const ModelCoordinate& layer_coords) {
		return toMapCoordinates(intPt2doublePt(layer_coords));
	}
Exemplo n.º 3
0
	void Location::setLayerCoordinates(const ModelCoordinate& coordinates) {
		setExactLayerCoordinates(intPt2doublePt(coordinates));
	}