Reversed spiral generator.

        Parameters
        ----------
        width : `int`
            Spiral width.
        height : `int`
            Spiral height.

        Returns
        -------
        `generator` of (`int`, `int`)
            Points.
497078
def _rspiral(width, height):
        

        x0 = 0
        y0 = 0
        x1 = width - 1
        y1 = height - 1

        while x0 < x1 and y0 < y1:
            for x in range(x0, x1):
                yield x, y0
            for y in range(y0, y1):
                yield x1, y
            for x in range(x1, x0, -1):
                yield x, y1
            for y in range(y1, y0, -1):
                yield x0, y

            x0 += 1
            y0 += 1
            x1 -= 1
            y1 -= 1

        if x0 == x1:
            for y in range(y0, y1 + 1):
                yield x0, y
        elif y0 == y1:
            for x in range(x0, x1 + 1):
                yield x, y0
228257
def inverse(self):
        
        csg = self.clone()
        map(lambda p: p.flip(), csg.polygons)
        return csg
192719
def get_size(self):
        
        rec = self.get_rectangle()
        return (int(rec[2]-rec[0]), int(rec[3]-rec[1]))
350680
def layout_circle(self):
    ''''''
    n = self.num_vertices()
    t = np.linspace(0, 2*np.pi, n+1)[:n]
    return np.column_stack((np.cos(t), np.sin(t)))
618466
def get_target_dimensions(self):
        
        if self.target_height is None:
            self._calculate_target_dimensions()
        return int(self.target_width), int(self.target_height)
619022
function getBarrelCurveConstants(width, height) {
  return {
    heightOffset: Math.min(15, 0.05 * height),
    widthOffset: Math.min(100, 0.25 * width),
    ctrlPtOffsetPct: 0.05
  };
}
726067
def _divide_widths(self, cli, width):
        
        if not self.children:
            return []

        # Calculate widths.
        given_dimensions = self.get_dimensions(cli) if self.get_dimensions else None

        def get_dimension_for_child(c, index):
            if given_dimensions and given_dimensions[index] is not None:
                return given_dimensions[index]
            else:
                return c.preferred_width(cli, width)

        dimensions = [get_dimension_for_child(c, index) for index, c in enumerate(self.children)]

        # Sum dimensions
        sum_dimensions = sum_layout_dimensions(dimensions)

        # If there is not enough space for both.
        # Don't do anything.
        if sum_dimensions.min > width:
            return

        # Find optimal sizes. (Start with minimal size, increase until we cover
        # the whole height.)
        sizes = [d.min for d in dimensions]

        child_generator = take_using_weights(
            items=list(range(len(dimensions))),
            weights=[d.weight for d in dimensions])

        i = next(child_generator)

        while sum(sizes) < min(width, sum_dimensions.preferred):
            # Increase until we meet at least the 'preferred' size.
            if sizes[i] < dimensions[i].preferred:
                sizes[i] += 1
            i = next(child_generator)

        while sum(sizes) < min(width, sum_dimensions.max):
            # Increase until we use all the available space.
            if sizes[i] < dimensions[i].max:
                sizes[i] += 1
            i = next(child_generator)

        return sizes
1065017
def generateDistanceMatrix(width, height):
	
	
	# Determine the coordinates of the exact centre of the window
	originX = width / 2
	originY = height / 2
	
	# Generate the distance matrix
	distances = zerosFactory((height,width), dtype=np.float)
	for index, val in np.ndenumerate(distances):
		y,x = index
		distances[(y,x)] = math.sqrt( math.pow(x - originX, 2) + math.pow(y - originY, 2) )
	
	return distances
535289
def get_dimension(self):
        """"""
        return int(round(float(self.strokes**2)/2 + float(self.strokes)/2))
1302812
function (x, y, width, height, r, strokeWidth) {

		if (isObject(x)) {
			y = x.y;
			width = x.width;
			height = x.height;
			r = x.r;
			strokeWidth = x.strokeWidth;
			x = x.x;
		}
		var wrapper = this.symbol('rect');
		wrapper.r = r;

		return wrapper.attr(wrapper.crisp(strokeWidth, x, y, mathMax(width, 0), mathMax(height, 0)));
	}
706044
public static double rotatedWidth( double width , double c , double s )
	{
		return Math.abs(c)*width + Math.abs(s)*width;
	}
367278
def get_grid_dimensions(current_problem_size, params, grid_div, block_size_names):
    """"""
    def get_dimension_divisor(divisor_list, default, params):
        if divisor_list is None:
            if default in params:
                divisor_list = [default]
            else:
                return 1
        return numpy.prod([int(eval(replace_param_occurrences(s, params))) for s in divisor_list])
    divisors = [get_dimension_divisor(d, block_size_names[i], params) for i, d in enumerate(grid_div)]
    return tuple(int(numpy.ceil(float(current_problem_size[i]) / float(d))) for i, d in enumerate(divisors))
290289
function (dimensions) {
                return {
                    x: this.limitRoles.includes('left') ? 0 : dimensions.width - this.width / 2,
                    y: this.limitRoles.includes('top') ? 0 : dimensions.height - this.height / 2
                };
            }
519318
def get_minimum_size(self, data):
        """"""
        size = self.element.get_minimum_size(data)
        if self.angle in (RotateLM.NORMAL, RotateLM.UPSIDE_DOWN):
            return size
        else:
            return datatypes.Point(size.y, size.x)
1175795
def as_int(width, height):
    ""
    gcd = get_gcd(width, height)
    return int(width / gcd), int(height / gcd)
664805
def ndim(self):
        """"""
        try:
            return self.__ndim
        except AttributeError:
            ndim = len(self.coord_vectors)
            self.__ndim = ndim
            return ndim
698880
def getRectArea(*args):
    """"""
    rect = args[0]
    if len(args) > 1:
        unit = args[1]
    else:
        unit = "px"    
    u = {"px": (1,1), "in": (1.,72.), "cm": (2.54, 72.), "mm": (25.4, 72.)}
    f = (u[unit][0] / u[unit][1])**2
    return f * rect.width * rect.height