control roi position and velocity
976302
def cmd_gimbal_roi_vel(self, args):
        ''''''
        if len(args) != 0 and len(args) != 3 and len(args) != 6:
            print("usage: gimbal roivel [VEL_NORTH VEL_EAST VEL_DOWN] [ACC_NORTH ACC_EASY ACC_DOWN]")
            return
        latlon = None
        vel = [0,0,0]
        acc = [0,0,0]
        if (len(args) >= 3):
            vel[0:3] = args[0:3]
        if (len(args) == 6):
            acc[0:3] = args[3:6]
        try:
            latlon = self.module('map').click_position
        except Exception:
            print("No map available")
            return
        if latlon is None:
            print("No map click position available")
            latlon = (0,0,0)
        self.master.mav.set_roi_global_int_send(0, #time_boot_ms
            1, #target_system
            1, #target_component
            mavutil.mavlink.MAV_FRAME_GLOBAL_RELATIVE_ALT_INT,
            0, #type_mask
            0, #roi_index
            0, #timeout_ms
            int(latlon[0]*1e7), #lat int
            int(latlon[1]*1e7), #lng int
            float(0),       #alt
            float(vel[0]), #vx
            float(vel[1]), #vy
            float(vel[2]), #vz
            float(acc[0]), #ax
            float(acc[1]), #ay
            float(acc[2]))
44600
private void computeDivUVD(GrayF32 u , GrayF32 v , GrayF32 psi ,
							   GrayF32 divU , GrayF32 divV , GrayF32 divD ) {

		final int stride = psi.stride;

		// compute the inside pixel
		for (int y = 1; y < psi.height-1; y++) {

			// index of the current pixel
			int index = y*stride + 1;

			for (int x = 1; x < psi.width-1; x++ , index++) {

				float psi_index = psi.data[index];

				float coef0 = 0.5f*(psi.data[index+1] + psi_index);
				float coef1 = 0.5f*(psi.data[index-1] + psi_index);
				float coef2 = 0.5f*(psi.data[index+stride] + psi_index);
				float coef3 = 0.5f*(psi.data[index-stride] + psi_index);

				float u_index = u.data[index];

				divU.data[index] = coef0*(u.data[index+1] - u_index) + coef1*(u.data[index-1] - u_index) +
								   coef2*(u.data[index+stride] - u_index) + coef3*(u.data[index-stride] - u_index);

				float v_index = v.data[index];

				divV.data[index] = coef0*(v.data[index+1] - v_index) + coef1*(v.data[index-1] - v_index) +
								   coef2*(v.data[index+stride] - v_index) + coef3*(v.data[index-stride] - v_index);

				divD.data[index] = coef0 + coef1 + coef2 + coef3;
			}
		}

		// handle the image borders
		for( int x = 0; x < psi.width; x++ ) {
			computeDivUVD_safe(x,0,u,v,psi,divU,divV,divD);
			computeDivUVD_safe(x,psi.height-1,u,v,psi,divU,divV,divD);
		}
		for( int y = 1; y < psi.height-1; y++ ) {
			computeDivUVD_safe(0,y,u,v,psi,divU,divV,divD);
			computeDivUVD_safe(psi.width-1,y,u,v,psi,divU,divV,divD);
		}
	}
1051217
function(){
            var x = this.x,
                y = this.y,
                fieldRange = this.fovFieldRange,
                direction = this.fovDirection,
                maxViewDistance = this.fovMaxViewDistance;
            this.fov.update(x, y, fieldRange, direction, maxViewDistance, this);
        }
96071
def view_vector(self, vector, viewup=None):
        """"""
        focal_pt = self.center
        if viewup is None:
            viewup = rcParams['camera']['viewup']
        cpos = [vector + np.array(focal_pt),
                focal_pt, viewup]
        self.camera_position = cpos
        return self.reset_camera()
1019421
def _at(self, t):
        """"""
        rITRF, vITRF, error = self.ITRF_position_velocity_error(t)
        rGCRS, vGCRS = ITRF_to_GCRS2(t, rITRF, vITRF)
        return rGCRS, vGCRS, rGCRS, error
358336
def set_position(self, position):
        """"""
        if position > self._duration():
            return
        position_ns = position * _NANOSEC_MULT
        self._manager[ATTR_POSITION] = position
        self._player.seek_simple(_FORMAT_TIME, Gst.SeekFlags.FLUSH, position_ns)
611285
function flyToPosition(scene, position, durationMilliseconds) {
  var camera = scene.camera;
  var startPosition = camera.position;
  var endPosition = position;

  durationMilliseconds = defaultValue(durationMilliseconds, 200);

  var initialEnuToFixed = Transforms.eastNorthUpToFixedFrame(
    startPosition,
    Ellipsoid.WGS84
  );

  var initialEnuToFixedRotation = new Matrix4();
  Matrix4.getRotation(initialEnuToFixed, initialEnuToFixedRotation);

  var initialFixedToEnuRotation = new Matrix3();
  Matrix3.transpose(initialEnuToFixedRotation, initialFixedToEnuRotation);

  var initialEnuUp = new Matrix3();
  Matrix3.multiplyByVector(initialFixedToEnuRotation, camera.up, initialEnuUp);

  var initialEnuRight = new Matrix3();
  Matrix3.multiplyByVector(
    initialFixedToEnuRotation,
    camera.right,
    initialEnuRight
  );

  var initialEnuDirection = new Matrix3();
  Matrix3.multiplyByVector(
    initialFixedToEnuRotation,
    camera.direction,
    initialEnuDirection
  );

  var controller = scene.screenSpaceCameraController;
  controller.enableInputs = false;

  scene.tweens.add({
    duration: durationMilliseconds / 1000.0,
    easingFunction: Tween.Easing.Sinusoidal.InOut,
    startObject: {
      time: 0.0
    },
    stopObject: {
      time: 1.0
    },
    update: function(value) {
      scene.camera.position.x = CesiumMath.lerp(
        startPosition.x,
        endPosition.x,
        value.time
      );
      scene.camera.position.y = CesiumMath.lerp(
        startPosition.y,
        endPosition.y,
        value.time
      );
      scene.camera.position.z = CesiumMath.lerp(
        startPosition.z,
        endPosition.z,
        value.time
      );

      var enuToFixed = Transforms.eastNorthUpToFixedFrame(
        camera.position,
        Ellipsoid.WGS84
      );

      var enuToFixedRotation = new Matrix3();
      Matrix4.getRotation(enuToFixed, enuToFixedRotation);

      camera.up = Matrix3.multiplyByVector(
        enuToFixedRotation,
        initialEnuUp,
        camera.up
      );
      camera.right = Matrix3.multiplyByVector(
        enuToFixedRotation,
        initialEnuRight,
        camera.right
      );
      camera.direction = Matrix3.multiplyByVector(
        enuToFixedRotation,
        initialEnuDirection,
        camera.direction
      );
    },
    complete: function() {
      controller.enableInputs = true;
    },
    cancel: function() {
      controller.enableInputs = true;
    }
  });
}
1088458
def move_left(self):
        """"""
        self.at(ardrone.at.pcmd, True, -self.speed, 0, 0, 0)
886488
def _move(self, feature, randomLocation = False, useNoise = True):
    

    if randomLocation:
      locationOnObject = {
        "top": feature["top"] + np.random.rand()*feature["height"],
        "left": feature["left"] + np.random.rand()*feature["width"],
      }
    else:
      locationOnObject = {
        "top": feature["top"] + feature["height"]/2.,
        "left": feature["left"] + feature["width"]/2.
      }

    if self.locationOnObject is not None:
      displacement = {"top": locationOnObject["top"] -
                             self.locationOnObject["top"],
                      "left": locationOnObject["left"] -
                              self.locationOnObject["left"]}
      if useNoise:
        params = self.column.movementCompute(displacement,
                                             self.noiseFactor,
                                             self.moduleNoiseFactor)
      else:
        params = self.column.movementCompute(displacement, 0, 0)

      for monitor in self.monitors.values():
        monitor.afterLocationShift(**params)
    else:
      for monitor in self.monitors.values():
        monitor.afterLocationInitialize()

    self.locationOnObject = locationOnObject
    for monitor in self.monitors.values():
      monitor.afterLocationChanged(locationOnObject)
469520
function () {
                    if (thisLayer.activeControl) {
                        if (thisLayer.activeControl === thisLayer.tiltUpControl) {
                            thisLayer.wwd.navigator.tilt =
                                Math.max(0, thisLayer.wwd.navigator.tilt - thisLayer.tiltIncrement);
                        } else if (thisLayer.activeControl === thisLayer.tiltDownControl) {
                            thisLayer.wwd.navigator.tilt =
                                Math.min(90, thisLayer.wwd.navigator.tilt + thisLayer.tiltIncrement);
                        }
                        thisLayer.wwd.redraw();
                        setTimeout(setRange, 50);
                    }
                }
8015
def _transform_positioning(ha, va):
    """"""
    if ha == "center" and va == "center":
        return None

    ha_mpl_to_tikz = {"right": "east", "left": "west", "center": ""}
    va_mpl_to_tikz = {
        "top": "north",
        "bottom": "south",
        "center": "",
        "baseline": "base",
    }
    return "anchor={} {}".format(va_mpl_to_tikz[va], ha_mpl_to_tikz[ha]).strip()
147826
public void setVelocity(float dirx, float diry, float speed) {
		this.velx = dirx * speed;
		this.vely = diry * speed;
	}
1301507
def mouseMoveEvent(self, ev):
        """"""
        pos = self.transformPos(ev.pos())

        # Update coordinates in status bar if image is opened
        window = self.parent().window()
        if window.filePath is not None:
            self.parent().window().labelCoordinates.setText(
                'X: %d; Y: %d' % (pos.x(), pos.y()))

        # Polygon drawing.
        if self.drawing():
            self.overrideCursor(CURSOR_DRAW)
            if self.current:
                color = self.drawingLineColor
                if self.outOfPixmap(pos):
                    # Don't allow the user to draw outside the pixmap.
                    # Project the point to the pixmap's edges.
                    pos = self.intersectionPoint(self.current[-1], pos)
                elif len(self.current) > 1 and self.closeEnough(pos, self.current[0]):
                    # Attract line to starting point and colorise to alert the
                    # user:
                    pos = self.current[0]
                    color = self.current.line_color
                    self.overrideCursor(CURSOR_POINT)
                    self.current.highlightVertex(0, Shape.NEAR_VERTEX)

                if self.drawSquare:
                    initPos = self.current[0]
                    minX = initPos.x()
                    minY = initPos.y()
                    min_size = min(abs(pos.x() - minX), abs(pos.y() - minY))
                    directionX = -1 if pos.x() - minX < 0 else 1
                    directionY = -1 if pos.y() - minY < 0 else 1
                    self.line[1] = QPointF(minX + directionX * min_size, minY + directionY * min_size)
                else:
                    self.line[1] = pos

                self.line.line_color = color
                self.prevPoint = QPointF()
                self.current.highlightClear()
            else:
                self.prevPoint = pos
            self.repaint()
            return

        # Polygon copy moving.
        if Qt.RightButton & ev.buttons():
            if self.selectedShapeCopy and self.prevPoint:
                self.overrideCursor(CURSOR_MOVE)
                self.boundedMoveShape(self.selectedShapeCopy, pos)
                self.repaint()
            elif self.selectedShape:
                self.selectedShapeCopy = self.selectedShape.copy()
                self.repaint()
            return

        # Polygon/Vertex moving.
        if Qt.LeftButton & ev.buttons():
            if self.selectedVertex():
                self.boundedMoveVertex(pos)
                self.shapeMoved.emit()
                self.repaint()
            elif self.selectedShape and self.prevPoint:
                self.overrideCursor(CURSOR_MOVE)
                self.boundedMoveShape(self.selectedShape, pos)
                self.shapeMoved.emit()
                self.repaint()
            return

        # Just hovering over the canvas, 2 posibilities:
        # - Highlight shapes
        # - Highlight vertex
        # Update shape/vertex fill and tooltip value accordingly.
        self.setToolTip("Image")
        for shape in reversed([s for s in self.shapes if self.isVisible(s)]):
            # Look for a nearby vertex to highlight. If that fails,
            # check if we happen to be inside a shape.
            index = shape.nearestVertex(pos, self.epsilon)
            if index is not None:
                if self.selectedVertex():
                    self.hShape.highlightClear()
                self.hVertex, self.hShape = index, shape
                shape.highlightVertex(index, shape.MOVE_VERTEX)
                self.overrideCursor(CURSOR_POINT)
                self.setToolTip("Click & drag to move point")
                self.setStatusTip(self.toolTip())
                self.update()
                break
            elif shape.containsPoint(pos):
                if self.selectedVertex():
                    self.hShape.highlightClear()
                self.hVertex, self.hShape = None, shape
                self.setToolTip(
                    "Click & drag to move shape '%s'" % shape.label)
                self.setStatusTip(self.toolTip())
                self.overrideCursor(CURSOR_GRAB)
                self.update()
                break
        else:  # Nothing found, clear highlights, reset state.
            if self.hShape:
                self.hShape.highlightClear()
                self.update()
            self.hVertex, self.hShape = None, None
            self.overrideCursor(CURSOR_DEFAULT)
948059
function () {
        this.update = {
            velocity: function (entity, dt) {
                entity.c.position.x += hitagi.utils.delta(entity.c.velocity.xspeed, dt);
            }
        };
    }
57861
def do_move(self, dt, buttons):
        
        assert isinstance(dt, int) or isinstance(dt, float)
        assert isinstance(buttons, dict)

        newVel = self.velocity

        # Redirect existing vel to new direction.
        nv = newVel.magnitude()
        newVel = nv * self.impulse_dir

        mv = buttons['up']
        if mv != 0:
            self.stats['battery'] -= self.battery_use['linear']
            newVel += dt * mv * self.accel * self.impulse_dir
        else:
            brake = dt * self.deaccel
            if nv < brake:
                newVel *= 0
            else:
                newVel += brake * -self.impulse_dir

        nv = newVel.magnitude()
        if nv > self.top_speed:
            newVel *= self.top_speed / nv

        return newVel
476243
function (dt) {
    var data = this.data;
    var acceleration = data.acceleration;
    var easing = data.easing;
    var velocity = this.velocity;
    var rollAxis = data.rollAxis;
    var pitchAxis = data.pitchAxis;
    var el = this.el;
    var gamepad = this.getGamepad();

    // If data has changed or FPS is too low
    // we reset the velocity
    if (dt > MAX_DELTA) {
      velocity[rollAxis] = 0;
      velocity[pitchAxis] = 0;
      return;
    }

    velocity[rollAxis] -= velocity[rollAxis] * easing * dt / 1000;
    velocity[pitchAxis] -= velocity[pitchAxis] * easing * dt / 1000;

    var position = el.getAttribute('position');

    if (data.enabled && data.movementEnabled && gamepad) {
      var dpad = this.getDpad(),
          inputX = dpad.x || this.getJoystick(0).x,
          inputY = dpad.y || this.getJoystick(0).y;
      if (Math.abs(inputX) > JOYSTICK_EPS) {
        velocity[pitchAxis] += inputX * acceleration * dt / 1000;
      }
      if (Math.abs(inputY) > JOYSTICK_EPS) {
        velocity[rollAxis] += inputY * acceleration * dt / 1000;
      }
    }

    var movementVector = this.getMovementVector(dt);

    el.object3D.translateX(movementVector.x);
    el.object3D.translateY(movementVector.y);
    el.object3D.translateZ(movementVector.z);

    el.setAttribute('position', {
      x: position.x + movementVector.x,
      y: position.y + movementVector.y,
      z: position.z + movementVector.z
    });
  }
378506
def _onMotion(self, evt):
        """"""

        x = evt.GetX()
        y = self.figure.bbox.height - evt.GetY()
        evt.Skip()
        FigureCanvasBase.motion_notify_event(self, x, y, guiEvent=evt)