<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jonas Tillman on Medium]]></title>
        <description><![CDATA[Stories by Jonas Tillman on Medium]]></description>
        <link>https://medium.com/@jonas-tillman?source=rss-524af79f1bec------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*uspIzNMOD6e-Xmbvn6D4IQ.jpeg</url>
            <title>Stories by Jonas Tillman on Medium</title>
            <link>https://medium.com/@jonas-tillman?source=rss-524af79f1bec------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 18:39:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jonas-tillman/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Case Study: Moving a static Corporate Identity design document to the Web]]></title>
            <link>https://jonas-tillman.medium.com/case-study-moving-a-static-corporate-identity-design-document-to-the-web-107f69cf0c3b?source=rss-524af79f1bec------2</link>
            <guid isPermaLink="false">https://medium.com/p/107f69cf0c3b</guid>
            <category><![CDATA[svg-animation]]></category>
            <category><![CDATA[website-design]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Jonas Tillman]]></dc:creator>
            <pubDate>Sun, 20 Jun 2021 04:56:11 GMT</pubDate>
            <atom:updated>2021-06-22T03:02:57.439Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oTyCE2M52hvOVQTNCvDo0w.png" /></figure><h4>You have received some styling guidelines and some content —now what?!</h4><h3>Starting Point</h3><p>When asked to create the static site <a href="https://grootdillionsholding.com/">https://grootdillionsholding.com/</a> the main challenge was to create a coherent feeling from the very good design tests provided.</p><p>This case study will show some of those design decisions.</p><h3>Starting Point</h3><h4>1) Design Input</h4><p>A professional designer had provided a corporate identity design draft and a powerpoint template, with a flat, colourful design, expressing some playfulness and quirkiness.</p><h4><strong>CI (Palette, logo, typography, design tests):</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fkwmh8Y-aL1TZL8oWKjKDA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oeMCXJqXv9TWCDJUekUU4Q.png" /></figure><h4>Powerpoint template:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6ZT-vpMopzHsQnuKC_d75A.png" /></figure><h4>2) Copy, page map and assets</h4><p>A number of standard pages were requested from the company. Nothing terribly important to mention, apart from that the portrait shots were lacking coherency, as the people had not been able to gather due to COVID-19.</p><p>It was also noted that many of the smaller consultancy pages are quite boring. Not to point any company out, but you can Google “consultancy”... The standard page types were not really what the designer had aimed for with the company identity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EqjFaqfoV4enRb-WlgJVSw.png" /></figure><h3>Box “Models”</h3><p>From the powerpoint the first box model was created, trying to connect one or more vertically stacked sections. This was heavily reliant on CSS pseudo-elements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i0ny74A4QloRUvpnMDh8LA.png" /></figure><p>Another box model that is heavily used is having a “frame” and background that is slightly offset to give a stacked, yet flat feeling. Not really taken from the design materials directly, but generally in line with the feeling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CChEo5yCd2tw1IIoHrNkAg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*2x4WyqT42k816jh84ghb1w.png" /></figure><h3>SVG Animations (“Headers”)</h3><p>The original design had some really good header materials that I wanted to keep, but instead of only having static image or SVG background, some animation to guide the user down through the page was introduced.</p><h4>Original:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fkwmh8Y-aL1TZL8oWKjKDA.png" /></figure><h4>Low framerate GIF of <a href="https://grootdillionsholding.com/services.html">this page</a>:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*iqyRV1nLO5cSdJTkO41sVw.gif" /></figure><h3>Team profile photo coherency</h3><p>The material provided by the company was a bit incoherent in terms of the backgrounds:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EqjFaqfoV4enRb-WlgJVSw.png" /></figure><p>The idea was to make use of the corporate identity palette to improve this.</p><p>Step 1: <br>Remove the backgrounds and export as PNG</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fIVwqrxdIi8CAAPSTMrYBw.png" /></figure><p>Step 2:<br>Introduce backgrounds, animate on hover, and make sure the colour carries over to a modal on click (static and gif below)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rZ7WzKpU9H-Cw55xjIVVQg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*EH0hy4yPLrKdeLacEqDIxA.gif" /></figure><h3>Browser compatibility</h3><p>Browser compatibility is clearly not as major an issue as it used to be (I remember the IE 8 days…).</p><p>IE 11 was not in scope so the most needed part was to work on the weirdest of small bugs in Safari/WebKit (on iPhone any browser used will have the behaviour as they all have to use WebKit).</p><p>One of a few CSS fixes targeting only Safari: This animation had to be disabled for Safari as I couldn’t find a way to solve it (it is not SVG path stroke-linecap being rounded).</p><p>If anyone have any suggestions of what the issue could be — I’m all ears 😅</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*COR6I4fuiXYC9p3Iun3qAw.png" /></figure><h3>Aside — How created</h3><p>No needing anything fancy, just making sure there was a way to reduce duplication, and not a lot of build steps.</p><p><strong>Markup: </strong>Pug<br><strong>Styling:</strong> SASS/SCSS<br><strong>Javascript:</strong> Plain vanilla JS<br><strong>Build:</strong> Parcel, pre-update to version 2<br><strong>Deploy:</strong> AWS (S3 [storage], API gateway [lambda connected restful API], Lambda [email sending functionality], SES [email service], Cloudfront [CDN and HTTPS certificate management], Route 53 [DNS after moving over from. Namecheap])<br>+ Lots and lots of SVGs</p><p>At the time of writing some things that could be improved a bit: <br>Some awkward spacing on mobile and some font size changes needed, some text/spelling updates, one or two slightly warped SVGs on mobile screens.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=107f69cf0c3b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Going through Docker-hell (once)]]></title>
            <link>https://gopensource.com/going-through-docker-hell-once-243199d6f7a1?source=rss-524af79f1bec------2</link>
            <guid isPermaLink="false">https://medium.com/p/243199d6f7a1</guid>
            <category><![CDATA[containerization]]></category>
            <category><![CDATA[reproducibility]]></category>
            <category><![CDATA[struggle]]></category>
            <category><![CDATA[dockerfiles]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Jonas Tillman]]></dc:creator>
            <pubDate>Sun, 11 Apr 2021 05:47:14 GMT</pubDate>
            <atom:updated>2021-04-12T14:32:54.804Z</atom:updated>
            <content:encoded><![CDATA[<h3>Going Through Docker-hell</h3><h4>…so that no-one else have to follow</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p0EwjUnTExHsSgdLKddmEA.png" /></figure><p>Reproducability is key in academic research. 👨‍🎓</p><p>Yet, having someone setting up their environment to match what I have on my Mac to be able to work properly would take a few hours, and then would result in libraries installed globally and so on = not fun 🤯</p><p><strong>Docker to the rescue?</strong></p><p>Most tutorials (the one that comes with Docker-download, <a href="https://www.youtube.com/watch?v=fqMOX6JJhGo">youtube-tutorial</a>, some R-specific ones: <a href="http://ropenscilabs.github.io/r-docker-tutorial/">1</a>, <a href="https://www.r-bloggers.com/2019/02/running-your-r-script-in-docker/">2</a>, <a href="https://www.cascadia-analytics.com/2018/07/21/docker-r-p1.html">3</a>, <a href="https://jlintusaari.net/how-to-compile-r-markdown-documents-using-docker/">4</a>) and guides tell you a very neat story. <strong>This is not that. </strong>But this may be similar to what you may expect at some point.</p><h3>TL;DR</h3><p>Setting up Docker to work well with an existing project with complex versioning of packages can be frustrating.</p><p>The goal is to only do it once, this is the story of one such winding process to make it work.</p><p>It involves LaTeX-surprises, font-not-included-errors, interactive approval of font-installation, […], and in the end the new Apple M1-chip surprises</p><h3>The end goal:</h3><p>With 1 or 2 commands, have anyone being able to fulfil a few use cases:</p><ol><li>Opening up and generate thesis-PDF in R studio 💪</li><li>Opening Rstudio with the raw and semi-processed data interactively 💪</li><li>In one command generate PDF-output to the local machine running Docker 💪</li></ol><p>For this, there is a need to:</p><ol><li>Set up a base image, see what add-ons are needed for making it work on Linux (trial and error phase)</li><li>Save that working “snapshot” as an image and push it to a remote repository</li><li>Write a new Dockerfile that can be included in repo and fulfil the use cases. It should be pre-packaged with versions of R-packages that are known to work, and a Rmarkdown/Bookdown setup with the right LaTeX-packages included.</li></ol><p>Sounds simple? We’ll see…</p><h3>Restraints</h3><ul><li>I do not want to clean up the folder structure too much</li><li>Maybe just remove some unused R-packages that was not used in the current automated analysis for the thesis</li></ul><p>If this means that the Docker-setup will not be super clean. That is okay. I will not care if the Docker-image in the end is big, as long as it works.</p><p>This walk-through should make you feel okay that the tutorial-view is not what you are experiencing.</p><h3>Step 1: Finding a base image</h3><p>I need R, Rmarkdown, Rstudio, Some LaTeX for all to work out of the box</p><p>The Rocker-project <a href="https://github.com/rocker-org/rocker">https://github.com/rocker-org/rocker</a> seems to have what I need.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tI5JkA3o8_iAT1sqfyjxPg.png" /></figure><p>Simply create a Dockerfile using the verse and fixing the version</p><p><strong>COPY</strong>: all from directory to test it within the container</p><p>Setting <strong>WORKDIR</strong>, and <strong>RUN</strong>ning a script to install some packages I expected to be used and setting the repository to install packages from.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4a19e1f13ee79096dd291aa94bd4d3ca/href">https://medium.com/media/4a19e1f13ee79096dd291aa94bd4d3ca/href</a></iframe><p>(I know this will be a intermediary image very likely, so placed in subfolder <em>docker-baseimage</em>), and giving it a tag (test-markdown)</p><pre>$ docker build -t test-rmarkdown -f docker-baseimage/Dockerfile .</pre><p>Worked smoothly, let’s try to open it up following Rocker-documentation</p><p>Command and some flags:</p><pre>$ docker run --rm -p 8787:8787 -e DISABLE_AUTH=true test-rmarkdown</pre><pre><strong>--rm</strong> :=: remove container when closed<br><strong>-p 8787:8787</strong> :=: the Rocker images exposes port 8787, mapping to the same port on the host machine<br><strong>-e DISABLE_AUTH=true</strong> <strong>:=: </strong>Don&#39;t want to authenticate in Rstudio every time running this</pre><p>Again, so far success all the way, opening up localhost:8787 in a browser gives this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TNlHgDKR03OWNo6ji3VImQ.png" /></figure><p>Brilliant! Let’s open the Rmarkdown file (basically what pulls in code, data, with the text of the thesis and generates the PDF-output)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/258/1*gOTqX8h3yWU4KgRLz3t3nQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*gQAGXW09t_z2asCEii1tgA.png" /></figure><p>Then when the file is open, trying to knit it to the PDF</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OskiLQa8Ap49tMbPjO_1sg.png" /></figure><p>Nope… we’ll need some more packages</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/518/1*aa1ka4jUgNfIdmXT2Ubi4w.png" /></figure><p>Okay, let’s install that then… try knitting again</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OJvEoID1IWi8_Ds5clYuRQ.png" /></figure><p>Okay, an error. Seems like no write permissions (there are many intermediary files created)</p><h3>Step 2: Trying again</h3><ol><li>Updating the R-script to also install some more packages that had to be done in the session before</li></ol><pre>options(repos = c(CRAN=&quot;https://cloud.r-project.org&quot;))</pre><pre>...</pre><pre>install.packages(&quot;rmarkdown&quot;)</pre><pre>install.packages(&quot;xfun&quot;)</pre><p>2. Updating the Dockerfile to quick-and-dirty create all kinds of access (Last line)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7597fe7928228a8c46edbf95fb78e0a3/href">https://medium.com/media/7597fe7928228a8c46edbf95fb78e0a3/href</a></iframe><p>3. Rerun build and start new container</p><pre>$ docker build -t test-rmarkdown -f docker-baseimage/Dockerfile .<br>$ docker run --rm -p 8787:8787 -e DISABLE_AUTH=true test-rmarkdown</pre><p>4. Works, trying to knit it again</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OskiLQa8Ap49tMbPjO_1sg.png" /></figure><p>5. Another error… christ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cDMP7ugV2GjXeyRj4oasDg.png" /></figure><p>So, getting tired of this, let’s pick another image and install what is needed instead</p><h3>Step 3: Trying again with new image</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tI5JkA3o8_iAT1sqfyjxPg.png" /></figure><p>So, one step down, let’s do the one that does not have LaTeX in there: <strong>rocker/tidyverse</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/05aa1df218b553335dfe3917c79b33b6/href">https://medium.com/media/05aa1df218b553335dfe3917c79b33b6/href</a></iframe><p>Then, did need to get some stuff working (adding bookdown and tinytex-packages to the init.R-script)</p><p>And then with new build image running — trying to knit it aaaagain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*naS5s3qhWMSBcrmpJ19s1Q.png" /></figure><p>Okay, so I did end up having to switch from the default LaTeX engine at some point, need to install that I guess, add it to Docker-file (see line 7):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bbac9e97ab1b0856b7600d61b9d8b207/href">https://medium.com/media/bbac9e97ab1b0856b7600d61b9d8b207/href</a></iframe><p>Docker build, docker run… let’s see… knitting…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PoRyYHGgoW8tHhxYzm4AoA.png" /></figure><p>😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡😡</p><p>Some Googling to be done I guess…</p><h3>Step 4: Font-not-so-awesome</h3><p>So, the instructions for my thesis said specifically that Times New Roman had to be the font used.</p><p>Some googling and testing the found command below interactively in the container</p><pre>apt-get install ttf-mscorefonts-installer</pre><p>One way of doing this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dbnZDx2lowgIq0oQHUcZCw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*458WQBYC0xmfEEI73WwaTA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*pidmhoJtfm3rgrWGq8n46Q.png" /></figure><p>Trying to knit</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dbYaZ2ib7pBPODIR6IKIgA.png" /></figure><p><strong>IT WORKS!!!</strong></p><p>So let’s add that to the Dockerfile (9th line)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/47ee38703ca67cf43ad54f2b02e09369/href">https://medium.com/media/47ee38703ca67cf43ad54f2b02e09369/href</a></iframe><p>Trying to build and run again…</p><p>Ooops, that one needs to be interactive</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KOqJ8wZezacxZW2L7rOxHA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-DzIxzc3AlOJuCYwfiUuiA.gif" /></figure><p>I could maybe get some bash-magic to make this work, but let’s get to a snapshot interactively and commit that to Dockerhub instead…</p><p>This is getting a bit tiresome by now.</p><h3>Step 5: Get to snapshot that works and commit</h3><p>Removing the font-download from Dockerfile again.</p><p>Also, getting close, so let’s check the Rocker-project best practices for extending images</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q8VJBBs709YaaJcRHBISyA.png" /></figure><p>AND, don’t want to copy in all the files using the <strong>COPY</strong>-command anymore</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dd100911d1d02d128017cafcd55f95fa/href">https://medium.com/media/dd100911d1d02d128017cafcd55f95fa/href</a></iframe><p>Building, running, getting in there interactively and installing the fonts</p><pre>$ docker run -it --rm --name snapshot-to-be-commited test-rmarkdown bash</pre><pre>---&gt; IN THERE ----&gt;<br>$ apt-get install ttf-mscorefonts-installer</pre><p>(SOME LOCAL TESTING DONE; NOT INCLUDED)</p><p>Signing up to dockerhub, logging into the command line</p><pre>$ docker login --username=jonastillman</pre><p>From another terminal window, committing the image that is running WITH the font, and push it</p><pre>$ docker tag snapshot-to-be-commited jonastillman/tillman-thesis:0.1.0</pre><pre>$ docker push jonastillman/tillman-thesis:0.1.0</pre><h3>Step 5: Testing if works</h3><p>The remote exists, with so many issues, need to check if it works properly</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pAm7CnhWth66ZO7fAfTGUg.png" /></figure><p>Remove all things locally</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oYl86sNDs8sQiNY8MrVUIQ.png" /></figure><p>also to remove all kinds of caching that is there, why not also do</p><pre>$ docker system prune -a</pre><p>Create a new Dockerfile (this time it will be the main Dockerfile, so it is in the root of the project)</p><p>Checking the rocker setup how the Rstudio is started at init shows that <strong>CMD [“/init”]</strong> is at the bottom of their Dockerfiles.</p><p>Now this is much cleaner. Only copying in what is needed to the container.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e3afb0422757f7b9d8fdb9daa5ea66df/href">https://medium.com/media/e3afb0422757f7b9d8fdb9daa5ea66df/href</a></iframe><p>When building this time not needing to point to another Dockerfile</p><pre>$ docker build -t thesis-local .</pre><p>Pulls everything down as hoped for</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bqkjwcZYxGjvWkwgXoNOPg.png" /></figure><p>Running this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sWAmA3oZVUf-F4Yd-VzftQ.png" /></figure><ul><li>Opening up localhost:8787 and knitting — WORKS!!!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dbYaZ2ib7pBPODIR6IKIgA.png" /></figure><h4>Can fulfill the usecases?</h4><ul><li>Interactively generate PDF in Rstudio container (above)<strong> = YES</strong></li><li>Generate PDF in one-liner (-v mounts a folder on local machine where PDF is written to)</li></ul><pre>$ docker run -it — rm -v $PWD/pdf-output:/home/rstudio/pdf-output thesis-local Rscript -e “rmarkdown::render(‘./thesis-writeup/thesis-writeup.Rmd’, output_file = ‘tillman_thesis.pdf’, output_dir = ‘./pdf-output’)”</pre><p>Look! it’s not on my machine! Mission accomplished! <strong>= YES</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Olq7UuBDqKAHLhlp3bYhYg.png" /></figure><ul><li>Can load in the raw data yourself from Rstudio interactive session <strong>= YES</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9tcYHnTsLosB3NHYoyTqtQ.png" /></figure><ul><li>Can do the same thing from the command line <strong>= YES</strong></li></ul><pre>#Opening R in a command line window<br><strong>$ docker run -it --rm  thesis-local R</strong></pre><pre>R version 4.0.4 (2021-02-15) -- &quot;Lost Library Book&quot;<br>Copyright (C) 2021 The R Foundation for Statistical Computing<br>Platform: x86_64-pc-linux-gnu (64-bit)</pre><pre>R is free software and comes with ABSOLUTELY NO WARRANTY.<br>You are welcome to redistribute it under certain conditions.<br>Type &#39;license()&#39; or &#39;licence()&#39; for distribution details.</pre><pre>R is a collaborative project with many contributors.<br>Type &#39;contributors()&#39; for more information and<br>&#39;citation()&#39; on how to cite R or R packages in publications.</pre><pre>Type &#39;demo()&#39; for some demos, &#39;help()&#39; for on-line help, or<br>&#39;help.start()&#39; for an HTML browser interface to help.<br>Type &#39;q()&#39; to quit R.</pre><pre><strong>&gt; source(&quot;./thesis-writeup/load_data_for_interactive.R&quot;)<br>&gt; ls()<br></strong>[1] &quot;acceptancessdf&quot;      &quot;acceptancessdf_long&quot; &quot;clean_df&quot;<br>[4] &quot;hover_df&quot;            &quot;progressiondf&quot;       &quot;respondentdf&quot;<br>[7] &quot;responsesdf&quot;         &quot;slider_df&quot;</pre><h3>Step 6: Testing on other machine</h3><p>So… trying to do the same thing on my new Macbook with an M1 chip</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zksIGqWgmvPTh_NPt8tSAg.png" /></figure><p>Damn, some error.. let’s check the documentation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fFAQqMDZYBqtfgYF2zeWhQ.png" /></figure><p>Downloading the things needed and adding flag… still doesn’t work</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Crck8cp8zwNTMm4v-Fvamw.png" /></figure><p>Well, well works on other machines running on Intel at least 😅 (tested), and may work someday for the M1-chip machines.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=243199d6f7a1" width="1" height="1" alt=""><hr><p><a href="https://gopensource.com/going-through-docker-hell-once-243199d6f7a1">Going through Docker-hell (once)</a> was originally published in <a href="https://gopensource.com/">GopenSource</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Back to school — 2nd master-thesis learnings (after a few years in the real world)]]></title>
            <link>https://jonas-tillman.medium.com/back-to-school-2nd-master-thesis-learnings-after-a-few-years-in-the-real-world-7c61273cc3f8?source=rss-524af79f1bec------2</link>
            <guid isPermaLink="false">https://medium.com/p/7c61273cc3f8</guid>
            <category><![CDATA[learning-and-development]]></category>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[maps]]></category>
            <category><![CDATA[academia]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Jonas Tillman]]></dc:creator>
            <pubDate>Fri, 02 Apr 2021 05:08:58 GMT</pubDate>
            <atom:updated>2021-04-02T08:05:34.367Z</atom:updated>
            <content:encoded><![CDATA[<h3>Back to school — 2nd master-thesis learnings (after a few years in the real world)</h3><h4>Getting back to writing into thesis-writing mode, combining it with some of the knowledge gained from outside academia 👨‍🎓 has been… a ride 🎢</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BfW2fuVDwAsptkfS" /><figcaption>Photo by <a href="https://unsplash.com/@benwhitephotography?utm_source=medium&amp;utm_medium=referral">Ben White</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3><strong>TL;DR</strong></h3><p>I finished all courses for my M.Sc. in Geographic Information Systems (GIS) many years ago. Finding a thesis-topic took time and many iterations.</p><p>The planning and writing-process since my first Master-thesis in Econometrics/Statistics in 2013 has been tough, but now I’m <strong>seeing the light</strong>.</p><p>As basically a <strong>lonely solo-project</strong>, you get to decide everything, you can learn… a lot.</p><p><strong>Very few learnings were the ones I expected</strong>, and related to the thesis topic. Many were combining work-learnings and tools (some from software engineering, some not), putting academic work-processes in perspective.</p><ol><li><strong>True “Agile”</strong> — Don’t force your first direction and adjust. Sometimes that means not getting a project possible within agile organizations.</li><li><strong>Accept “good enough” sometimes </strong>— Ugly things that work can save a lot of time</li><li><strong>Processes are key — tools can force processes</strong>, “force” is not bad (a.k.a. “Git everything”</li><li><strong>Plan for no results and do some “future proofing” </strong>— while academic honesty is a breath of fresh air</li><li><strong>Take advantage of an excuse to learn and combine learnings<br> • </strong>Work experience ⇾ The user/use cases, and software dev, problem solving = no stress<br>• Earlier academics ⇾ visual inspection, old rusty statistics and R-skills<br>• Where they intersect ⇾ LaTeX, reproducibility</li></ol><h3>Background</h3><p>My thesis is not yet published, and the topic is not of key interest for this article, but in short:</p><blockquote><strong>Everyday people around the world use maps on their phones or on webpages to find information on businesses, traffic, and other data. Putting data that is connected to a certain area that don’t have cartographic representations (for example: roads/houses), such as average population, COVID-19 rates or similar is difficult, because the geographic context can be covered by the data. A common method is to make the data see-through, so you can see part of the map background as well. This study looks on how this type of data can be supported to understand the values it represents using different legend designs.</strong></blockquote><blockquote>Examples of data mappings where only the legend types were changed were shown in a web browser to people. There was a marker, similar to the type used in Google maps at a location in the data, and the people were asked to guess the value at that location in the map data using the legends. All the responses were saved on the computer, and after doing that for 10 images (2 times for every legend design) the users were asked how useful the legend types were for guessing the value.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*h4DBwFn24dE0V49D96O7qA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*HM9KLpCXcKejzq9Byf9FZQ.gif" /><figcaption>Hm… GIF colours a bit limited….</figcaption></figure><h3>Learnings — Many many many!</h3><h3>(1) True “Agile”</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*b_XPZyb5PSM-WZmP" /><figcaption>Photo by <a href="https://unsplash.com/@edenconstantin0?utm_source=medium&amp;utm_medium=referral">Eden Constantino</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>(a) Don’t try to force a thesis topic into <a href="https://www.atlassian.com/agile">agile</a> organizations</h4><p>In short: If it’s too damn hard, accepting and adjusting is actually <a href="https://www.atlassian.com/agile">agile</a>.</p><p>I tried to come up with a GIS-topic for the longest time that would allow me to conduct the work within the frames of my work.</p><p>From looking at how you could find coordinates from image frame from aerial photos, HD map representations and accuracy requirements, and map updates… nothing remained clear enough to be a focus for a longer study.</p><p>If timeframe for a study needs to be ≥ 1 year, agile company priorities will change. Then it can be better to just go at it yourself 💪</p><h4>(b) Small-scale testing can teach you a lot and Qualitative learnings can complement qualitative results</h4><p>This could be long, so short version:</p><ol><li>I had planned to distribute the data collection tool online. <br>Testing showed that user understanding needed checking first in order not to get too much noise in the data. <br>Adjusting to this to collect data on only one laptop in a more qualitative way was better.</li><li>I had hoped to collect many proxy variables. <br>Seeing people interact with the data collection tool made it clear they would be useless 😿</li><li>Don’t overdo (keep it simple) — I had planned to include a colour picker together with a value-picker. <br>This would give feedback to the user (= learning effects) and not isolate effects in the collected data.</li></ol><p>These data points from early testing allowed me to adjust the way the study was conducted. Going back and collect data again would have been a nightmare 😅</p><h3>(2) <strong>Accept “good enough” sometimes</strong></h3><p>Ugly code can save you time. If it’s not likely to survive and be changed, then just make it work ASAP.</p><p>Below is some of the worst code… I have ever written.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u_g5lYYADuxNqrtVgCJpFA.png" /><figcaption>Those timeouts and likely memory hogging… ugh</figcaption></figure><p>But it does connect to this… so whatevs 😇</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rDkyZMJnTRVXKSNliurt8w.png" /><figcaption>Also not great, but used once and stored forever on Github, and… slightly less awful</figcaption></figure><p>Other parts of the project was better, but the trade-off was always in there (do I need to go back to this, or is this a one-off).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B96QI_cEJQyTLp5TuqabYw.png" /></figure><h3>(3) <strong>Processes are key — tools can force processes (a.k.a. “Git Everything!”)</strong></h3><p>I will not introduce what Git or version-control software is here — see <a href="https://www.atlassian.com/git/tutorials/what-is-version-control">https://www.atlassian.com/git/tutorials/what-is-version-control</a></p><p>Git is really a life-saver:</p><ul><li>It forces you to organize your work packages in your head</li><li>You feel progress continously</li><li>You are not afraid to test things (you can always go back)</li><li>Git keeps you on track! It is difficult to work with git without creating a work flow and break down larger problems into smaller pieces.</li><li>More areas need a tool as good as Git!</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vQvZTrJFMdAd8J_p" /><figcaption>Photo by <a href="https://unsplash.com/@kirillpershin?utm_source=medium&amp;utm_medium=referral">Kirill Pershin</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>(4) <strong>Plan for no results and do some “future proofing”</strong></h3><h4>(a) P-fishing is for suckers (also “<a href="https://en.wikipedia.org/wiki/Data_dredging"><strong>data dredging</strong></a><strong>”</strong>, “<strong>data fishing”</strong>, “<strong>data snooping”</strong>, “<strong>data butchery”, “significance chasing”</strong>, “<strong>significance questing”</strong>, “<strong>selective inference”</strong>, “<strong><em>p</em>-hacking”</strong>)</h4><p>Some key things:</p><ul><li>Academic honesty is a breath of fresh air</li><li>No statistically significant results is also an interesting result</li></ul><h4>(b) Instead look elsewhere: future proof for less “hard” results</h4><p>In my data collection efforts, it became clear pretty early that there would be no strong results in different legend types…</p><p>Luckily, I also wanted to see how much users liked the different types and included that in the survey!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VsAf1gfql1JJ33Viy3CryQ.png" /></figure><p>In this there are actually some more interesting results…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*52eekCUPcUh15E9x5ppDWg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vF1rH7aQITVKBffc" /><figcaption>Photo by <a href="https://unsplash.com/@timmossholder?utm_source=medium&amp;utm_medium=referral">Tim Mossholder</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>(5) <strong>Take advantage of an excuse to learn and combine learnings</strong></h3><h4>(a) Work Experience Learnings</h4><ul><li>The <strong>USER</strong> — <a href="https://educationonline.ku.edu/community/4-different-learning-styles-to-know">not everyone learns and takes in information the same way</a>. <br>I learn am a combination of a visual and writing/reader learner, that is not true for everyone. Some people rely more on listening, or hands-on learning. <br>(See the need for (1b) Small-scale testing)</li><li>Related to the USER. <br>Academic wording can sometimes “irk” you. <br>Your user is a “subject” 🥴. <br>Nah, for me they will be “USERS” or “RESPONDENTS” 🥰</li><li>Things will happen, don’t freak out, stay agile-ish (see section 1)</li><li>Simple factory functions FTW! (unless you write… library code that needs real optimizing)<br>Very simply return an object with it’s own functions — readable, easy for other developers to understand. If you don’t have thousands of the same objects… why optimize for memory, chances are where the functions are stored in the browsers will be closer to the data anyway. If needing more reusability… throw in a mixin 😊</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XCZYiNRhNRgGTtz9t8chog.png" /></figure><h4>(b) Old study-instincts</h4><ul><li>Always do visual inspection, if you can’t see the results they are not there</li><li>You forget things you used to know… stats and modeling was a bit rusty, but picks up quickly once you need those old skills again.</li></ul><h4>(c) Learn new and combine</h4><ul><li>Getting a chance to relearn and learn more is not to be wasted. Most will be forgotten, but at least I know where to look if I need it again</li><li>This project has been a ride:</li><li>Scrolling-JS-libraries 📜</li><li>Perlin noise 💥</li><li>Perspective and CSS transitions ⤵</li><li>Clustering-algorithms for image data 🌠</li><li>Combining SVG into HTML5 Canvas (⌲ + 🌠)</li><li>Research map libraries 🗺</li><li>Front end bundler debugging 🐞</li><li>Image URL-data encoding and automatic extraction (0️⃣1️⃣1️⃣0️⃣1️⃣)</li><li>Front-end storage 👩‍💻</li><li>Headless browser usage and custom events (🤯👩‍💻)</li><li>“Get things done” using Node.js 💪</li><li>Differences between debounce and throttle 🤷‍♀️</li><li>Express, Mongoose, MongoDB ❓</li><li>LaTeX with Rmarkdown ❓</li><li>LaTeX bibliography management 📚</li><li>Realizing how difficult to replicate setup… may need to Dockerize… 🚢 <br>To make anyone wanting to check the results from <a href="https://github.com/Tille88/thesis-data-analysis">https://github.com/Tille88/thesis-data-analysis</a> a little easier… (<strong>TODO once passing thesis-course…</strong>)</li><li>And some more, phew 😅</li></ul><p>All quick-and-dirty commits are available in the following repos:</p><p><a href="https://github.com/Tille88/thesis-data-analysis">https://github.com/Tille88/thesis-data-analysis</a>, <a href="https://github.com/Tille88/thesis-front-end">https://github.com/Tille88/thesis-front-end</a>, <a href="https://github.com/Tille88/thesis-back-end">https://github.com/Tille88/thesis-back-end</a>, <a href="https://github.com/Tille88/thesis-map-generation">https://github.com/Tille88/thesis-map-generation</a></p><p>Thesis link and maybe data collection front-end deployment to be added once the thesis writing and defence fully done 😇</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c61273cc3f8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Big Red Color (Beijing photo series pt. 2/2)]]></title>
            <link>https://jonas-tillman.medium.com/big-red-color-beijing-photo-series-pt-2-2-eb8be4729e38?source=rss-524af79f1bec------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb8be4729e38</guid>
            <category><![CDATA[street-photography]]></category>
            <category><![CDATA[photography]]></category>
            <category><![CDATA[colors]]></category>
            <category><![CDATA[beijing]]></category>
            <category><![CDATA[china]]></category>
            <dc:creator><![CDATA[Jonas Tillman]]></dc:creator>
            <pubDate>Thu, 29 Nov 2018 17:11:01 GMT</pubDate>
            <atom:updated>2018-11-30T07:07:06.907Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jkCBXe23mTd-QGwNCx7qcQ.jpeg" /></figure><blockquote>In 2015–2016 I was based in Beijing working in HIV/AIDS research for the Chinese government, through a year long conference — at least that was the visa type I was on.</blockquote><blockquote>[… continuation from <a href="https://medium.com/@tillman.jonas/gray-areas-beijing-photo-series-pt-1-2-fade50e5edab">part 1</a>] The second part — 大红色, Big Red Color (direct translation from Chinese for ‘China red’), slowly brings in this more saturated experience that is more representative of life in this city, in terms of both color and the amount of movement through the frames.</blockquote><blockquote>Update: It did not go fully according to plan — the pictures became messy, so a 1:1 aspect ratio was chosen, but the saturation was allowed to increase. And with that the need to move came back. I’m now in Shanghai, where life is just a tiny bit easier — and the realization that if you fail to make one home, having many homes is not an inherently bad thing.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wp1vn6U_2eUmzvy28iyY-Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2tI8Uq4LtNQlgKOpzj5G7g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lAsi_gwD9AQdet5qSVlN2g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JD37cA-OT4OD1WJ-Lhr7YA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KtpadrhH70ZguTY4h_zDhA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DMyIJnT6GSff5gbD2_zN1w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*amkhxS5DF1Vs2ZQuPoKBqg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sc2KlOHL9cK6qfaDvscCPw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oWC63RBpdMEItY-uSrn4CQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QwQh0ORXtf9h9IUM2NY_VQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YpWRGYqxN-IXCz0hyhN_aw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XHCnIJBouWFbETFEtNcG1Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uJwQ2njHMWrEKihJIZIlQA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j3BGRJ6r8H6R3wxi5L34mQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3pW5cEecCpNNl0HVjZ6z5Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yP5BM4yzZHqaHSgccUm4yA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ThzbtjOggZb51TScnyIy9g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uTLFN79Xi4YdeO0t4wzJYg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GpAs9mWCeR8tefU36ShMyg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ef5NKs1Arnik7sPGdXASQQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0OkthJAb6esTNP1NrKHmaA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oSZFjPAnrkaMZI5INGkxtQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sqhj9dKQSkYhBFbMo3SXJw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3TBoy4-O1VnlouCTQ_ZAxw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6uQey0gzR9wf3DG0_K5oFg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qI5xcGAuufI2m5ofPOsG8w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IyrKOJLamUQfAWITKG9ojA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A6jQpfbMR26WLZJSPzHEEw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ru9yqYGe6I9BWTRzJD9a1Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xm5Ot-vTm6CN93Ul382hbw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8PrA7TLfNehXB2BpOvk-eQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V3a7n-pigIj8fpIO44ad5w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-PEm1OldslVkGCb7VP2Igg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lSgDC2Wlw3cS4_tyD3zQoA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P1Vz3lEbOuszVgp3XwXp0Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ct8sA3r_XdMaJn-r_U8Crg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hAyPb8Se9sInnmWkLuEzBQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TZZRZ9yr22PLmiuaci6PEw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iHenk43FGtz2vtnSwJASHA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kP74b0FFhzvmtO-bTNZKkw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4iMx2cnjCy8PG_gP0odE8Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eCHRWrbm3S-9OhUJhPj5dg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T-RyBSPfTN-JDeRLwJFhIg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vy0lFQLybCoK51fMJx892A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vFsi1tO2Lxhgh8eExElKZg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g_LEUHj08zpBgg6wea2Rzw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zLIbY5sPU5PeE03FOLkP1g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YUFVN665VTGqYu4pPzsTdA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bcxj3BCgeDCpSaul_mcrEg.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb8be4729e38" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Gray Areas (Beijing photo series pt. 1/2)]]></title>
            <link>https://jonas-tillman.medium.com/gray-areas-beijing-photo-series-pt-1-2-fade50e5edab?source=rss-524af79f1bec------2</link>
            <guid isPermaLink="false">https://medium.com/p/fade50e5edab</guid>
            <category><![CDATA[photography]]></category>
            <category><![CDATA[china]]></category>
            <category><![CDATA[beijing]]></category>
            <category><![CDATA[street-photography]]></category>
            <category><![CDATA[black-and-white]]></category>
            <dc:creator><![CDATA[Jonas Tillman]]></dc:creator>
            <pubDate>Thu, 29 Nov 2018 07:07:57 GMT</pubDate>
            <atom:updated>2018-11-29T08:03:25.449Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MSnY8n9j00CHyBiw-Nf0IQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Nv-0JNwMI2eztojbqCr4og.jpeg" /></figure><blockquote>In 2015–2016 I was based in Beijing working in HIV/AIDS research for the Chinese government, through a year long conference — at least that was the visa type I was on.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bPRlAPL2Ssl0xP0L_hInUQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4GVVWkNDXl_bmDlRmMpt8A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wAsX2bRycMpbIyV8TVCcCQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-x3X-gjGvTbkvB0Wi8u8LA.jpeg" /></figure><blockquote>The pictures presented here are an excerpt <em>from</em> the first of a two-part series taking <em>on</em> the subjective experience <em>of</em> trying to settle down;</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lEHpp_3t1X6YMYYyF51zCQ.jpeg" /></figure><blockquote>both a homage to wanderlust and an attempt to</blockquote><blockquote>fight the ill-advised habit of</blockquote><blockquote>constant geographic mobility.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZR9V2Euwztw4NBq0hnS_Ng.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PEZuewd-qDBOj4RU0cQdRw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eQ-w0a2-y3AEK1GvB4-tIw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ETAlhjWtP-6kcvPkKLiJaw.jpeg" /></figure><blockquote>They are born out of the reductionist approach</blockquote><blockquote>one may have to take on in order to limit</blockquote><blockquote>the sheer amount of impressions</blockquote><blockquote>one faces in an unfamiliar</blockquote><blockquote>environment.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5AezI35Pr_b4WfUW2sqylA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AYhFQ8V_xn8L6bCr15hh1Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WWmsvf9yXvzB1Rf4A-B7LA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uv1SVk4xpa1751qBMgWdqg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*URwlVdR6icMbbL82FA1TyA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bNMIe7E4ls_a8pK6qKG-zg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SszlNmE1YCTMYGpBpFI5Xg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T2okJIw6aFxBpzUd251u8w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WfPSiPdH1yzJrLFVxpfjBg.jpeg" /></figure><blockquote>An effort to both process and make sense of the place</blockquote><blockquote>you will at least make an attempt to call home</blockquote><blockquote>— before you slowly allow for a more</blockquote><blockquote>saturated experience.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XhvZiqy4ztdf5SiBHRMyfg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yd9WnUvmCYMzccmlrsnBTA.jpeg" /></figure><blockquote>In this process, I was drawn to clean frames where not only the color space is eliminated, but also the number of subjects in the frame are limited</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MAzKTw3HXkBZhjjOtBf14w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i0kbKQnjwdWRsyoUKxkADg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SbNiULX4DZ7g4gYF8Vqjgw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lHFZiU0Hw8vfhXDvSDkZsg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4hgsO1YgnaXKHnTa-Mk1pg.jpeg" /></figure><blockquote>Mainly using subjects (individuals, environments, items, shadows) that drew my attention</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*riz2Jdtc3qIv8DA0xEqgLQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fISYMtZNi-IDzM77a-UE8g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IJRdkr1iQfZ-KjzuA7gPIg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vr9wPQCgeCN51TqIVGqjJw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ylxxlVR0B5Rc4iX9MiufMA.jpeg" /></figure><blockquote>because they embodied the feeling of isolation and alienation I myself could feel at times when I was new to this place.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cXMFNhyBvnjx_uVwkOtH4w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dmSZAJt2H2yeNgo_6yk6IQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B0Z0fwPYaar31V5Jor8ddA.jpeg" /></figure><blockquote>In that process I hope to have created a highly subjective portrait of the (first months in the) Beijing I try to learn to accept, if not love.</blockquote><blockquote><strong>- August 2015</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UsAp5_PtYclfWeAplope3Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SWCF5FRu3Xowt9QO07VLQQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9EZblBWs9nO05PsTw_HpXQ.jpeg" /></figure><blockquote>The second part — 大红色, Big Red Color (direct translation from Chinese for ‘China red’), slowly brings in this more saturated experience that is more representative of life in this city, in terms of both color and the amount of movement through the frames.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fade50e5edab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hello (3D) World]]></title>
            <link>https://jonas-tillman.medium.com/hello-3d-world-bf3b79d9f89e?source=rss-524af79f1bec------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf3b79d9f89e</guid>
            <category><![CDATA[webgl]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[threejs]]></category>
            <category><![CDATA[gis]]></category>
            <category><![CDATA[data-visualization]]></category>
            <dc:creator><![CDATA[Jonas Tillman]]></dc:creator>
            <pubDate>Wed, 28 Nov 2018 08:11:01 GMT</pubDate>
            <atom:updated>2018-11-28T08:11:01.859Z</atom:updated>
            <content:encoded><![CDATA[<p>I recently needed a custom way to show geographic location data that would pop a bit for a CV site. The end result being as seen in the GIF below.</p><p>This article will walk you through the steps from inspiration, data preparation and implementation using WebGL through THREE.js.</p><p>The example code will be a stripped down version of the globe I needed for my specific use case, but will render the same geometries, but not go into the panning and animations — allowing for a more coherent and sequential code. I will still hint at which attributes that can be animated for performance reasons. Code available on <a href="https://github.com/Tille88/cv_proj/tree/master/globe">GitHub</a> (see medium_article_version/index.html).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/438/1*lRWinkAtA_l-VnkLIMWrww.gif" /></figure><h3><strong>Step 1: Inspiration</strong></h3><p>I wanted to have something that would have a similar feel to it as a <a href="https://en.wikipedia.org/wiki/Wire-frame_model">wire-frame model</a>, while being clearly recognizable as geographical locations.</p><p>A few years ago, there was a geographical visualization of world population going around the internet, that was used as a cover for some sort of geographic society (I couldn’t find it before finishing the actual 3D implementation, but then I recalled the word <a href="http://spatial.ly/2017/04/population-lines-how-and-why-i-created-it/"><em>population lines</em></a> before writing this article making it just a quick google search away).</p><p>Would that hold up to a 3D version as well (using a standard digital elevation model, not population data) or would it be too busy visually speaking? Would it make sense to stick with latitude lines, longitude, both? No other way than to test and see.</p><h3>Step 2: Feasibility and Data Control</h3><p>We need to get our hands on elevation data. Searching for DEMs (digital elevation models) has a few ones which are freely available for use, but they make it very difficult to download in batch, the <a href="https://www.ngdc.noaa.gov/mgg/topo/gltiles.html">GLOBE project</a> luckily made their tiles available to download zipped, to a reasonable combined file size of ~300MB.</p><p>The data is in binary format, so just to help anyone wanting to use R to read in the data, the following format and <a href="https://www.ngdc.noaa.gov/mgg/topo/report/globedocumentationmanual.pdf">table 3</a> from the GLOBE data manual will help.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*sqgqSDmIEbp4UGWxunaZ8Q.png" /></figure><pre># Example code for reading in the A10G <br>connection = file(&quot;./all10/a10g&quot;, &quot;rb&quot;)<br>N_COL = 10800<br>N_ROW = 4800</pre><pre># Read in the binary data, NOTE data has little endian format<br>data = readBin(connection, integer(), n=N_COL*N_ROW, size=2, endian = &quot;little&quot;)<br>close(conn)</pre><pre># Set dimensions of data matrix<br>dim(data) = c(N_COL, N_ROW)</pre><p>After that, for feasibility, I worked on getting a static version done, subsampling elevation data along the latitude at a fixed distance, and applying a kernel to it before plotting the results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6d71r4QsIhbIawYuR9BRAg.jpeg" /><figcaption>Scandinavia elevation smoothed lines</figcaption></figure><p>The data looks okay, so it was time to switch to a 3D version</p><p>(<strong>NOTE: </strong>I did not end up using elevation data with a Kernel applied to it after the first attempt when it was clear that using the raw data would work)</p><h3>Step 3: 3D Globe</h3><p>THREE.js provides quite a lot of nice abstractions over WebGL, allowing us to stay within Javascript, and avoiding learning GLSL just a tiny bit longer. Still there are more than a few things we need:</p><p>i) a Scene</p><p>ii) a Camera</p><p>iii) Light(s) (we need to see something duh)</p><p>iv) Objects/geometries in the scene (we need to have something to see duh)</p><p>v) a Renderer</p><p>vi) Controls/animations</p><p>In the example code I will initialize variables that are then passed in to the different constructors directly in an init() function. Anything that will be required to hold a reference to for a render() loop will be declared as globals at the start of the script.</p><p><strong>Note</strong>: This ‘code structure’ quickly gets unmaintainable, it has been hidden a slightly better way and split up into different objects in the actual project code also found in the repo. Here it follows the text introduction order, which is… good to get to know the APIs.</p><h4>Globals</h4><p>Some things will be required for the rendering loop.</p><pre>// Globals</pre><pre>var <strong>scene, renderer, camera, controls</strong>;</pre><h4>i) Scene</h4><p>We are now inside the init() function. Where we get a reference to a div element declared in the HTML that will contain the webGL-canvas.</p><pre>// Get frame reference</pre><pre>var <strong>frame</strong> = document.getElementById(&#39;globe-scene-container&#39;);</pre><pre>// Init scene</pre><pre><strong>scene</strong> <strong>= new THREE.Scene();</strong></pre><h4>ii) Camera</h4><p>Trying to showcase the values chosen, and how they are ordered for the camera API, the snippet below creates a camera.</p><p>There are plenty of tutorials online that will cover this more in detail what the meaning of all these values are, but note the use of camera.up.set(0,0,1) which sets the up direction of the camera, giving us a coordinate system which is more in line with the 3D math I personally learned in school instead of the one used in game programming. Incidentally, it is also the one used in Wikipedia’s article on <a href="https://en.wikipedia.org/wiki/Spherical_coordinate_system">Spherical coordinate systems</a>, making it easy to use any formulas without modification.</p><p>Most of these values are set when knowing how large the objects in the scene will be, so that most things can be kept in view.</p><pre>var cameraConfigs = {<br> FOV: 35,<br> ASPECT: frame.clientWidth/frame.clientHeight,<br> NEAR: 0.1,<br> FAR: 200,<br> INIT_POS: {<br>  x: 2,<br>  y: 0.6,<br>  z: 4<br> }<br>};<br><strong>camera</strong> = <strong>new THREE.PerspectiveCamera</strong>(<br> cameraConfigs.FOV,<br> cameraConfigs.ASPECT,<br> cameraConfigs.NEAR,<br> cameraConfigs.FAR<br><strong>)</strong>;<br>var pos = cameraConfigs.INIT_POS;<br>camera.position.set(pos.x, pos.y, pos.z);<br>// Setting up direction to make sure coordinate system used is correct<br><strong>camera.up.set(0,0,1);</strong><br>// Placement of globe will have center at [0,0,0]<br>camera.lookAt( 0,0,0 );</pre><h4>iii) Light(s)</h4><p><strong>Note:</strong> For the materials used in this example, none of them are affected by lights. But for almost any other scene there will be a need to add lights to show them. Hence, it is good to have something in the scene in case more objects are to be added.</p><p>We will only need one light. We don’t want to get any particular effects from specular lighting or anything like that — a constant light source without shadows will do — which translates to AmbientLight in THREE.js</p><p>Note that the colour of the light is passed in in HEX-format, or using THREE.js convenient <a href="https://threejs.org/docs/#api/en/math/Color">Color constructor</a>.</p><pre>// Init light and add to scene</pre><pre>var light = <strong>new THREE.AmbientLight(</strong>0x04040c<strong>)</strong>;</pre><pre><strong>scene.add(light)</strong>;</pre><h4>iv) Objects/geometries</h4><p>Objects will be added in two steps.</p><p>First we will just add a sphere object that will make up the globe and in the next few steps make sure that it is placed and rendered correctly. After that we will add other objects to the scene.</p><p>We just want a basic material with less than full <strong>opacity</strong> — to also allow things on the back of it to be partly in view — and a constant color (i.e. not affected by any lights).</p><pre>var globeConfigs = {</pre><pre>WIDTH_SEGS: 16,</pre><pre>HEIGHT_SEGS: 16,</pre><pre>GLOBE_OPACITY: 0.7,</pre><pre>EARTH_RAD: 1,</pre><pre>MULTIPLIER: 1E-5,</pre><pre>COLOR: 0x04040c</pre><pre>};</pre><pre>var earthGeometry = <strong>new THREE.SphereGeometry(</strong></pre><pre>  globeConfigs.EARTH_RAD,</pre><pre>  globeConfigs.WIDTH_SEGS,</pre><pre>  globeConfigs.HEIGHT_SEGS</pre><pre><strong>);</strong></pre><pre>var earthMaterial = <strong>new THREE.MeshPhongMaterial({</strong></pre><pre>  transparent: true,</pre><pre>  opacity: globeConfigs.GLOBE_OPACITY,</pre><pre>  color: globeConfigs.COLOR</pre><pre><strong>});</strong></pre><pre>var earthMesh = <strong>new THREE.Mesh(earthGeometry, earthMaterial);</strong></pre><pre>earthMesh.position.set(0, 0, 0);</pre><pre><strong>scene.add(earthMesh);</strong></pre><h4>v) Renderer</h4><p>A renderer is absolutely required to display anything from the scene. Most of the code below is very explicit in the naming and makes it relatively obvious what is happening. Note the use of the frame reference, which we kept from i) Scene above.</p><pre>// Init renderer</pre><pre>renderer = <strong>new THREE.WebGLRenderer({antialiasing : true});</strong></pre><pre>renderer.setSize(frame.clientWidth, frame.clientHeight);</pre><pre>renderer.domElement.style.position = &#39;relative&#39;;</pre><pre>// Background set to black</pre><pre>renderer.setClearColor (0x000000, 1);</pre><pre><strong>frame</strong>.appendChild(renderer.domElement);</pre><pre><strong>renderer.render(scene, camera);</strong></pre><p>After calling the init() function, we can now see something render to screen. This is quite a lot of code just to get something — ANYTHING — showing on screen, and if done from scratch may require quite a few iterations before things are displayed in the way you had in mind.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*UQBlJ2PfdwbZWqTX94LKUA.png" /><figcaption>An almost black sphere on a black background from all that typing… the anticlimax of 3D programming</figcaption></figure><h4>vi) Controls/animations</h4><p>We also want to allow for some movement of the objects in the scene.</p><p>We could choose to animate the rotation ourself and try to calculate mouse interactions, but this is such a common task that there is a THREE.js extension called <a href="https://threejs.org/docs/#examples/controls/OrbitControls">OrbitControls</a>.</p><p><strong>Note:</strong> <em>Orbit controls allow the camera to orbit around a target. </em>However, with nothing for the eye to reference, it will have the same visual effect as the globe rotating.</p><p>Making a small addition to the init() function:</p><pre>// Init controls [inside init() function]</pre><pre>controls = <strong>new THREE.OrbitControls( camera );</strong></pre><pre>controls.autoRotate = true;</pre><p>It is also required to have the scene updating and re-rendering at regular frequency to see our controls in action, so we need a render() function which is called after the init() function. This simply updates the controls, re-renders and schedules a new call to the render function. Any additional ‘paint’ updates can go before the call to renderer.render() .</p><pre>var render = function render(){</pre><pre>  controls.update();</pre><pre>  renderer.render(scene, camera);</pre><pre>  requestAnimationFrame(render);</pre><pre>}</pre><pre>init();</pre><pre>render();</pre><p>We will adjust the globe a little bit to see if the changes take effect. Setting the globeConfig.[WIDTH_SEGS|HEIGHT_SEGS] from 16 to 6 to make it less round and altering the colour of the sphere.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/417/1*YXcBiGudZWtUhZAjAPabaw.gif" /></figure><p>Time to change back the colour and shape of the sphere to what we had before and add some other things to our globe.</p><p><strong>Note:</strong> We are lucky enough to have the globe “rotate” in the correct direction without any alterations, as will be seen once we add elevation.</p><h4>iv) Objects/geometries (revisited)</h4><p>First of all, we want to add the <strong>lines</strong> in for the <strong>elevation</strong>. To graph this to the local coordinate system we will need a few helper functions, the key one being shown below.</p><p>For the Medium version of the code, I just add them in the script tag one by one before the init() and render() functions are called.</p><pre>/**</pre><pre>* Converts lat lon and radius of sphere to location on spheric surface.</pre><pre>* https://en.wikipedia.org/wiki/Spherical_coordinate_system</pre><pre>* @param {number} lat latitude</pre><pre>* @param {number} lon longitude</pre><pre>* @param {number} rad radius</pre><pre>* @returns {object} object containing x, y, z fields</pre><pre>*/</pre><pre>var <strong>latLonToSphere</strong> = function(lat, lon, rad){</pre><pre>  return {</pre><pre>    x: rad * Math.cos(radians(lat))*Math.cos(radians(lon)),</pre><pre>    y: rad * Math.cos(radians(lat))*Math.sin(radians(lon)),</pre><pre>    z: rad * Math.sin(radians(lat))</pre><pre>  };</pre><pre>};</pre><p>The prepareLineData() function converts the data from the input format given the helper function above. The internal details are of less importance, but with these helpers available to us, we can create these lines and add them to the scene as seen in the code below. We don’t have any changes to them after first render, so we will just stuff everything in the init function to make the reading of the code as easy as possible.</p><pre>var convertedLineData = prepareLineData(lineData, globeConfigs.EARTH_RAD, globeConfigs.MULTIPLIER);</pre><pre>var lineGroup = new THREE.Group();</pre><pre>var materialLine = new THREE.LineBasicMaterial({color: 0x3393B8});</pre><pre><strong>// Loop over converted data<br>// Each key in the object is a latitude<br>// Each latitude key has an array, each containing array being the data, with lat/lon/alt being in the coordinate frame, for one single &#39;line&#39;<br>// The line is constructed and added to a group.</strong></pre><pre>for(var lat in convertedLineData){</pre><pre>  convertedLineData[lat].forEach((arr) =&gt; {</pre><pre>    var vectorArr = arr.map(p =&gt; new THREE.Vector3( p.x, p.y, p.z ));</pre><pre>      if(vectorArr.length &lt;= 1) { return; }</pre><pre>      var curve = new THREE.CatmullRomCurve3(vectorArr);</pre><pre>      var points = curve.getPoints( vectorArr.length*4 );</pre><pre>      var geometry = new THREE.BufferGeometry().setFromPoints( points );</pre><pre>      var curveObject = new THREE.Line( geometry, materialLine );</pre><pre>      lineGroup.add(curveObject);</pre><pre>  });</pre><pre>}</pre><pre><strong>// Lastly the whole lineGroup is added to the scene</strong></pre><pre>scene.add(lineGroup);</pre><p>After these additions we have the base of the visualization done as seen in the GIF below, and we can finally see the neat effect the lowered opacity has for the overall visual impact.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*7acFQ7cLya1Xz0NkP_bp6w.gif" /></figure><p>Second step is to add in a path connecting two locations.</p><p>Here we will cut a few corners in that</p><ul><li>It will just be static as everything else, meaning that after initialization we don’t touch it at all.</li><li>We introduce a lot of magic numbers, that will show the API usage, but is… questionable in real projects.</li></ul><p>The mapping function latLonToSphere() is used, in addition to a linear interpolation function called lerp() .</p><p>The following code is added after the line code in the usual init() function. We simply calculate three positions — starting point, middle point, and end point. These are fed into a quadratic <a href="https://threejs.org/docs/#api/en/extras/curves/QuadraticBezierCurve3">Bezier curve constructor</a>, and inserted into the scene.</p><p>It is not strictly required to use a BufferGeometry() as shown below for this curve, but it gives access to geometry.setDrawRange(fromPoint, toPoint) method, which — according to the documentation — is relatively inexpensive to use for animations (set geometry.setDrawRange(0,0) and animate to the end point, or the reverse direction).</p><pre>var LAT_LONS = {<br>// Stockholm<br>ST: {lat: 59.3, lon: 18.0},<br>// Shanghai<br>SH: {lat: 31.2, lon: 121.4},<br>};</pre><pre>// Start, middle and end positions of curve<br>var start = latLonToSphere(LAT_LONS.ST.lat, LAT_LONS.ST.lon, globeConfigs.EARTH_RAD);</pre><pre>var middle = latLonToSphere(<br>  lerp(LAT_LONS.ST.lat, LAT_LONS.SH.lat, 0.5),<br>  lerp(LAT_LONS.ST.lon, LAT_LONS.SH.lon, 0.5),<br>  globeConfigs.EARTH_RAD + 0.5<br>);</pre><pre>var end = latLonToSphere(LAT_LONS.SH.lat, LAT_LONS.SH.lon, globeConfigs.EARTH_RAD);</pre><pre>var curve = new <strong>THREE.QuadraticBezierCurve3</strong>(<br>  new THREE.Vector3( start.x, start.y, start.z ),<br>  new THREE.Vector3( middle.x, middle.y, middle.z ),<br>  new THREE.Vector3( end.x, end.y, end.z ),<br><strong>);</strong></pre><pre>var points = curve.getPoints(50);</pre><pre>var geometry = new THREE.BufferGeometry().setFromPoints( points );</pre><pre>var material = new THREE.LineBasicMaterial( { color : 0xff0000 } );</pre><pre>var curveObject = new THREE.Line( geometry, material );</pre><pre>scene.add(curveObject);</pre><h3>Where are we now?</h3><p>Okay, so we have reached the end of this with a static, but spinning globe, that looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*PLsG6S9fn4NFUpzUQJJwvA.png" /></figure><p>Having added everything as the text went on — AND in an as linear fashion as possible — we have ended up with a huge init()function which does all of the work, just using a few helper-functions.</p><p>Before extending this in any way, a major refactoring would be almost required. My code structure in the main project is certainly not perfect, and set up for a specific use case, but it is certainly better than this, and can be found in the <a href="https://github.com/Tille88/cv_proj">Github repo</a>.</p><p><strong>Disclaimer:</strong> This is my first experience with THREE.js so there could be inefficiencies in the way I have used the API, although I tried to look into it as much as possible while coding.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf3b79d9f89e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>