Top down rendering, partial commit

This commit is contained in:
nikolark committed 2014-05-26 00:48:13 +02:00
1 parent b3ee534138
commit 99fbe45b00
12 files changed
+1093 -167

No files matched your search

+44
View File
@@ -0,0 +1,44 @@
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
indoormap: {
// potential config here
},
autoprefixer: {
dist: {
files: {
'css/app.css': 'css/app.css'
}
},
},
sass: {
dist: {
options: {
outputStyle: 'compressed'
},
files: {
'css/app.css': 'scss/app.scss'
}
}
},
watch: {
sass: {
files: ['scss/*.scss'],
tasks: ['sass', 'autoprefixer'],
},
livereload: {
files: ['*.js', 'css/app.css'],
options: {
livereload: true
}
}
}
});
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
grunt.registerTask('build', ['sass']);
grunt.registerTask('default', ['build','watch']);
};
+2
View File
@@ -22,3 +22,5 @@
- Wireframe of room per floor tagged with name of room
- Highlight room by drawing color semitransparent glowing cube on tob of room floor
- Controller by query param and browser controls
# Ref: http://threejs.org/examples/#webgl_lines_colors
+1
View File
@@ -0,0 +1 @@
body,html{width:100%;height:100%;padding:0;margin:0;overflow:hidden;}canvas{width:100%;height:100%;}.debug #svg{position:absolute;top:0;bottom:0;left:0;right:0;width:100%;height:100%;}
+111 -154
View File
@@ -15,10 +15,10 @@
width="1000"
height="1000"
xml:space="preserve"
sodipodi:docname="neuf04_simplified_bare.svg"><metadata
sodipodi:docname="neuf04.svg"><metadata
id="metadata3010"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
id="defs3008" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
@@ -28,13 +28,13 @@
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1366"
inkscape:window-height="692"
inkscape:window-width="2560"
inkscape:window-height="1364"
id="namedview3006"
showgrid="false"
inkscape:zoom="1.4030467"
inkscape:cx="865.00952"
inkscape:cy="274.74306"
inkscape:zoom="0.99210384"
inkscape:cx="590.02819"
inkscape:cy="565.70539"
inkscape:window-x="0"
inkscape:window-y="24"
inkscape:window-maximized="1"
@@ -54,26 +54,20 @@
x="53.564445"
y="-158.08394"
inkscape:label="#rect10601"
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><g
transform="matrix(2.4289661,0,0,-2.4289661,-376.55422,980.35867)"
style="display:inline"
id="424"
inkscape:label="#g11406"><rect
transform="matrix(0.8,0,0,-0.8,0,595.276)"
y="145.57603"
x="208.83124"
height="52.653267"
width="12.561948"
id="rect11400"
style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><rect
ry="0"
transform="matrix(0.8,0,0,-0.8,0,595.276)"
y="145.39787"
x="221.30411"
height="12.740128"
width="40.09132"
id="rect11404"
style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><rect
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94317293;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="424_0"
width="24.410036"
height="102.3144"
x="29.240982"
y="-182.66714" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94317293;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="424_1"
width="77.904366"
height="24.756271"
x="53.477924"
y="-183.01334"
ry="0" /><rect
style="fill:none;stroke:#000000;stroke-width:1.9521215;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="450"
width="36.000183"
@@ -94,31 +88,20 @@
height="101.79505"
x="466.89041"
y="-185.09079"
inkscape:label="#rect11414" /><g
style="display:inline"
id="426"
transform="matrix(2.4059219,0,0,-2.4289661,-195.75846,1062.1318)"
inkscape:label="#g11557"><rect
inkscape:label="#rect11416"
transform="scale(1,-1)"
y="-513.16895"
x="336.41077"
height="27.369009"
width="59.299522"
id="asdf12313123"
style="fill:none;stroke:#000000;stroke-width:0.80000001;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><g
transform="translate(-70.703277,33.926169)"
inkscape:label="#g11537"
id="426a"><g
id="g6508"
transform="matrix(1,0,0,-1,0,595.276)" /><rect
style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="rect11535"
width="25.302063"
height="16.036528"
x="510.67438"
y="128.64861"
transform="matrix(0.8,0,0,-0.8,0,595.276)" /></g></g><rect
inkscape:label="#rect11414" /><rect
style="fill:none;stroke:#000000;stroke-width:1.93393326;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="426_0"
width="142.67001"
height="66.478394"
x="613.61957"
y="-184.33817"
inkscape:label="#rect11416" /><rect
y="-215.93556"
x="617.29871"
height="31.161745"
width="48.699829"
id="426_1"
style="fill:none;stroke:#000000;stroke-width:1.93393326;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><rect
style="fill:none;stroke:#000000;stroke-width:1.92631853;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="427"
width="76.190018"
@@ -181,25 +164,19 @@
height="71.325775"
x="685.02264"
y="474.84579"
inkscape:label="#rect11521" /><g
transform="matrix(2.4289661,0,0,-2.4289661,-376.55422,980.35867)"
style="display:inline"
id="432"
inkscape:label="#g11527"><rect
transform="matrix(0.8,0,0,-0.8,0,595.276)"
y="443.67731"
x="692.42169"
height="52.385998"
width="24.589346"
id="rect11523"
style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><rect
transform="matrix(0.8,0,0,-0.8,0,595.276)"
y="482.87772"
x="662.13049"
height="38.844028"
width="31.003958"
id="rect11525"
style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><rect
inkscape:label="#rect11521" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94317293;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="432_0"
width="47.781349"
height="101.79505"
x="968.94086"
y="396.59518" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94317293;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="432_1"
width="60.246052"
height="75.480667"
x="910.07983"
y="472.76834" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="402"
width="72.710747"
@@ -213,51 +190,43 @@
height="115.85214"
x="758.47394"
y="581.2832"
inkscape:label="#rect11436" /><g
id="438"
inkscape:label="#g14922"><rect
y="546.17163"
x="612.31195"
height="35.316593"
width="214.66977"
id="rect11507"
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline" /><rect
y="402.13504"
x="758.4259"
height="96.255173"
width="94.177734"
id="rect11509"
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><rect
y="477.61569"
x="852.60364"
height="21.466982"
width="58.168594"
id="rect11511"
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><rect
y="498.73642"
x="758.07959"
height="47.088917"
width="69.248306"
id="rect11597"
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><g
transform="matrix(2.4179901,0,0,-2.414943,-374.06504,978.73312)"
style="display:inline"
id="410"
inkscape:label="#g11464"><rect
transform="matrix(0.8,0,0,-0.8,0,595.276)"
y="537.96735"
x="232.83853"
height="43.342224"
width="39.058411"
id="rect11460"
style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><rect
transform="matrix(0.8,0,0,-0.8,0,595.276)"
y="581.05762"
x="205.11966"
height="17.639294"
width="77.864838"
id="rect11462"
style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><rect
inkscape:label="#rect11436" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="438_0"
width="214.66977"
height="35.316593"
x="612.31195"
y="546.17163" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="438_1"
width="94.177734"
height="96.255173"
x="758.4259"
y="402.13504" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="438_2"
width="58.168594"
height="21.466982"
x="852.60364"
y="477.61569" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="438_3"
width="69.248306"
height="47.088917"
x="758.07959"
y="498.73642" /><rect
style="fill:none;stroke:#000000;stroke-width:1.93317282;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="410_0"
width="75.554283"
height="83.735199"
x="76.335976"
y="580.50391" /><rect
style="fill:none;stroke:#000000;stroke-width:1.93317282;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="410_1"
width="150.62112"
height="34.078312"
x="22.716808"
y="663.75232" /><rect
style="fill:none;stroke:#000000;stroke-width:1.93530822;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="411"
width="53.380753"
@@ -278,25 +247,19 @@
height="78.540001"
x="195.37247"
y="580.31085"
inkscape:label="#rect11456" /><g
transform="matrix(2.4289661,0,0,-2.4289661,-376.55422,980.35867)"
style="display:inline"
id="408"
inkscape:label="#g11452"><rect
transform="matrix(0.8,0,0,-0.8,0,595.276)"
y="578.78967"
x="282.9845"
height="19.655201"
width="75.344933"
id="rect11448"
style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><rect
transform="matrix(0.8,0,0,-0.8,0,595.276)"
y="538.21936"
x="319.52301"
height="40.318382"
width="38.806419"
id="rect11450"
style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><rect
inkscape:label="#rect11456" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94317293;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="408_0"
width="146.40823"
height="38.193455"
x="173.33359"
y="659.14185" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94317293;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="408_1"
width="75.407585"
height="78.345589"
x="244.33423"
y="580.3067" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94428205;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="412"
width="589.30219"
@@ -359,25 +322,19 @@
height="205.65706"
x="22.518375"
y="141.57167"
inkscape:label="#rect11482" /><g
transform="matrix(2.4289661,0,0,-2.4289661,-376.55422,980.35867)"
style="display:inline"
id="415"
inkscape:label="#g11478"><rect
transform="matrix(0.8,0,0,-0.8,0,595.276)"
y="417.76825"
x="205.37164"
height="28.222853"
width="22.427088"
id="rect11474"
style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /><rect
transform="matrix(0.8,0,0,-0.8,0,595.276)"
y="429.35977"
x="227.54674"
height="16.127344"
width="32.50668"
id="rect11476"
style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /></g><rect
inkscape:label="#rect11482" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94317293;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="415_0"
width="43.579708"
height="54.841881"
x="22.518391"
y="346.24939" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94317293;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
id="415_1"
width="63.1661"
height="31.338219"
x="65.608437"
y="368.77371" /><rect
style="fill:none;stroke:#000000;stroke-width:1.94317281;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;display:inline"
id="414"
width="71.490303"

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 14 KiB

+506 -1
View File
@@ -1 +1,506 @@
{"rooms":[{"number":"447","pos":{"x":"53.564445","y":"-158.08394"},"size":{"height":"77.731247","width":"77.904381"}},{"number":"450","pos":{"x":"318.01108","y":"-185.0863"},"size":{"height":"69.93187","width":"36.000183"}},{"number":"448","pos":{"x":"354.71475","y":"-185.08415"},"size":{"height":"100.39677","width":"112.169"}},{"number":"423","pos":{"x":"466.89041","y":"-185.09079"},"size":{"height":"101.79505","width":"146.80646"}},{"number":"427","pos":{"x":"665.62469","y":"-230.11064"},"size":{"height":"45.028267","width":"76.190018"}},{"number":"437","pos":{"x":"756.34747","y":"-184.39943"},"size":{"height":"291.53769","width":"35.318886"}},{"number":["428","429"],"pos":{"x":"791.67664","y":"-184.38683"},"size":{"height":"146.09106","width":"117.69923"}},{"number":"430","pos":{"x":"793.05017","y":"-36.899376"},"size":{"height":"68.555847","width":"117.72215"}},{"number":"431","pos":{"x":"793.05017","y":"30.963974"},"size":{"height":"76.865646","width":"118.41465"}},{"number":"440","pos":{"x":"792.3576","y":"107.82961"},"size":{"height":"146.11398","width":"118.41465"}},{"number":"436","pos":{"x":"756.38678","y":"107.17565"},"size":{"height":"294.92099","width":"35.932209"}},{"number":"435","pos":{"x":"792.3576","y":"321.80695"},"size":{"height":"81.020546","width":"117.02967"}},{"number":"444","pos":{"x":"685.02264","y":"474.84579"},"size":{"height":"71.325775","width":"72.710747"}},{"number":"402","pos":{"x":"827.67426","y":"498.39026"},"size":{"height":"44.318932","width":"72.710747"}},{"number":"420","pos":{"x":"758.47394","y":"581.2832"},"size":{"height":"115.85214","width":"69.047668"}},{"number":"411","pos":{"x":"22.717258","y":"580.50562"},"size":{"height":"82.557472","width":"53.380753"}},{"number":"403","pos":{"x":"152.27817","y":"580.30676"},"size":{"height":"38.193451","width":"43.090046"}},{"number":"409","pos":{"x":"195.37247","y":"580.31085"},"size":{"height":"78.540001","width":"49.447254"}},{"number":"412","pos":{"x":"23.009211","y":"546.86469"},"size":{"height":"33.930614","width":"589.30219"}},{"number":"407","pos":{"x":"319.73325","y":"580.29822"},"size":{"height":"117.53546","width":"75.99839"}},{"number":"406","pos":{"x":"395.63904","y":"580.30676"},"size":{"height":"118.00798","width":"70.021324"}},{"number":"405","pos":{"x":"465.17068","y":"580.79633"},"size":{"height":"117.02865","width":"146.89789"}},{"number":"404","pos":{"x":"612.0686","y":"581.7757"},"size":{"height":"115.55968","width":"76.386887"}},{"number":"421","pos":{"x":"688.44983","y":"581.48309"},"size":{"height":"115.65492","width":"70.522224"}},{"number":"419","pos":{"x":"827.03021","y":"543.58331"},"size":{"height":"153.60759","width":"80.791679"}},{"number":"422","pos":{"x":"22.019121","y":"108.75488"},"size":{"height":"32.623585","width":"34.29538"}},{"number":"417","pos":{"x":"22.518375","y":"141.57167"},"size":{"height":"205.65706","width":"105.27682"}},{"number":"414","pos":{"x":"23.008051","y":"401.58087"},"size":{"height":"43.579708","width":"71.490303"}},{"number":"413","pos":{"x":"23.008051","y":"444.6709"},"size":{"height":"102.8285","width":"71.490265"}}]}
{
"rooms": [
{
"number": "447",
"position": {
"x": 32.507306,
"y": 106.53646
},
"dimensions": {
"height": "77.731247",
"width": "77.904381"
}
},
{
"number": "424",
"position": {
"x": 8.183843,
"y": 81.95326000000003
},
"dimensions": {
"height": "102.3144",
"width": "24.410036"
}
},
{
"number": "424",
"position": {
"x": 32.420785,
"y": 81.60706000000002
},
"dimensions": {
"height": "24.756271",
"width": "77.904366"
}
},
{
"number": "450",
"position": {
"x": 296.953941,
"y": 79.53410000000002
},
"dimensions": {
"height": "69.93187",
"width": "36.000183"
}
},
{
"number": "448",
"position": {
"x": 333.657611,
"y": 79.53625000000002
},
"dimensions": {
"height": "100.39677",
"width": "112.169"
}
},
{
"number": "423",
"position": {
"x": 445.83327099999997,
"y": 79.52961000000002
},
"dimensions": {
"height": "101.79505",
"width": "146.80646"
}
},
{
"number": "426",
"position": {
"x": 592.562431,
"y": 80.28223000000003
},
"dimensions": {
"height": "66.478394",
"width": "142.67001"
}
},
{
"number": "426",
"position": {
"x": 596.241571,
"y": 48.68484000000001
},
"dimensions": {
"height": "31.161745",
"width": "48.699829"
}
},
{
"number": "427",
"position": {
"x": 644.567551,
"y": 34.50976000000003
},
"dimensions": {
"height": "45.028267",
"width": "76.190018"
}
},
{
"number": "437",
"position": {
"x": 735.290331,
"y": 80.22097000000002
},
"dimensions": {
"height": "291.53769",
"width": "35.318886"
}
},
{
"number": [
"428",
"429"
],
"position": {
"x": 770.619501,
"y": 80.23357000000001
},
"dimensions": {
"height": "146.09106",
"width": "117.69923"
}
},
{
"number": "430",
"position": {
"x": 771.993031,
"y": 227.72102400000003
},
"dimensions": {
"height": "68.555847",
"width": "117.72215"
}
},
{
"number": "431",
"position": {
"x": 771.993031,
"y": 295.584374
},
"dimensions": {
"height": "76.865646",
"width": "118.41465"
}
},
{
"number": "440",
"position": {
"x": 771.300461,
"y": 372.45001
},
"dimensions": {
"height": "146.11398",
"width": "118.41465"
}
},
{
"number": "436",
"position": {
"x": 735.329641,
"y": 371.79605000000004
},
"dimensions": {
"height": "294.92099",
"width": "35.932209"
}
},
{
"number": "435",
"position": {
"x": 771.300461,
"y": 586.4273499999999
},
"dimensions": {
"height": "81.020546",
"width": "117.02967"
}
},
{
"number": "444",
"position": {
"x": 663.965501,
"y": 739.4661900000001
},
"dimensions": {
"height": "71.325775",
"width": "72.710747"
}
},
{
"number": "432",
"position": {
"x": 947.883721,
"y": 661.21558
},
"dimensions": {
"height": "101.79505",
"width": "47.781349"
}
},
{
"number": "432",
"position": {
"x": 889.022691,
"y": 737.3887400000001
},
"dimensions": {
"height": "75.480667",
"width": "60.246052"
}
},
{
"number": "402",
"position": {
"x": 806.617121,
"y": 763.01066
},
"dimensions": {
"height": "44.318932",
"width": "72.710747"
}
},
{
"number": "420",
"position": {
"x": 737.416801,
"y": 845.9036
},
"dimensions": {
"height": "115.85214",
"width": "69.047668"
}
},
{
"number": "438",
"position": {
"x": 591.254811,
"y": 810.7920300000001
},
"dimensions": {
"height": "35.316593",
"width": "214.66977"
}
},
{
"number": "438",
"position": {
"x": 737.368761,
"y": 666.75544
},
"dimensions": {
"height": "96.255173",
"width": "94.177734"
}
},
{
"number": "438",
"position": {
"x": 831.546501,
"y": 742.23609
},
"dimensions": {
"height": "21.466982",
"width": "58.168594"
}
},
{
"number": "438",
"position": {
"x": 737.022451,
"y": 763.35682
},
"dimensions": {
"height": "47.088917",
"width": "69.248306"
}
},
{
"number": "410",
"position": {
"x": 55.278837,
"y": 845.12431
},
"dimensions": {
"height": "83.735199",
"width": "75.554283"
}
},
{
"number": "410",
"position": {
"x": 1.659669000000001,
"y": 928.3727200000001
},
"dimensions": {
"height": "34.078312",
"width": "150.62112"
}
},
{
"number": "411",
"position": {
"x": 1.6601190000000017,
"y": 845.12602
},
"dimensions": {
"height": "82.557472",
"width": "53.380753"
}
},
{
"number": "403",
"position": {
"x": 131.22103099999998,
"y": 844.9271600000001
},
"dimensions": {
"height": "38.193451",
"width": "43.090046"
}
},
{
"number": "409",
"position": {
"x": 174.315331,
"y": 844.93125
},
"dimensions": {
"height": "78.540001",
"width": "49.447254"
}
},
{
"number": "408",
"position": {
"x": 152.27645099999998,
"y": 923.76225
},
"dimensions": {
"height": "38.193455",
"width": "146.40823"
}
},
{
"number": "408",
"position": {
"x": 223.27709099999998,
"y": 844.9271
},
"dimensions": {
"height": "78.345589",
"width": "75.407585"
}
},
{
"number": "412",
"position": {
"x": 1.9520720000000011,
"y": 811.48509
},
"dimensions": {
"height": "33.930614",
"width": "589.30219"
}
},
{
"number": "407",
"position": {
"x": 298.676111,
"y": 844.91862
},
"dimensions": {
"height": "117.53546",
"width": "75.99839"
}
},
{
"number": "406",
"position": {
"x": 374.581901,
"y": 844.9271600000001
},
"dimensions": {
"height": "118.00798",
"width": "70.021324"
}
},
{
"number": "405",
"position": {
"x": 444.113541,
"y": 845.41673
},
"dimensions": {
"height": "117.02865",
"width": "146.89789"
}
},
{
"number": "404",
"position": {
"x": 591.0114609999999,
"y": 846.3961
},
"dimensions": {
"height": "115.55968",
"width": "76.386887"
}
},
{
"number": "421",
"position": {
"x": 667.392691,
"y": 846.10349
},
"dimensions": {
"height": "115.65492",
"width": "70.522224"
}
},
{
"number": "419",
"position": {
"x": 805.973071,
"y": 808.20371
},
"dimensions": {
"height": "153.60759",
"width": "80.791679"
}
},
{
"number": "422",
"position": {
"x": 0.961981999999999,
"y": 373.37528000000003
},
"dimensions": {
"height": "32.623585",
"width": "34.29538"
}
},
{
"number": "417",
"position": {
"x": 1.4612359999999995,
"y": 406.19207000000006
},
"dimensions": {
"height": "205.65706",
"width": "105.27682"
}
},
{
"number": "415",
"position": {
"x": 1.4612520000000018,
"y": 610.86979
},
"dimensions": {
"height": "54.841881",
"width": "43.579708"
}
},
{
"number": "415",
"position": {
"x": 44.551297999999996,
"y": 633.39411
},
"dimensions": {
"height": "31.338219",
"width": "63.1661"
}
},
{
"number": "414",
"position": {
"x": 1.9509119999999989,
"y": 666.20127
},
"dimensions": {
"height": "43.579708",
"width": "71.490303"
}
},
{
"number": "413",
"position": {
"x": 1.9509119999999989,
"y": 709.2913000000001
},
"dimensions": {
"height": "102.8285",
"width": "71.490265"
}
}
],
"dimensions": {
"width": "1000",
"heigh": "1000"
}
}
+7 -3
View File
@@ -4,10 +4,14 @@
<title>Indoor map of Chateau Neuf</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--<link rel="stylesheet" href="style.css" type="text/css">-->
<script src="bundle.js"></script>
<link rel="stylesheet" href="css/app.css" type="text/css">
</head>
<body>
<body class="debug">
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="node_modules/three/three.js"></script>
<script src="index.js"></script>
<img id="svg" src="data/neuf04.svg">
<div class="map"></div>
</body>
</html>
+69
View File
@@ -0,0 +1,69 @@
var cubes = [];
var scene = new THREE.Scene();
//var sceneWidth = 1000;
//var sceneHeight = 1000;
var sceneWidth = window.innerWidth;
var sceneHeight = window.innerHeight;
var camera = new THREE.PerspectiveCamera( 75, sceneHeight / sceneWidth, 0.1, 2500 );
var renderer = new THREE.WebGLRenderer({ alpha: true});
renderer.setSize(sceneWidth, sceneHeight);
document.body.appendChild( renderer.domElement );
// material
var green_color = 0x00ff00;
var red_color = 0xff0000;
var material = new THREE.MeshBasicMaterial( { color: green_color, wireframe: true } );
var red_material = new THREE.MeshBasicMaterial( { color: red_color, wireframe: true } );
function render() {
var i = 0;
requestAnimationFrame(render);
for(i=0; i<scene.children.length; i++) {
var cube = scene.children[i];
//cube.rotation.z += 0.01;
}
renderer.render(scene, camera);
}
function onRoomData(data) {
var i = 0;
var rooms = data.rooms;
for(i=0; i<rooms.length; i++) {
var room = rooms[i];
var cube;
// geometry
var geometry = new THREE.PlaneGeometry(room.dimensions.width, room.dimensions.height);
if(typeof room.number == "object" && (room.number.indexOf("428") > -1 || room.number.indexOf("429") > -1) ) {
// KAK
cube = new THREE.Mesh( geometry, red_material );
} else {
cube = new THREE.Mesh( geometry, material );
}
cube.position.x = room.position.x;
cube.position.y = room.position.y * -1; // FIXME why flipped?
cube.name = room.number;
cubes.push(cube);
scene.add( cube );
}
camera.position.z = 1000;
camera.position.x = 500;
camera.position.y = -500;
//camera.lookAt(scene.position);
//camera.rotation.z = -270 * (Math.PI / 180);
render();
}
// load rooms
$.getJSON("/data/rooms.json", onRoomData);
+8
View File
@@ -12,5 +12,13 @@
"three": "~0.66.2",
"libxml-to-js": "~0.3.11",
"brfs": "~1.1.1"
},
"devDependencies": {
"node-sass": "latest",
"grunt": "latest",
"grunt-autoprefixer": "latest",
"grunt-contrib-watch": "latest",
"grunt-sass": "latest",
"matchdep": "latest"
}
}
+25 -9
View File
@@ -2,7 +2,8 @@
var util = require("util"),
fs = require("fs"),
parser = require('libxml-to-js');
parser = require('libxml-to-js'),
utils = require("./utils");
var xml = fs.readFileSync(__dirname + "/data/neuf04.svg", "utf-8");
parser(xml, function (err, result) {
@@ -13,27 +14,42 @@ parser(xml, function (err, result) {
// rooms
var g = result.g.rect;
var transform = result.g['@'].transform;
console.log(transform);
//translate(-21.057139,264.6204)
var translateX = -21.057139;
var translateY = 264.6204;
var rooms = [];
Object.keys(g).forEach(function(key) {
var r = g[key]['@'];
var number = r.id;
// more than one room number per shape?
if(r.id.indexOf(',') > -1) {
number = r.id.split(",");
}
rooms.push({
// more than one shape per room number?
if(r.id.indexOf('_') > -1) {
number = r.id.split("_")[0];
}
// TODO adjust position to top left instead of center
// ie. find vector from center to top left corner
var room = {
number: number,
pos: {
x: r.x,
y: r.y
position: {
x: parseFloat(r.x) + translateX,
y: parseFloat(r.y) + translateY
},
size: {
dimensions: {
height: r.height,
width: r.width,
}
});
};
//utils.applySVGTransform(room, transform);
console.log(room);
rooms.push(room);
});
var data = {rooms: rooms, dimensions: { width: width, heigh: height}};
fs.writeFileSync(__dirname + "/data/rooms.json", JSON.stringify({rooms: rooms}), "utf-8");
fs.writeFileSync(__dirname + "/data/rooms.json", JSON.stringify(data, null, 4), "utf-8");
});
+22
View File
@@ -0,0 +1,22 @@
body,
html
{
width: 100%;
height: 100%;
padding: 0;
margin: 0;
overflow: hidden;
}
canvas {
width: 100%;
height: 100%;
}
.debug #svg{
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
width: 100%;
height: 100%;
}
+9
View File
@@ -0,0 +1,9 @@
var express = require('express'),
http = require('http');
var app = express()
.use(express.logger('dev'))
.use("/", express.static(__dirname));
console.log("http://localhost:3000");
http.createServer(app).listen(3000);
+289
View File
@@ -0,0 +1,289 @@
/* From https://github.com/asutherland/d3-threeD/blob/master/lib/d3-threeD.js
* ...Which might be useful in the future
* Ref: http://www.smartjava.org/content/render-geographic-information-3d-threejs-and-d3js
*/
const DEGS_TO_RADS = Math.PI / 180,
UNIT_SIZE = 100;
const DIGIT_0 = 48, DIGIT_9 = 57, COMMA = 44, SPACE = 32, PERIOD = 46,
MINUS = 45;
function transformSVGPath(pathStr) {
var path = new THREE.Shape();
var idx = 1, len = pathStr.length, activeCmd,
x = 0, y = 0, nx = 0, ny = 0, firstX = null, firstY = null,
x1 = 0, x2 = 0, y1 = 0, y2 = 0,
rx = 0, ry = 0, xar = 0, laf = 0, sf = 0, cx, cy;
function eatNum() {
var sidx, c, isFloat = false, s;
// eat delims
while (idx < len) {
c = pathStr.charCodeAt(idx);
if (c !== COMMA && c !== SPACE)
break;
idx++;
}
if (c === MINUS)
sidx = idx++;
else
sidx = idx;
// eat number
while (idx < len) {
c = pathStr.charCodeAt(idx);
if (DIGIT_0 <= c && c <= DIGIT_9) {
idx++;
continue;
}
else if (c === PERIOD) {
idx++;
isFloat = true;
continue;
}
s = pathStr.substring(sidx, idx);
return isFloat ? parseFloat(s) : parseInt(s);
}
s = pathStr.substring(sidx);
return isFloat ? parseFloat(s) : parseInt(s);
}
function nextIsNum() {
var c;
// do permanently eat any delims...
while (idx < len) {
c = pathStr.charCodeAt(idx);
if (c !== COMMA && c !== SPACE)
break;
idx++;
}
c = pathStr.charCodeAt(idx);
return (c === MINUS || (DIGIT_0 <= c && c <= DIGIT_9));
}
var canRepeat;
activeCmd = pathStr[0];
while (idx <= len) {
canRepeat = true;
switch (activeCmd) {
// moveto commands, become lineto's if repeated
case 'M':
x = eatNum();
y = eatNum();
path.moveTo(x, y);
activeCmd = 'L';
break;
case 'm':
x += eatNum();
y += eatNum();
path.moveTo(x, y);
activeCmd = 'l';
break;
case 'Z':
case 'z':
canRepeat = false;
if (x !== firstX || y !== firstY)
path.lineTo(firstX, firstY);
break;
// - lines!
case 'L':
case 'H':
case 'V':
nx = (activeCmd === 'V') ? x : eatNum();
ny = (activeCmd === 'H') ? y : eatNum();
path.lineTo(nx, ny);
x = nx;
y = ny;
break;
case 'l':
case 'h':
case 'v':
nx = (activeCmd === 'v') ? x : (x + eatNum());
ny = (activeCmd === 'h') ? y : (y + eatNum());
path.lineTo(nx, ny);
x = nx;
y = ny;
break;
// - cubic bezier
case 'C':
x1 = eatNum(); y1 = eatNum();
case 'S':
if (activeCmd === 'S') {
x1 = 2 * x - x2; y1 = 2 * y - y2;
}
x2 = eatNum();
y2 = eatNum();
nx = eatNum();
ny = eatNum();
path.bezierCurveTo(x1, y1, x2, y2, nx, ny);
x = nx; y = ny;
break;
case 'c':
x1 = x + eatNum();
y1 = y + eatNum();
case 's':
if (activeCmd === 's') {
x1 = 2 * x - x2;
y1 = 2 * y - y2;
}
x2 = x + eatNum();
y2 = y + eatNum();
nx = x + eatNum();
ny = y + eatNum();
path.bezierCurveTo(x1, y1, x2, y2, nx, ny);
x = nx; y = ny;
break;
// - quadratic bezier
case 'Q':
x1 = eatNum(); y1 = eatNum();
case 'T':
if (activeCmd === 'T') {
x1 = 2 * x - x1;
y1 = 2 * y - y1;
}
nx = eatNum();
ny = eatNum();
path.quadraticCurveTo(x1, y1, nx, ny);
x = nx;
y = ny;
break;
case 'q':
x1 = x + eatNum();
y1 = y + eatNum();
case 't':
if (activeCmd === 't') {
x1 = 2 * x - x1;
y1 = 2 * y - y1;
}
nx = x + eatNum();
ny = y + eatNum();
path.quadraticCurveTo(x1, y1, nx, ny);
x = nx; y = ny;
break;
// - elliptical arc
case 'A':
rx = eatNum();
ry = eatNum();
xar = eatNum() * DEGS_TO_RADS;
laf = eatNum();
sf = eatNum();
nx = eatNum();
ny = eatNum();
if (rx !== ry) {
console.warn("Forcing elliptical arc to be a circular one :(",
rx, ry);
}
// SVG implementation notes does all the math for us! woo!
// http://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes
// step1, using x1 as x1'
x1 = Math.cos(xar) * (x - nx) / 2 + Math.sin(xar) * (y - ny) / 2;
y1 = -Math.sin(xar) * (x - nx) / 2 + Math.cos(xar) * (y - ny) / 2;
// step 2, using x2 as cx'
var norm = Math.sqrt(
(rx*rx * ry*ry - rx*rx * y1*y1 - ry*ry * x1*x1) /
(rx*rx * y1*y1 + ry*ry * x1*x1));
if (laf === sf)
norm = -norm;
x2 = norm * rx * y1 / ry;
y2 = norm * -ry * x1 / rx;
// step 3
cx = Math.cos(xar) * x2 - Math.sin(xar) * y2 + (x + nx) / 2;
cy = Math.sin(xar) * x2 + Math.cos(xar) * y2 + (y + ny) / 2;
var u = new THREE.Vector2(1, 0),
v = new THREE.Vector2((x1 - x2) / rx,
(y1 - y2) / ry);
var startAng = Math.acos(u.dot(v) / u.length() / v.length());
if (u.x * v.y - u.y * v.x < 0)
startAng = -startAng;
// we can reuse 'v' from start angle as our 'u' for delta angle
u.x = (-x1 - x2) / rx;
u.y = (-y1 - y2) / ry;
var deltaAng = Math.acos(v.dot(u) / v.length() / u.length());
// This normalization ends up making our curves fail to triangulate...
if (v.x * u.y - v.y * u.x < 0)
deltaAng = -deltaAng;
if (!sf && deltaAng > 0)
deltaAng -= Math.PI * 2;
if (sf && deltaAng < 0)
deltaAng += Math.PI * 2;
path.absarc(cx, cy, rx, startAng, startAng + deltaAng, sf);
x = nx;
y = ny;
break;
default:
throw new Error("weird path command: " + activeCmd);
}
if (firstX === null) {
firstX = x;
firstY = y;
}
// just reissue the command
if (canRepeat && nextIsNum())
continue;
activeCmd = pathStr[idx++];
}
return path;
}
function applySVGTransform(obj, tstr) {
var idx = tstr.indexOf('('), len = tstr.length,
cmd = tstr.substring(0, idx++);
function eatNum() {
var sidx, c, isFloat = false, s;
// eat delims
while (idx < len) {
c = tstr.charCodeAt(idx);
if (c !== COMMA && c !== SPACE)
break;
idx++;
}
if (c === MINUS)
sidx = idx++;
else
sidx = idx;
// eat number
while (idx < len) {
c = tstr.charCodeAt(idx);
if (DIGIT_0 <= c && c <= DIGIT_9) {
idx++;
continue;
}
else if (c === PERIOD) {
idx++;
isFloat = true;
continue;
}
s = tstr.substring(sidx, idx);
return isFloat ? parseFloat(s) : parseInt(s);
}
s = tstr.substring(sidx);
return isFloat ? parseFloat(s) : parseInt(s);
}
switch (cmd) {
case 'translate':
obj.position.x = Math.floor(eatNum());
obj.position.y = Math.floor(eatNum());
//obj.position.x = Math.floor(eatNum() * UNIT_SIZE);
//obj.position.y = Math.floor(eatNum() * UNIT_SIZE);
//console.log("translated:", obj.position.x, obj.position.y);
break;
case 'scale':
obj.scale.x = Math.floor(eatNum() * UNIT_SIZE);
obj.scale.y = Math.floor(eatNum() * UNIT_SIZE);
break;
default:
console.warn("don't understand transform", tstr);
break;
}
}
exports.transformSVGPath = transformSVGPath;
exports.applySVGTransform = applySVGTransform;