Example #1
0
    def update(self):

        if not self.targetFrame:
            return

        r = self.properties.getProperty("Distance (m)")
        theta = np.radians(90 - self.properties.getProperty("Elevation (deg)"))
        phi = np.radians(180 - self.properties.getProperty("Azimuth (deg)"))

        x = r * np.cos(phi) * np.sin(theta)
        y = r * np.sin(phi) * np.sin(theta)
        z = r * np.cos(theta)

        c = self.camera
        targetToWorld = self.targetFrame.transform

        currentPosition = np.array(c.GetPosition())
        desiredPosition = np.array(targetToWorld.TransformPoint([x, y, z]))

        smoothTime = self.properties.getProperty("Smooth Time (s)")

        newPosition, self.currentVelocity = smoothDamp(
            currentPosition, desiredPosition, self.currentVelocity, smoothTime, maxSpeed=100, deltaTime=self.dt
        )

        trackerToWorld = transformUtils.getLookAtTransform(targetToWorld.GetPosition(), newPosition)

        c.SetFocalPoint(targetToWorld.GetPosition())
        c.SetPosition(trackerToWorld.GetPosition())
        self.view.render()
Example #2
0
    def update(self):

        if not self.targetFrame:
            return

        r = self.properties.getProperty('Distance (m)')
        theta = np.radians(90 - self.properties.getProperty('Elevation (deg)'))
        phi = np.radians(180 - self.properties.getProperty('Azimuth (deg)'))

        x = r * np.cos(phi) * np.sin(theta)
        y = r * np.sin(phi) * np.sin(theta)
        z = r * np.cos(theta)

        c = self.camera
        targetToWorld = self.targetFrame.transform

        currentPosition = np.array(c.GetPosition())
        desiredPosition = np.array(targetToWorld.TransformPoint([x, y, z]))

        smoothTime = self.properties.getProperty('Smooth Time (s)')

        newPosition, self.currentVelocity = smoothDamp(currentPosition,
                                                       desiredPosition,
                                                       self.currentVelocity,
                                                       smoothTime,
                                                       maxSpeed=100,
                                                       deltaTime=self.dt)

        trackerToWorld = transformUtils.getLookAtTransform(
            targetToWorld.GetPosition(), newPosition)

        c.SetFocalPoint(targetToWorld.GetPosition())
        c.SetPosition(trackerToWorld.GetPosition())
        self.view.render()
Example #3
0
 def getCameraTransform(self):
     c = self.camera
     return transformUtils.getLookAtTransform(c.GetFocalPoint(), c.GetPosition(), c.GetViewUp())
def getCameraTransform(camera):
    return transformUtils.getLookAtTransform(camera.GetFocalPoint(),
                                             camera.GetPosition(),
                                             camera.GetViewUp())
Example #5
0
 def getCameraTransform(self):
     c = self.camera
     return transformUtils.getLookAtTransform(c.GetFocalPoint(),
                                              c.GetPosition(),
                                              c.GetViewUp())
Example #6
0
def getCameraTransform(camera):
    return transformUtils.getLookAtTransform(
              camera.GetFocalPoint(),
              camera.GetPosition(),
              camera.GetViewUp())