Sets the cosines attribute.

 @param [Array<Float>] array the 6 directional cosines which describes the orientation of the image
553202
def cosines=(array)
      raise ArgumentError, "Invalid parameter 'array'. Exactly 6 elements needed, got #{array.length}" unless array.length == 6
      @cosines = array.collect {|val| val.to_f}
    end
941167
def coordinates=(c)
      case c
      when String
        @coordinates = c.split(/\s+/).collect { |coord| coord.split(',') }
      when Array
        c.each do |coord_array|
          unless coord_array.is_a?(Array)
            raise ArgumentError, "If set with an array, coordinates must be specified as an array of arrays"
          end
        end
        @coordinates = c
      else
        raise ArgumentError, "Coordinates must either be a String or an Array of Arrays"
      end
    end
280411
public function initFromArray($array)
    {
        $array = array_values($array);

        if (count($array) == 4) {

            // color array with alpha value
            list($r, $g, $b, $a) = $array;

        } elseif (count($array) == 3) {

            // color array without alpha value
            list($r, $g, $b) = $array;
            $a = 1;
        }

        $this->setPixel($r, $g, $b, $a);
    }
75801
public void set(double x1, double y1, double x2, double y2) {
        this.MODE = LINES;
        this.x1 = x1;
        this.y1 = y1;
        this.x2 = x2;
        this.y2 = y2;

        calcG();
        dx[0] = x1 - x;
        dx[1] = x2 - x;
        dy[0] = y1 - y;
        dy[1] = y2 - y;
        dz[0] = z1 - 0;
        dz[1] = z2 - 0;
        if (dashed) calcDashedLine();
    }
855861
public void setSpecular(float specular[]){
        for(int i = 0; i<specular.length;i++)
            this.specular[i]=specular[i];
        Sp = true;
    }
1056513
def setup(delta_col, delta_row, pos, cosines)
      # Set up the provided parameters:
      self.delta_col = delta_col
      self.delta_row = delta_row
      self.pos = pos
      self.cosines = cosines
      # Set up the dimensional parameters:
      @columns, @rows = self.shape
    end
875434
def []=(index,value)
      if self.shape.count != 1 or index >= self.shape[0]
        raise IndexError.new("You can only set values for array values")
      else
        @array_image[get_index_value(index)] = value
      end
    end
1053559
def set_pixel(x,y,color)

      index = (y*@width + x)
      pointindex = index*3
      @array[pointindex+2] = color.r.chr
      @array[pointindex+1] = color.g.chr
      @array[pointindex] = color.b.chr

      if color.a != 255 then
        @alpha = 255.chr*(@height * @width) unless @alpha
        @alpha[index] = color.a.chr
      end

      self
    end
1329187
protected void fillArray(final short[] array) {
    int pos = 0;
    int base = 0;
    for (int k = 0; k < bitmap.length; ++k) {
      long bitset = bitmap[k];
      while (bitset != 0) {
        array[pos++] = (short) (base + numberOfTrailingZeros(bitset));
        bitset &= (bitset - 1);
      }
      base += 64;
    }
  }
856344
void setRayNum(int rays) {
		if (rays < MIN_RAYS)
			rays = MIN_RAYS;

		rayNum = rays;
		vertexNum = rays + 1;

		segments = new float[vertexNum * 8];
		mx = new float[vertexNum];
		my = new float[vertexNum];
		f = new float[vertexNum];
	}
470221
def setImgShape(self, shape):
        '''
        
        '''
        self.img = type('Dummy', (object,), {})
#         if imgProcessor.ARRAYS_ORDER_IS_XY:
#             self.img.shape = shape[::-1]
#         else:
        self.img.shape = shape
1094880
public function setArrays(array $arrays)
    {
        $this->data = (isset($arrays[0]) && is_array($arrays[0])) ?
            $arrays :
            [$arrays];
    }
161141
public static final void writeFloat(float value, byte[] array, int offset)
    {
        writeInt(Float.floatToRawIntBits(value), array, offset);
    }
1126368
function setArray(array, newArray) {
    error_if_values_are_not_arrays_1.errorIfValuesAreNotArrays([array, newArray]);
    // These 2 lines make sure any memory reference to array is not broken:
    array.length = 0;
    array.push.apply(array, newArray);
}
788184
public void setRow(int i, double[] array, int offset)
    {
        int n = cols;
        for (int j=0;j<n;j++)
        {
            set(i, j, array[j+offset]);
        }
    }
1307094
private void set(Point3d[] x, Point3d[] y) {
		this.x = x;
		this.y = y;
		rmsdCalculated = false;
		transformationCalculated = false;
	}
657579
private float cosineSimilarity(float[] target, int pos, float[] vecs) {
    float dotProd = 0, tsqr = 0, csqr = 0;
    for(int i = 0; i < target.length; i++) {
      dotProd += target[i] * vecs[pos + i];
      tsqr += Math.pow(target[i], 2);
      csqr += Math.pow(vecs[pos + i], 2);
    }
    return (float) (dotProd / (Math.sqrt(tsqr) * Math.sqrt(csqr)));
  }