Skip to content

Instantly share code, notes, and snippets.

@donSchoe
donSchoe / gist:f12fffb3584ee2b9042d
Created July 2, 2015 07:24
epsg4326 latLonToPixels xy
// JavaScript
// converts lat/lon to pixel x/y at zoom level 0 for 256*256 tile size , inverts y coord
function latLonToPixels(lat, lon) { // lat, lon: epsg:4326
var sinLat = Math.sin(lat * Math.PI / 180.0);
var pixelX = ((lon + 180) / 360) * 256;
var pixelY = (0.5 - Math.log((1 + sinLat) / (1 - sinLat)) / (Math.PI * 4)) * 256;
return { x: pixelX, y: pixelY }; // object with .x and .y
}
/*
Generic Canvas Overlay for leaflet,
Stanislav Sumbera, April , 2014
- added userDrawFunc that is called when Canvas need to be redrawn
- added few useful params fro userDrawFunc callback
- fixed resize map bug
inspired & portions taken from : https://github.com/Leaflet/Leaflet.heat
@donSchoe
donSchoe / leaflet-epsg.js
Created July 9, 2015 12:08
Where is EPSG:3857 in Leaflet?
map.getBounds().getNorthEast(); // LatLng(52.5262, 13.44907)
map.getPixelBounds().getTopRight(); // Point(2253845, 1375425) ???
map.getPixelOrigin(); // Point(2252165, 1375425) ???
L.Projection.SphericalMercator.project(
map.getBounds().getNorthEast()
); // Point(0.23473, 1.08117) !?!
@donSchoe
donSchoe / README.md
Created September 17, 2015 12:43
array buffers for javascript webgl rendering for tile (8,137,83)

zum rendern brauche ich die vertices mit den pixel koordinaten (siehe vertex_array in arrays.js) und die entsprechenden indices für den draw call (siehe index_array in arrays.js).

um epsg:4326 oder epsg:3857 in pixel koordinaten zu convertieren habe ich dir die rechnung in conversions.js gepackt.

ich habe eine tile mit zoom=8, x=137 und y=83 als rohdaten in geojson unter tile_8_137_83.json abgelegt. die konvertierten und vorberechneten arrays sind in arrays.js.

tl;dr ich brauch ein vertex und ein index array im gltf. falls das format relevant ist, für die vertices nutze ich ein Float32Array und für die indices Uint16Array

@donSchoe
donSchoe / gist:3289085
Created August 7, 2012 20:39
Punkrockers Radio Webplayer (Flash)
<script type="text/javascript" src="http://player.wavestreamer.com/cgi-bin/swf.js?id=D4NCK168ID4332B5"></script>
<script type="text/javascript" src=" http://player.wavestreaming.com/?id=D4NCK168ID4332B5"></script>
@donSchoe
donSchoe / gist:3734617
Created September 16, 2012 22:18
Program received signal SIGSEGV, Segmentation fault.
An error occured while saving which was suppressed!
An error occured while saving which was suppressed!
An error occured while saving which was suppressed!
An error occured while saving which was suppressed!
Program received signal SIGSEGV, Segmentation fault.
0x0000000000758175 in SerializedGameData::PushObject (this=0x7fffffffd370, go=0x7dce120, known=true) at /srv/jenkins/jobs/s25rttr/workspace/ARCH/x86_64/PLATFORM/linux/label/ma/src/SerializedGameData.cpp:267
267 /srv/jenkins/jobs/s25rttr/workspace/ARCH/x86_64/PLATFORM/linux/label/ma/src/SerializedGameData.cpp: No such file or directory.
(gdb) bt
#0 0x0000000000758175 in SerializedGameData::PushObject (this=0x7fffffffd370, go=0x7dce120, known=true) at /srv/jenkins/jobs/s25rttr/workspace/ARCH/x86_64/PLATFORM/linux/label/ma/src/SerializedGameData.cpp:267
@donSchoe
donSchoe / gist:3734775
Created September 16, 2012 23:06
broken pipe...
Program received signal SIGPIPE, Broken pipe.
0x00007ffff6bd182c in send () from /lib64/libc.so.6
(gdb) bt
#0 0x00007ffff6bd182c in send () from /lib64/libc.so.6
#1 0x000000000090611a in Socket::Send (this=<optimized out>, buffer=0x2f4ef80, length=8) at /srv/jenkins/jobs/s25rttr/workspace/ARCH/x86_64/PLATFORM/linux/label/ma/libutil/src/Socket.cpp:590
#2 0x0000000000910a2d in Message::send (this=<optimized out>, sock=0xc6cf58) at /srv/jenkins/jobs/s25rttr/workspace/ARCH/x86_64/PLATFORM/linux/label/ma/libutil/src/Message.cpp:55
#3 0x000000000090eff7 in MessageQueue::send (this=0xc6cf38, sock=0xc6cf58, max=10, sizelimit=512) at /srv/jenkins/jobs/s25rttr/workspace/ARCH/x86_64/PLATFORM/linux/label/ma/libutil/src/MessageQueue.cpp:142
#4 0x000000000068c6aa in GameClient::Run (this=0xc6cda0) at /srv/jenkins/jobs/s25rttr/workspace/ARCH/x86_64/PLATFORM/linux/label/ma/src/GameClient.cpp:263
#5 0x00000000006b9670 in GameManager::Run (this=0xc6c0a0) at /srv/jenkins/jobs/s25rttr/workspace/ARCH/x86_64/PLATFORM/linux/l
@donSchoe
donSchoe / gist:3734637
Created September 16, 2012 22:27
and one more time ...
Program received signal SIGSEGV, Segmentation fault.
0x000000000083080f in nobHarborBuilding::OrderExpeditionWares (this=0x7a027d0) at /srv/jenkins/jobs/s25rttr/workspace/ARCH/x86_64/PLATFORM/linux/label/ma/src/nobHarborBuilding.cpp:436
436 /srv/jenkins/jobs/s25rttr/workspace/ARCH/x86_64/PLATFORM/linux/label/ma/src/nobHarborBuilding.cpp: No such file or directory.
(gdb) bt
#0 0x000000000083080f in nobHarborBuilding::OrderExpeditionWares (this=0x7a027d0) at /srv/jenkins/jobs/s25rttr/workspace/ARCH/x86_64/PLATFORM/linux/label/ma/src/nobHarborBuilding.cpp:436
#1 0x000000000067f039 in EventManager::NextGF (this=0x79fbd80) at /srv/jenkins/jobs/s25rttr/workspace/ARCH/x86_64/PLATFORM/linux/label/ma/src/EventManager.cpp:126
#2 0x0000000000687316 in GameClient::NextGF (this=0xc6cda0) at /srv/jenkins/jobs/s25rttr/workspace/ARCH/x86_64/PLATFORM/linux/label/ma/src/GameClient.cpp:1439
#3 0x000000000069a9b0 in GameClient::ExecuteGameFrame_Game (this=<optimized out>) at /srv/jenkins/jobs/s25rttr/workspace/ARCH/x86_64/PL
@donSchoe
donSchoe / gist:3772346
Created September 23, 2012 17:19
SIGSEGV
Program received signal SIGSEGV, Segmentation fault.
0x00000000186f5af0 in ?? ()
(gdb) bt
#0 0x00000000186f5af0 in ?? ()
#1 0x00000000006e8a13 in GameWorldGame::DestroyPlayerRests (this=0x7c85cc8, x=<optimized out>, y=<optimized out>, new_player=1 '\001', exception=0x1561d8c0) at /srv/jenkins/jobs/s25rttr/workspace/ARCH/x86_64/PLATFORM/linux/label/ma/src/GameWorldGame.cpp:878
#2 0x00000000006f2ce9 in GameWorldGame::RecalcTerritory (this=0x7c85cc8, building=<optimized out>, radius=<optimized out>, destroyed=<optimized out>, newBuilt=<optimized out>)
at /srv/jenkins/jobs/s25rttr/workspace/ARCH/x86_64/PLATFORM/linux/label/ma/src/GameWorldGame.cpp:653
#3 0x0000000000832858 in nobMilitary::Capture (this=0x1561d8c0, new_owner=<optimized out>) at /srv/jenkins/jobs/s25rttr/workspace/ARCH/x86_64/PLATFORM/linux/label/ma/src/nobMilitary.cpp:869
#4 0x00000000008509a3 in nofAttacker::Walked (this=0x17106540) at /srv/jenkins/jobs/s25rttr/workspace/ARCH/x86_64/PLATFORM/linux/label/ma/src/nofAttacker.cpp:270
#5 0x0
@donSchoe
donSchoe / make.2d028e0.log
Last active October 22, 2015 18:00
webthree-umbrella fails against libboost 1.59
# webthree-umbrella @ 2d028e0 (1.0rc2)
==> Making package: ethereum 1.0rc2-1 (Thu Oct 22 17:50:56 CEST 2015)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Updating ethereum git repo...
Fetching origin
==> Validating source files with sha256sums...
ethereum ... Skipped