コード例 #1
0
ファイル: Boundary.cpp プロジェクト: rafaelab/CRPropa3
void EllipsoidalBoundary::process(Candidate *c) const {
	Vector3d pos = c->current.getPosition();
	double d = pos.getDistanceTo(focalPoint1) + pos.getDistanceTo(focalPoint2);
	if (d >= majorAxis) {
		reject(c);
	}
	if (limitStep)
		c->limitNextStep(majorAxis - d + margin);
}
コード例 #2
0
void MaximumTrajectoryLength::process(Candidate *c) const {
	double length = c->getTrajectoryLength();
	Vector3d position = c->current.getPosition();

	if(observerPositions.size()) {
		bool inRange = false;
		for (size_t i = 0; i < observerPositions.size(); i++) {
			double distance = position.getDistanceTo(observerPositions[i]);
			if (distance + length < maxLength)
				inRange = true;
		}
		if (!inRange) {
			reject(c);
			return;
		}
	}

	if (length >= maxLength) {
		reject(c);
	} else {
		c->limitNextStep(maxLength - length);
	}
}