MCPcopy Create free account
hub / github.com/Kitware/VTK / __iter__

Method __iter__

Web/Python/vtkmodules/web/camera.py:394–566  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

392 self.dataHandler.updatePriority(keyList[idx], priorityList[idx])
393
394 def __iter__(self):
395 for pos in self.positions:
396 cameraData = {}
397
398 for key in pos["args"]:
399 idx = self.args[key].index(pos["args"][key])
400 self.dataHandler.setArguments(**{key: idx})
401
402 # front
403 cameraData["orientation"] = "front"
404 self.dataHandler.setArguments(orientation=0)
405 deltaVect = [
406 (v * float(self.eyeSpacing) * 0.5) for v in self.rightDirection
407 ]
408 ## Left-Eye
409 self.dataHandler.setArguments(eye=0)
410 cameraData["viewUp"] = [self.viewUp[i] for i in range(3)]
411 cameraData["position"] = [
412 (pos["position"][idx] - deltaVect[idx]) for idx in range(3)
413 ]
414 cameraData["focalPoint"] = [
415 (pos["position"][i] + self.viewForward[i] - deltaVect[i])
416 for i in range(3)
417 ]
418 yield cameraData
419 ## Right-Eye
420 self.dataHandler.setArguments(eye=1)
421 cameraData["viewUp"] = [self.viewUp[i] for i in range(3)]
422 cameraData["position"] = [
423 (pos["position"][idx] + deltaVect[idx]) for idx in range(3)
424 ]
425 cameraData["focalPoint"] = [
426 (pos["position"][i] + self.viewForward[i] + deltaVect[i])
427 for i in range(3)
428 ]
429 yield cameraData
430
431 # back
432 cameraData["orientation"] = "back"
433 self.dataHandler.setArguments(orientation=1)
434 deltaVect = [
435 -(v * float(self.eyeSpacing) * 0.5) for v in self.rightDirection
436 ]
437 ## Left-Eye
438 self.dataHandler.setArguments(eye=0)
439 cameraData["viewUp"] = [self.viewUp[i] for i in range(3)]
440 cameraData["position"] = [
441 (pos["position"][idx] - deltaVect[idx]) for idx in range(3)
442 ]
443 cameraData["focalPoint"] = [
444 (pos["position"][i] - self.viewForward[i] - deltaVect[i])
445 for i in range(3)
446 ]
447 yield cameraData
448 ## Right-Eye
449 self.dataHandler.setArguments(eye=1)
450 cameraData["viewUp"] = [self.viewUp[i] for i in range(3)]
451 cameraData["position"] = [

Callers

nothing calls this directly

Calls 3

setArgumentsMethod · 0.80
rangeClass · 0.50
indexMethod · 0.45

Tested by

no test coverage detected