def isLegalShot(self, eye, targets, directions): print("check if it is a legal shot.....") return True minFocalDistance = self.minFocalDistance tempCamera = copy.copy(self.camera) for target in targets: for direction in directions: tempCamera.setup(target, eye) tempCamera.setMvParams(direction) cameraTrajectory = tempCamera.getTrajectory() for pt in cameraTrajectory: if utils.distance(target, pt) < minFocalDistance: print("Utils.distance(focalPoint, pt) < minFocalDistance") return False if not self.sceneControler.isLegalCameraPosition(pt): print("self.sceneControler.isLegalCameraPosition(pt)") return False if self.sceneControler.isOccluded(target, pt): print("self.sceneControler.isOccluded(focalPoint, pt):") return False return True
def isFeasible(self, focalPoint, cameraTrajectory): for i in range(0, len(cameraTrajectory), self.pramas.sampleLevel): position = cameraTrajectory[i] dist = Utils.distance(focalPoint, position) if dist < self.pramas.safeDist: msg = "too close" return (False, msg) if self.scene.isOccluded(focalPoint, position): msg = "occluded" return (False, msg) if not self.isFeasibleCameraPosition(position): msg = "infeasible camera position" return (False, msg) msg = "feasible" return (True, msg)