Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
const radians = deg => deg * Math.PI / 180 | |
// @param {Number} z Offset from radius | |
export default function convertLatLngToSphere (lat, lng, baseRadius, z) { | |
// radians | |
const phi = radians(lat) | |
const theta = radians(lng - 180) | |
const radius = baseRadius + z | |
var p1={ | |
x:0, | |
y:0 | |
}; | |
var p2={ | |
x:0, | |
y:1 | |
}; |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
// for use with pixel buffers, like the one you get from CanvasRenderingContext2D.getImageData(...).data | |
const getIndexFromCoordinates = (x, y, imageWidth) => y * (imageWidth * 4) + x * 4 | |
const getCoordinatesFromindex = (index, imageWidth) => [ | |
(index / 4) % imageWidth, | |
Math.floor((index / 4) / imageWidth) | |
]; | |
// for use with normal arrays where one element represents a cell in a ROWSxCOLS grid | |
const getIndexFromCoordinates = (x, y, width) => x + y * width; |
Playing around with Boids-style flocking. Click to add more, coloring by movement colors each boid by a moving average of its acceleration magnitude.
See also: Particle tentacles
More boids:
boids by Hugh Kennedy
boids-canvas by Mike Christensen
boids demo by Anoop Elias
flocking in Processing by Daniel Shiffman
year,state,County,fips,State_Reported_Cases | |
2008,Alaska,"Juneau City and Borough, Alaska",2110,80 | |
2008,Alaska,"Matanuska-Susitna Borough, Alaska",2170,253 | |
2008,Alaska,"Kenai Peninsula Borough, Alaska",2122,115 | |
2008,Alaska,"Bethel Census Area, Alaska",2050,19 | |
2008,Alaska,"Kodiak Island Borough, Alaska",2150,16 | |
2008,Alaska,"Sitka City and Borough, Alaska",2220,14 | |
2008,Alaska,"Ketchikan Gateway Borough, Alaska",2130,41 | |
2008,Alaska,"Anchorage Municipality, Alaska",2020,2271 | |
2008,Alaska,"Fairbanks North Star Borough, Alaska",2090,277 |
committee_id | committee_name | report_year | report_type | image_number | line_number | transaction_id | file_number | committee_name | entity_type | entity_type_desc | unused_contbr_id | contributor_prefix | contributor_name | contributor_first_name | contributor_middle_name | contributor_last_name | contributor_suffix | contributor_street_1 | contributor_street_2 | contributor_city | contributor_state | contributor_zip | contributor_employer | contributor_occupation | contributor_id | receipt_type | receipt_type_desc | receipt_type_full | memo_code | memo_code_full | contribution_receipt_date | contribution_receipt_amount | contributor_aggregate_ytd | candidate_id | candidate_name | candidate_first_name | candidate_last_name | candidate_middle_name | candidate_prefix | candidate_suffix | candidate_office | candidate_office_full | candidate_office_state | candidate_office_state_full | candidate_office_district | conduit_committee_id | conduit_committee_name | conduit_committee_street1 | conduit_committee_street2 | conduit_committee_city | conduit_committee_state | conduit_committee_zip | donor_committee_name | na |
---|
https://stackoverflow.com/questions/16425770/how-do-you-upload-images-to-a-gist
clone this repo locally, add images, push
pgc,absB,Diam,Dist,sgX,sgY,sgZ,objname,GrpID,Filament | |
2,-20.15,32.57,5217,4631,-1537,1847,UGC 12889,,860.0 | |
12,-19.5,28.0,6635,1839,-6240,1306,MCG -1- 1- 16,,711.0 | |
13,-18.64,14.27,5236,4112,-2712,1775,CGCG 499- 29,,825.0 | |
16,-18.28,14.52,5708,1693,-5327,1158,MCG -1- 1- 17,,711.0 | |
17,-19.3,19.68,9116,4085,-7823,2286,UM 15,,711.5 | |
18,-18.93,19.54,5566,4932,-1669,1968,MCG 8- 1- 19,,860.0 | |
20,-19.43,18.22,7501,2940,-6675,1750,MCG 0- 1- 16,,711.5 | |
30,-20.67,35.04,7747,-6126,-4392,-1789,ESO 12- 12,,768.0 | |
31,-19.06,18.37,6148,-2303,-5694,-265,FAIR 1061,,713.0 |
#!/usr/bin/env python | |
############################################################################### | |
# $Id$ | |
# | |
# Project: GDAL2Tiles, Google Summer of Code 2007 & 2008 | |
# Global Map Tiles Classes | |
# Purpose: Convert a raster into TMS tiles, create KML SuperOverlay EPSG:4326, | |
# generate a simple HTML viewers based on Google Maps and OpenLayers | |
# Author: Klokan Petr Pridal, klokan at klokan dot cz | |
# Web: http://www.klokan.cz/projects/gdal2tiles/ |