Draws a text at Point3 position. Don't forget to add 'await self._client.send_debug'.
        To grab a unit's 3d position, use unit.position3d
        Usually the Z value of a Point3 is between 8 and 14 (except for flying units)
355901
def debug_text_world(self, text: str, pos: Union[Unit, Point2, Point3], color=None, size: int = 8):
        
        if isinstance(pos, Point2) and not isinstance(pos, Point3):  # a Point3 is also a Point2
            pos = Point3((pos.x, pos.y, 0))
        self._debug_texts.append(self.to_debug_message(text, color, pos, size))
953668
def draw(surface, z_order, colour)
      surface.draw_rectangle(position, size, z_order, colour)
    end
1062375
def point2pos(self, point):
        """"""
        row = self._vim.eval('byte2line({})'.format(point))
        col = self._vim.eval('{} - line2byte({})'.format(point, row))
        return (int(row), int(col))
1358330
def draw_point ink, left, top, opts = {}
      draw_rect ink, left, top, 1, 1, opts
    end
1266035
def debug_text_screen(self, text: str, pos: Union[Point2, Point3, tuple, list], color=None, size: int = 8):
        
        assert len(pos) >= 2
        assert 0 <= pos[0] <= 1
        assert 0 <= pos[1] <= 1
        pos = Point2((pos[0], pos[1]))
        self._debug_texts.append(self.to_debug_message(text, color, pos, size))
465075
def point(self, pos):
        """"""
        return ((1 - pos) ** 3 * self.start) + \
               (3 * (1 - pos) ** 2 * pos * self.control1) + \
               (3 * (1 - pos) * pos ** 2 * self.control2) + \
               (pos ** 3 * self.end)
3609
def draw_text(self, text:str, x:float, y:float, *,
                  font_name:str, font_size:float, fill:Color) -> None:
        """"""
        pass
432224
function drawCell(cell, canvas, loc, fill) {
  // Also takes in a number and outputs a cell.
  if (typeof loc == 'undefined') loc = {x: 0, y: 0};
  if (typeof fill == 'undefined') fill = '#8ED6FF';

  var quadrant_width = 50;
  // Given a number in a quadrant and a location specifying the top left corner of
  // the quadrant, draw the relevant shape.
  function drawQuadrant(n, q, loc) {
    // draw upper triangle going certain direction at location
    function drawUpperTriangle(d, loc) {
      if (d == "r") {
        var first = {x: 50, y: 0};
        var second = {x: 50, y: 50};
      } else {
        var first = {x: 50, y: 0};
        var second = {x: 0, y: 50};
      }
      context.beginPath();
      context.moveTo(loc.x, loc.y);
      context.lineTo(loc.x + first.x, loc.y + first.y);
      context.lineTo(loc.x + second.x, loc.y + second.y);
      context.lineTo(loc.x, loc.y);
      context.lineWidth = 1;
      context.strokeStyle = 'black';
      context.stroke();
      context.fillStyle = fill;
      context.fill();
      context.closePath();
    }
    function drawLowerTriangle(d, loc) {
      if (d == "r") {
        loc = {x: loc.x + 50, y: loc.y};
        var first = {x: 0, y: 50};
        var second = {x: -50, y: 50};
      } else {
        var first = {x: 50, y: 50};
        var second = {x: 0, y: 50};
      }
      context.beginPath();
      context.moveTo(loc.x, loc.y);
      context.lineTo(loc.x + first.x, loc.y + first.y);
      context.lineTo(loc.x + second.x, loc.y + second.y);
      context.lineTo(loc.x, loc.y);
      context.lineWidth = 1;
      context.strokeStyle = 'black';
      context.stroke();
      context.fillStyle = fill;
      context.fill();
      context.closePath();
    }
    function drawTileOutline(loc) {
      context.beginPath();
      context.moveTo(loc.x, loc.y);
      context.lineTo(loc.x + 50, loc.y);
      context.lineTo(loc.x + 50, loc.y + 50);
      context.lineTo(loc.x, loc.y + 50);
      context.lineTo(loc.x, loc.y);
      context.lineWidth = 1;
      context.strokeStyle = 'black';
      context.stroke();
      context.closePath();
    }
    // blank space, just draw outline without filling.
    if (n == 0) {
      drawTileOutline(loc);
    } else if (n == 1) { // tile.
      context.beginPath();
      context.moveTo(loc.x, loc.y);
      context.lineTo(loc.x + 50, loc.y);
      context.lineTo(loc.x + 50, loc.y + 50);
      context.lineTo(loc.x, loc.y + 50);
      context.lineTo(loc.x, loc.y);
      context.lineWidth = 1;
      context.strokeStyle = 'black';
      context.stroke();
      context.fillStyle = fill;
      context.fill();
      context.closePath();
    } else if (n == 2) {
      drawTileOutline(loc);
      if (q == 0 || q == 2) {
        drawLowerTriangle("l", loc);
      } else {
        drawLowerTriangle("r", loc);
      }
    } else if (n == 3) {
      drawTileOutline(loc);
      if (q == 0 || q == 2) {
        drawUpperTriangle("r", loc);
      } else {
        drawUpperTriangle("l", loc);
      }
    }
  }
  var context = canvas.getContext('2d');
  var offsets = [
    {x: 0, y: 0},
    {x: 50, y: 0},
    {x: 50, y: 50},
    {x: 0, y: 50}
  ];

  // number at element, quadrant
  cell.array.forEach(function(n, q) {
    var offset = offsets[q];
    var new_loc = {x: loc.x + offset.x, y: loc.y + offset.y};
    drawQuadrant(n, q, new_loc);
  });
}
675282
def send_setpoint(self, roll, pitch, yaw, thrust):
        
        if thrust > 0xFFFF or thrust < 0:
            raise ValueError('Thrust must be between 0 and 0xFFFF')

        if self._x_mode:
            roll, pitch = 0.707 * (roll - pitch), 0.707 * (roll + pitch)

        pk = CRTPPacket()
        pk.port = CRTPPort.COMMANDER
        pk.data = struct.pack('<fffH', roll, -pitch, yaw, thrust)
        self._cf.send_packet(pk)
199933
def draw
      r = @dist.rng.to_i
      raise "drawn number must be an integer" unless r.is_a? Integer
      # keep the value inside the allowed range
      r = 0 - r if r < 0
      if r >= @range.size
        diff = 1 + r - @range.size
        r = @range.size - diff
      end
      @range[r]
    end
373990
def _calculate_position(self, at_line=None, at_position=None,
                            at_point=None):
        
        # Check that no option or only one option is given:
        if [at_line, at_position, at_point].count(None) < 2:
            raise Exception('Provide no argument or only one argument!')

        # Saving cursor position:
        if at_position is None:
            at_position = self.get_position('cursor')

        # FIXME: What id this used for?
        self.calltip_position = at_position

        if at_point is not None:
            # Showing tooltip at point position
            cx, cy = at_point.x(), at_point.y()
        elif at_line is not None:
            # Showing tooltip at line
            cx = 5
            cursor = QTextCursor(self.document().findBlockByNumber(at_line-1))
            cy = self.cursorRect(cursor).top()
        else:
            # Showing tooltip at cursor position
            # FIXME: why is at_position not being used to calculate the
            # coordinates?
            cx, cy = self.get_coordinates('cursor')

        # Calculate vertical delta
        font = self.font()
        delta = font.pointSize() + 5

        # Map to global coordinates
        point = self.mapToGlobal(QPoint(cx, cy))
        point = self.calculate_real_position(point)
        point.setY(point.y() + delta)

        return point
1095314
def cmd_position(self, args):
        ''''''
        if (len(args) != 3):
            print("Usage: position x y z (meters)")
            return

        if (len(args) == 3):
            x_m = float(args[0])
            y_m = float(args[1])
            z_m = float(args[2])
            print("x:%f, y:%f, z:%f" % (x_m, y_m, z_m))
            self.master.mav.set_position_target_local_ned_send(
                                      0,  # system time in milliseconds
                                      1,  # target system
                                      0,  # target component
                                      8,  # coordinate frame MAV_FRAME_BODY_NED
                                      3576,     # type mask (pos only)
                                      x_m, y_m, z_m,  # position x,y,z
                                      0, 0, 0,  # velocity x,y,z
                                      0, 0, 0,  # accel x,y,z
                                      0, 0)
1154802
def debug_sphere_out(self, p: Union[Unit, Point2, Point3], r: Union[int, float], color=None):
        
        self._debug_spheres.append(
            debug_pb.DebugSphere(p=self.to_debug_point(p), r=r, color=self.to_debug_color(color))
        )
244736
private Point3d getMidPoint(Point3d p1, Point3d p2, Point3d p3) {
		Vector3d v1 = new Vector3d();
		v1.sub(p1, p2);
		Vector3d v2 = new Vector3d();
		v2.sub(p3, p2);
		Vector3d v3 = new Vector3d();
		v3.add(v1);
		v3.add(v2);
		v3.normalize();

		// calculat the total distance between to subunits
		double dTotal = v1.length();
		// calculate the rise along the y-axis. The helix axis is aligned with y-axis,
		// therfore, the rise between subunits is the y-distance
		double rise = p2.y - p1.y;
		// use phythagorean theoremm to calculate chord length between two subunit centers
		double chord = Math.sqrt(dTotal*dTotal - rise*rise);
//		System.out.println("Chord d: " + dTotal + " rise: " + rise + "chord: " + chord);
		double angle = helixLayers.getByLargestContacts().getAxisAngle().angle;

		// using the axis angle and the chord length, we can calculate the radius of the helix
		// http://en.wikipedia.org/wiki/Chord_%28geometry%29
		double radius = chord/Math.sin(angle/2)/2; // can this go to zero?
//		System.out.println("Radius: " + radius);

		// project the radius onto the vector that points toward the helix axis
		v3.scale(radius);
		v3.add(p2);
//		System.out.println("Angle: " + Math.toDegrees(helixLayers.getByLowestAngle().getAxisAngle().angle));
		Point3d cor = new Point3d(v3);
		return cor;
	}
1131446
private int pointToGridIdx(Grid grid, float x, float y, float z) {
        Vec3f size = grid.getSize();

        int idx = calcIndex(x, size.getX(), grid.getMin().getX(), grid.getDivision().getX());
        int idy = calcIndex(y, size.getY(), grid.getMin().getY(), grid.getDivision().getY());
        int idz = calcIndex(z, size.getZ(), grid.getMin().getZ(), grid.getDivision().getZ());

        return idx + grid.getDivision().getX() * (idy + grid.getDivision().getY() * idz);
    }
1187909
def send_position_setpoint(self, x, y, z, yaw):
        
        pk = CRTPPacket()
        pk.port = CRTPPort.COMMANDER_GENERIC
        pk.data = struct.pack('<Bffff', TYPE_POSITION,
                              x, y, z, yaw)
        self._cf.send_packet(pk)
978289
@Override
	public Point3D getXYZ(int index) {
		if (index < 0 || index >= getPointCount())
			throw new IndexOutOfBoundsException();

		_verifyAllStreams();
		AttributeStreamOfDbl v = (AttributeStreamOfDbl) m_vertexAttributes[0];
		Point3D pt = new Point3D();
		pt.x = v.read(index * 2);
		pt.y = v.read(index * 2 + 1);

		// TODO check excluded if statement componenet
		if (hasAttribute(Semantics.Z))// && (m_vertexAttributes[1] != null))
			pt.z = m_vertexAttributes[1].readAsDbl(index);
		else
			pt.z = VertexDescription.getDefaultValue(Semantics.Z);

		return pt;
	}