-
Notifications
You must be signed in to change notification settings - Fork 0
/
report-backup.tex
1800 lines (1325 loc) · 105 KB
/
report-backup.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
%%
%% This is file 'sample-degree-report.tex' was based on the ACM's`sample-manuscript.tex'.
%% Note that this was taken from the Overleaf project: https://www.overleaf.com/gallery/tagged/acm-official#.WOuOk2e1taQ
%% It has been adapted to use the TIMTM template (adapted from CHI Proceedings Template) for
%% the Interactive Media Technology (TIMTM) and Media Management (TMMTM) programmes at KTH Royal Institute of Technology.
%%
%% 2021-11-09 Gerald Q. Maguire Jr. adapted template to KTH's TIMTM and TMMTM requirements, including:
%% removing the ACM copyright and other notices in the generate documents - as these are not applicable
%% and rewriting some of the contents of the sample document.
%% Note that the teaserfigure environment simply ignores content, s there should
%% note be teaser figures in a thesis.
%%§
%%
%% IMPORTANT NOTICE:
%%
%% For the copyright see the file: acmart-primary/acmart.dtx - from the github
%%
%% The first command in your LaTeX source must be the \documentclass command.
%%%% Generic manuscript mode, required for submission
%%%% and peer review
%\documentclass[manuscript,screen,review]{timtm}
\documentclass[manuscript, screen]{timtm}
%% If you add the review option, then line numbers are added to the manuscript.
%% Note that as the thesis is in a single column format,
%% the line numbers are only on the left.
%% The option authordraft adds a draft watermark.
%% Some of the options have been removed, as they did not make sense for a thesis.
%% Note that there is not an anonymous option, as theses are never anonymous.
%% There is also not authorversion option.
%% Note that you do not need the sigcconf for the thesis template
%% Fonts used in the template cannot be substituted; margin
%% adjustments are not allowed.
%%
%% \BibTeX command to typeset BibTeX logo in the docs
\makeatletter%
\@ifclassloaded{acmart}%
{\AtBeginDocument{%
\providecommand\BibTeX{{%
\normalfont B\kern-0.5em{\scshape i\kern-0.25em b}\kern-0.8em\TeX}}}}%
{\AtBeginDocument{%
\providecommand\BibTeX{{%
\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em\TeX}}}}%
\makeatother%
%% Note that it you do happen to repurpose this file for a submission to SIGCHI, you might add the line below - as you need to retain the copyright, since KTH must be able to distribute copies upon request.
\setcopyright{rightsretained}
\copyrightyear{2022}
%% For an actual ACM submission
%% Rights management information. This information is sent to you
%% when you complete the rights form. These commands have SAMPLE
%% values in them; it is your responsibility as an author to replace
%% the commands and values with those provided to you when you
%% complete the rights form.
%\setcopyright{acmcopyright}
%\copyrightyear{2018}
%\acmYear{2018}
%\acmDOI{10.1145/1122445.1122456}
%% These commands are for a PROCEEDINGS abstract or paper.
%\acmConference[Woodstock '18]{Woodstock '18: ACM Symposium on Neural Gaze Detection}{June 03--05, 2018}{Woodstock, NY}
%\acmBooktitle{Woodstock '18: ACM Symposium on Neural Gaze Detection, June 03--05, 2018, Woodstock, NY}
%\acmPrice{15.00}
%\acmISBN{978-1-4503-XXXX-X/18/06}
%%
%% Submission ID.
%% Use this when submitting an article to a sponsored event. You'll
%% receive a unique submission ID from the organizers
%% of the event, and this ID should be used as the parameter to this command.
%%\acmSubmissionID{123-A56-BU3}
%%
%% Use numbered citations and references.
%%
% include a variety of packages that are useful
\input{lib/includes}
\input{lib/kthcolors}
%\input{lib/defines} % load some additional definitions to make writing more consistent
%% If the acmart document class is being used, define away some commands and environment
%% If not, then enable ISBNs to be shown in references
\makeatletter%
\@ifclassloaded{acmart}%
{%
\newcommand{\alttitle}[1]{}
\newcommand{\altsubtitle}[1]{}
\newenvironment{swedishabstract}{}{}
\newcommand{\SwedishKeywords}[1]{}
}{%
% Define these so that the bibliography will include ISBNs
\newcommand{\showISBNx}{}
\newcommand{\showISBNxiii}{}
}%
\makeatother%
%% end of the preamble, start of the body of the document source.
\begin{document}
% insert the configuration information with author(s), examiner, supervisor(s), ...
\input{custom_configuration}
%%
%% The "title" command has an optional parameter,
%% allowing the author to define a "short title" to be used in page headers.
\title{The Report Title}
%\subtitle{A short subtitle}
% give the alternative title - i.e., if the thesis is in English, then give a Swedish title
\alttitle{Detta är den svenska översättningen av titeln}
\altsubtitle{Detta är den svenska översättningen av undertiteln}
\makeatletter
%%
%% The "author" command and its associated commands are used to define
%% the authors and their affiliations.
%% Of note is the shared affiliation of the first two authors, and the
%% "authornote" and "authornotemark" commands
%% used to denote shared contribution to the research.
%% For the thesis template we will take the authors names and e-mail addresses from the custom_configuration.tex file
\author{\@authorsFirstname\space\@authorsLastname}
%\authornote{Both authors contributed equally to this research.}
\email{\@email}
%\orcid{1234-5678-9012}
%% If there is no second author (which should be the case for a second cycle thesis
%% comment out the following line and the additional \email line
\author{\@secondAuthorsFirstname\space\@secondAuthorsLastname}
% Apply the same authornote for the second author
%\authornotemark[1]
\email{\@secondemail}
%\orcid{1234-5678-901X}
\affiliation{%
\institution{KTH Royal Institute of Technology, School of Electrical Engineering and Computer Science}
%\streetaddress{Street address}
\city{Stockholm}
\country{Sweden}
\postcode{SE 100 44}
}
\makeatother
%%
%% The abstract is a short summary of the work to be presented in the
%% article.
\begin{abstract}
\begin{scontents}[store-env=abstracts,print-env=false]
This sample report describes the formatting
requirements for a Interactive Media Technology (TIMTM) and Media Management (TMMTM) programmes at KTH Royal Institute of Technology. It is based upon the ACM conference proceedings format, and offers
recommendations on writing for the worldwide SIGCHI
readership. Please review this document, as some format details have changed
relative to previous years. Note that the template now generates the KTH front cover, titlepage, and information for entering the meta data associated with your thesis into DiVA. Abstracts should be about 150 words.
All theses at KTH are \textit{required} to have an abstract in \textbf{both} English and Swedish.
\end{scontents}
\end{abstract}
\begin{swedishabstract}
\begin{scontents}[store-env=abstracts,print-env=false]
Alla avhandlingar vid KTH \textit{måste ha} ett abstrakt på \textbf{både} engelska och svenska.
Om du skriver din avhandling på svenska ska detta göras först (och placera det som det första abstraktet) - och du bör revidera det vid behov. Om du gör detta måste du ändra dokumentmallen - eftersom den förutsätter att den första sammanfattningen är på engelska och den andra på svenska.
\end{scontents}
\end{swedishabstract}
%%
%% The code below is generated by the tool at http://dl.acm.org/ccs.cfm.
%% Please copy and paste the code instead of the example below.
%%
\begin{CCSXML}
<ccs2012>
<concept>
<concept_id>10010520.10010553.10010562</concept_id>
<concept_desc>Computer systems organization~Embedded systems</concept_desc>
<concept_significance>500</concept_significance>
</concept>
<concept>
<concept_id>10010520.10010575.10010755</concept_id>
<concept_desc>Computer systems organization~Redundancy</concept_desc>
<concept_significance>300</concept_significance>
</concept>
<concept>
<concept_id>10010520.10010553.10010554</concept_id>
<concept_desc>Computer systems organization~Robotics</concept_desc>
<concept_significance>100</concept_significance>
</concept>
<concept>
<concept_id>10003033.10003083.10003095</concept_id>
<concept_desc>Networks~Network reliability</concept_desc>
<concept_significance>100</concept_significance>
</concept>
</ccs2012>
\end{CCSXML}
\ccsdesc[500]{Computer systems organization~Embedded systems}
\ccsdesc[300]{Computer systems organization~Redundancy}
\ccsdesc{Computer systems organization~Robotics}
\ccsdesc[100]{Networks~Network reliability}
%%
%% Keywords. The author(s) should pick words that accurately describe
%% the work being presented. Separate the keywords with commas.
\keywords{datasets, neural networks, gaze detection, text tagging}
% The following adds the Swedsih version of your keywords
\SwedishKeywords{datauppsättningar, neurala nätverk, blickdetektering, texttaggning}
%% For KTH theses
%%% Set the numbering for the title page to a numbering series not in the preface or body
\pagenumbering{alph}
\kthcover
\titlepage
% document/book information page - if you don't want the copyright to appear comment the next line out - note that this page is unnecessary since the first page of the manuscript has the copyright information - based upon \setcopyright{}.
%\bookinfopage
\pagenumbering{arabic}
\setcounter{page}{1}
%%
%% This command processes the author and affiliation and title
%% information and builds the first part of the formatted document.
\maketitle
\section{Introduction (or: The Case for Unconventional Visualizations)}
The field of Information Visualization is interdisciplinary by nature. With influences (and practitioners originating) from fields such as statistics, design, visual communication, cognitive science, human-computer interaction, and computer science, among others, this is a field that, as Neil Richards puts it, "has a number of good practices, but very few rules" \cite{richards2022questions}:
\begin{quote}
Most would agree that the simplest of datasets in the hands of ten of the field’s most respected experts would be visualised in ten different ways, all of which would confirm to each designer’s personal style and visualisation preferences. Yes, all ten would likely be considered much better than something a beginner or intermediate practitioner might create, but all ten, while conforming to best practices, would look different enough to each other to be identifiable as unique.
\end{quote}
A field with practitioners and academics coming from such a diversity of backgrounds is bound to have a plethora of debates. One of these is the ongoing debate around the importance of precision and accuracy in visual encodings. This stems from an apparent "contradiction at the heart of information visualization," as summarized by Bertini et. al \cite{BertiniEnrico2021WSAC}:
\begin{quote}
On one hand, our exemplars of good visualizations can be diverse, complex, and reward contemplation. On the other hand, our foundational empirical results and rules of thumb are often simple and minimalist. These rules are typically evaluated in terms of how quickly and accurately people extract specific information from charts, including formative psychophysical studies showing that viewers extract data values most precisely when they are encoded via position on shared axes.
\end{quote}
The paper goes on to argue "for a more expansive view of visualization beyond the perceptually precise encoding and decoding of individual data values, and make a case for 'inefficient' visualizations." One of their arguments is that many visualizations are designed with no concern for the effective and efficient extraction of values but with the goal of persuading, educating, and motivating. Indeed, in many cases, the excessive concern with the accuracy and efficiency of visual decoding (and, as John-Burn Murdoch from the Financial Times puts it, the accompanying "technical dataviz\footnote{Short for "Data and information visualization".} paraphernalia"\footnote{https://twitter.com/jburnmurdoch/status/1182190640219803655?s=20}) may actually turn people away from an important visualization covering a relevant topic. That was the reasoning behind the design of one of the most iconic modern visualizations (Figure 1), by Ed Hawkins:
\begin{quote}
I was looking for a way to communicate to audiences that aren't used to seeing graphs, or axes, or labels, – things that we see day-to-day, but are complicated to them. It may look too mathematical to them, so it turns them off straight away.\footnote{Data Stories Podcast, episode 147, "Iconic Climate Visuals with Ed Hawkins", https://datastori.es/147-iconic-climate-visuals-with-ed-hawkins/}
\end{quote}
This is not a recent development. For many years there has being a related debate between advocates for minimalism in visualization design and those for adding visual embellishments to charts. The two sides of this debate are often epitomized by their leading proponents, Edward Tufte, who argues for minimalism, and Nigel Holmes, who supports the use of visual embellishments \cite{BatemanScott2010Ujte-useful-junk, BorkinMichelleA.2013WMaV-memorable-vis}.
Their visions will be discussed in section \ref{background-minimalism}, but in essence Tufte is concerned with graphical integrity and an efficient representation (and decodification) of the data, by removing all unnecessary graphical elements (even axes and gridlines, if possible) \cite{tufte2001visual}. Holmes approach is more concerned with the user experience, with a declared goal of making \textit{``reading, understanding, and looking at graphics a pleasurable experience''} \cite{holmes2022joyful}.
Interestingly, a similar movement took place in the field of human-computer interaction, one of information visualization's formative fields, where the focus gradually shifted from effectiveness and efficiency toward \textit{user experience}, valuing concepts such as "joy of use, aesthetics, hedonic qualities of interaction" \cite{emotional-response-WangYun2019AERt}.
In this way, beyond enhancing human cognition, information visualization may also play an important role in bringing awareness and interest to data and information. And one important area where there is a general lack of interest by the broader public is that of government and public policy data and information. This lack of interest affects not only governmental agencies but also international organizations: although the World Bank spends one-quarter of its budget for country services in knowledge products, almost one-third of its reports are never downloaded \cite{doemeland2014world-bank}. Furthermore, in a large scale study to evaluate visualization memorability across different chart types and different sources, "government and world organizations" visualizations achieved the lowest memorability score \cite{BorkinMichelleA.2013WMaV-memorable-vis}.
Making government data and information understandable and, beyond that, making them attractive to citizens is a communication challenge for governmental agencies and international organizations in virtually all democratic countries. In many contemporary societal issues, extending the debate beyond the restricted circles of specialists, civil servants, and politicians is essential. Besides that, the recent wave of political populism suggests that the general lack of knowledge of important issues can potentially be used to manipulate public opinion \cite{oecd-government-glance}.
From this perspective, this project aims to understand and explore innovative ways in which interactive media for the Web can be used as a tool to help people navigate through and engage with relevant public information that would otherwise be inaccessible or seemingly uninteresting to a general audience. It has been argued that there have been gains in the use of visualization tools to improve public sector governance, but \cite{visgov-Lindquist2018}:
\begin{quote}
[...] the greatest inroads have occurred in the more ‘instrumental areas’ of governance associated with competing for, securing, and wielding the power and authorities we associate with ‘government’ [...], as opposed to furthering the larger aspirations of ‘democratic governance’ by better advising elected representatives, engaging citizens, and ensuring accountability. Using visualization to further ‘democratic governance’ refers to how governments might find new ways to share information with the public to further understanding, participation, deliberation, and accountability—it is a critical complement to the more instrumental side of governance as practiced by governments.
\end{quote}
Thus, there is a demand for the design of alternative means of communication and engagement with government data and information to promote more citizen participation. And, as argued, one way to bring attention and interest to public policy topics might be the use of unconventional visualizations designed with a stronger concern for conveying a message rather than specific values and taking into account concepts such as playfulness, aesthetics, and joy of use.
Another communication challenge when dealing with official data is conveying the imprecision underlying the whole process of data collection, aggregation, and modeling. Any process that attempts to model the real world is subjected to imperfections, such as imprecision or uncertainty \cite{ph1997imperfect}, and visualization researchers have devoted considerable effort to study how to incorporate uncertainty into visualizations \cite{HullmanJessica2019IPoE, Padilla-uncertainty-chapter, BoukhelifaNadia2012ESLf-sketchy}. When it comes to public policy, official data, though, data is usually presented with "incredible certitude" \cite{incredible-certitude-manski-2019}, as reported by Manski: \textit{government agencies commonly communicate official economic statistics to the public in news releases that make little, if any, mention of uncertainty in the reported estimates} \cite{uncertainty=official-statistics-manski-2015}. Imperfect data presented as perfect and certain leads policymakers, stakeholders, pundits, government officials, politicians, and citizens alike to produce opinions, claims, policies, and decisions that many times cannot be supported scientifically \cite{morgenstern1963accuracy}.
This uncertainty can have a myriad of origins, from limitations in data collection to inconsistencies in data modeling, labeling, and aggregation. To illustrate the issue, we take the example of budgetary data, which is subjected to many different classification schemes that can change from year to year (not to say from country to country) \cite{imf-budget-classification}. In one of the most used datasets for the expenditures of the Federal Government of Brazil, we can identify at least thirteen different categorical variables that make up the expenditure classification, with at least nine different numerical variables representing the different measurement criteria\footnote{https://www.tesourotransparente.gov.br/ckan/dataset/despesas-e-transferencias-totais/resource/44c1aa69-a1ef-4efd-8e77-8346f8883c38}. In such a complicated classification system, data can be aggregated in many different ways that will all seem the same to non-specialized audiences, or even specialized audiences without the proper methodological details
In this context, this research project proposes a method for visualizations based on an implementation of two-dimensional soft-body physics simulation. Soft-body dynamics concerns the simulation of the motion of deformable objects, and it is widely used in fields such as Computer Graphics, Computer Games Design, and Generative Art. In this project, we extend its use to Information Visualization, by assigning each data point in the chosen dataset to a soft-body object in the visualization and encoding a numerical variable to the area of the object. The soft borders of these objects may help convey an idea of imprecision and uncertainty, while their organic-like movement might allow for a playful, almost game-like experience.
Although the main motivation for this technique is conveying uncertainty and providing an engaging experience, in order to be usable as a visualization method, it is important that the resulting visualizations be readable. For that, a perception experiment was designed to compare the user performance for basic tasks on charts created using this method, against charts created using other three popular area-based methods.
In this way, the project wants to explore the role of expressiveness, creativity, and joy in creating bespoke visualizations in an age of automated exploratory analysis and chart generation.
This is a long standing clash of visions, with open criticisms exchanged between Tufte and Holmes. Tufte uses Holmes' charts as examples of how not to do to. Holmes
Tufte isso, data-ink etc.
lack of quantitative skills of professional artists
Holmes aquilo.
Falar queue esse movement towards perhaps a less rational [usar adjetivos do rahul, ele tem algo escrito?] and more emotional mirrors a similar movement... ver see ele
\section{Related Work}
There are a number of related, well-established visualization methods based on encoding numerical variables to areas, such as pie charts, bubble charts, treemaps and Voronoi diagrams. One popular visualization method that uses a similar visual encoding as the one we are proposing is the bubble chart with force-directed layout. Indeed, the New York Times published one remarkable visualization using this technique for essentially the same topic, in a different country – the United States Federal Government Budget\footnote{https://archive.nytimes.com/www.nytimes.com/interactive/2012/02/13/us/politics/2013-budget-proposal-graphic.html} (figure \ref{fig:nyt-obama}).
\begin{figure}[h]
\centering
\includegraphics[width=0.45\textwidth]{figures/bubble-obama-1.png}
\includegraphics[width=0.45\textwidth]{figures/bubble-obama-2.png}
\caption{"Four Ways to Slice Obama’s 2013 Budget Proposal", by the New York Times. Reproduced with permission}
\label{fig:nyt-obama}
\Description{A screenshot with the mentioned chart from the New York Times webpage}
\end{figure}
The animations in this visualization make it a playful, joyful experience to explore information that would hardly attract any interest if it was presented in a more traditional and "precise" format. Furthermore, the ability to interactively expand the details of a given item with textual tooltips reconciles to some extent the need for precision.
The proposed method based on soft bodies and their organic-like movements has the potential to combine the playful, joyful experience (possibly to an even higher degree) of such a force-directed bubble chart, with the better use of available canvas space of charts such as treemaps and Voronoi diagrams.
There are at least two previous works in Information Visualization that employ the concept of soft-body physics simulations. The first one is "Apple’s Value Hit \$1 Trillion. Add Disney to Bank of America and ... You’re Halfway There" also published by The New York Times\footnote{https://www.nytimes.com/interactive/2018/08/02/technology/apple-trillion-market-cap.html} (figure \ref{fig:nyt-apple}).
\begin{figure}[h]
\centering
\includegraphics[width=0.6\textwidth]{figures/soft-body-nytimes.png}
\caption{"Apple’s Value Hit \$1 Trillion. Add Disney to Bank of America and ... You’re Halfway There", by the New York Times. Reproduced with permission.}
\label{fig:nyt-apple}
\Description{A screenshot with the mentioned chart from the New York Times webpage}
\end{figure}
This visualization aims to help people understand Apple's enormous market value in comparison with other companies. Users can control the progression of the story and hover over individual elements to obtain the company's name and values, but the interactivity stops there. The blocky soft-body elements that represent the individual companies are implemented as a mesh of relatively large squares.
The second example is the visualization created in the work "Generative storytelling for information visualization", by Cruz \& Machado \cite{Cruz-soft-body} (figure \ref{fig:soft-body-pedro}).
\begin{figure}[h]
\centering
\includegraphics[width=0.4\textwidth]{figures/soft-body-pedro-cruz.png}
\caption{Soft-bodies used as representation of colonial empires in a generative storytelling experiment by Pedro Cruz and Penousal Machado. Reproduced with permission by the authors.}
\label{fig:soft-body-pedro}
\Description{Colored deformed bubbles representing colonial powers, against a black background.}
\end{figure}
Here the soft-body elements represent the major empires' land areas in generative stories (or "data fabulas", as defined by the authors) of Western empires’ decline in the 19th and 20th centuries. The visualization is a visual narrative, with no user interaction.
Finally, as a visual reference, we can refer to the work with soft-body physics simulations of the creative coder and generative artist Juhani Halkomäki\footnote{https://twitter.com/JuhaniHalkomaki/status/1727409502327300435} (figure \ref{fig:juhani}).
\begin{figure}[h]
\centering
\includegraphics[width=0.4\textwidth]{figures/juhani.png}
\caption{Juhani Halkomäki work with soft-body physics.}
\label{fig:juhani}
\Description{A screenshot with colorful blobs pressed together inside a container}
\end{figure}
\section{Background}
This project touches on many different research topics. Because of this, this section is divided into subsections to keep things organized.
\subsection{Minimalism vs embellishments in visualization design} \label{background-minimalism}
In his seminal work, \textit{The Visual Display of Quantitative Information}, Edward Tufte laid some of the principles that promote minimalism in chart design. To propose his "Theory of Data Graphics", Tufte establishes first the core concept of \textit{data-ink ratio}, which is central to his principles of graphical minimalism \cite{tufte2001visual}:
\begin{displaymath}
\text{Data-ink ratio} = \frac{\text{data-ink}}{\text{total ink used to print the graphic}}
\end{displaymath}
Based on this \textit{data-ink ratio} concept, his principles are laid down as follows:
\begin{itemize}
\item Above all else show the data.
\item Maximize the data-ink ratio.
\item Erase non-data-ink.
\item Erase redundant data-ink
\item Revise and edit
\end{itemize}
Tufte strongly opposes the use of "decoration" in chart design, which originates, according to him, in the belief, held by many graphic artists, that statistics are "boring", and thus would need to be enlivened and animated by the use of embellishments \cite{tufte2001visual, tufte1990envisioning}. Tufte often labels these embelishments or decorations as "chartjunk" \cite{tufte2001visual}, using the work of Nigel Holmes as a counter-example of good chart design.
Unsurprisingly, Nigel Holmes proposes a very different approach to chart design.
Somewhat opposite to this view of chart design lies the work of Nigel Holmes. Holmes calls Tufte views as... concept of joyful infographics.
Memorability studies.
Emotional value. Dorsey. Impressionism.
Tufte's principles
* Lie factor
* the number of information-carrying (variable) dimensions depicted should not exceed the number of dimensions in the data.
exemplo do Playfair
know the rules to know when to break them?
\subsection{Soft-Body Physics} \label{background-soft-body}
Physics game engine in general
Integrators
In the end it's Particle Systems. The seminal work is \cite{particle-ReevesW.T.1983PSTf}.
Terzopoulos, seminal work.
Physically based deformable models have two decades of history
in Computer Graphics: since Lasseter’s discussion of
squash and stretch [1] and, concurrently, Terzopoulos et. al’s
seminal paper on elastically deformable models [2], numerous
researchers have partaken in the quest for the visually
and physically plausible animation of deformable objects and
fluids. This inherently interdisciplinary field elegantly combinesNewtonian
dynamics, continuum mechanics, numerical
computation, differential geometry, vector calculus, approximation
theory and computer graphics (to name a few) into
a vast and powerful tool kit, which is being further explored
and extended.\cite{NealenAndrew2006PBDM}
\subsection{Soft-Body in Visualization}
\subsection{Uncertainty in Visualization}
in policy analysis, economics. Morgenstern.
There has been many studies / techniques aimed at visualizing uncertainty. \cite{Padilla-uncertainty-chapter}, \cite{HullmanJessica2019IPoE}
The uncertainty we are trying to convey here is not a measured statistical uncertainty, but rather a more fundamental, epistemic one. This uncertainty derives from bla bla Ben Jones. \cite{ben-jones-data-pitfalls}.
\subsection{Visualization Evaluation} \label{section:vis-eval}
One central process in the visualization pipeline model is the mapping of data variables to visual variables \cite{readings-infovis-shneiderman}. Researchers in Information Visualization have long investigated the effectiveness of these visual mappings in terms of graphical perception \cite{HeerJeffrey2010Cgpu-bostock-amazon-turk}. Their study contributed to the development of many rankings of visual variables (citar Tamara, Ware?)
The seminal work in this area is Cleveland and McGill's study of graphical perception using a set of perceptual tasks, where subjects were asked to estimate the proportionality between pairs of visual marks across different types of spatial encodings (angle, length, position) \cite{ClevelandWilliamS.1984GPTE}.
Kosara and Correll propose important criticism of the state of information visualization research.
Proposed a framework of tasks.
Bremer and Munzner developed a multi-level typology of abstract visualization tasks, trying to bridge the gap between low-level and high-level classification systems \cite{BrehmerMatthew2013AMTo}.
Compared perception for five different charts.
More criticism, from McColeman et al. \cite{McColemanCaitlynM.2022RtRo-rethinking-visual-channels}
An existing ranking of these
visual channels is based on how accurately participants could report the ratio between two depicted values. There is an assumption
that this ranking should hold for different tasks and for different numbers of marks. However, there is surprisingly little existing work that
tests this assumption, especially given that visually computing ratios is relatively unimportant in real-world visualizations, compared
to seeing, remembering, and comparing trends and motifs, across displays that almost universally depict more than two values.
Quadri and Rosen surveyed hundreds of perception-focused visualization studies, creating a practical taxonomy of studies based on Amar et al. low-level task taxonomy.
Criticism, such as Kosara \cite{kosara2016empire}, Michael Correll \cite{CorrellProgressVis}.
Isenberg et al. reflect that, although there have been improvements, the \textit{general level of rigor of reporting evaluations is still too low} \cite{IsenbergTobias2013ASRo}.
Regarding crowdsourced experiments, Bostock ...\cite{HeerJeffrey2010Cgpu-bostock-amazon-turk}.
One common problem in evaluation studies is ecological validity. with the use of crowdsourcing, by relying on the participants' standard displays, Heer and Bostock suggest that experimental control could effectively be swapped for ecological validity \cite{HeerJeffrey2010Cgpu-bostock-amazon-turk}.
Heer and Bostock's seminal work demonstrated the viability of crowdsourcing for testing graphical perception, citing the increase in the numbers and diversity of the subjects as one of its advantages.
We replicate prior laboratory studies on spatial data encodings
and luminance contrast using crowdsourcing techniques.
Our new results match previous work, are consistent
with theoretical predictions [21], and suggest that
crowdsourcing is viable for testing graphical perception
There is something wrong with
every methodological technique, which can often be compensated
by combining techniques. \cite{HeerJeffrey2010Cgpu-bostock-amazon-turk}
It is interesting to note that, although user experience and user performance are among the most common studies in the field of human-computer interaction, Isenberg et al. express their surprise on the low number of scenarios and papers that fell in this category in their survey \cite{IsenbergTobias2013ASRo}.
O'Brien et al. propose a refined version UES bla bla \cite{O’BrienHeatherL.2018Apat-engagement}.
\subsection{Vis in Government}
Government:
However, just as with the “digital divide”, these divisions don’t simply stop or be resolved with the provision of digital (or data) “access”. What is necessary as well is that those for whom access is being provided are in a position to actually make use of the now available access (to the Internet or to data) in ways that are meaningful and beneficial for them. \cite{Gurstein_2011-open-data-use}
\subsection{Emotional Value}
By rendering a real-time simulation, animation becomes a natural part of the visualization, and animations can engage emotions, sparking greater interest or enjoyment \cite{HeerJ.2007ATiS-animation}.
\section{Method}
\subsection{Building a Soft-body Simulation}
In this project, we propose an information visualization technique in which data points are visually represented as dynamical deformable bodies in a physically realistic simulation (with a focus on visually plausibility, rather than scientific accuracy).
As mentioned in \ref{background-soft-body}, there are many approaches to implementing a simulation of soft-bodies \cite{NealenAndrew2006PBDM, book-deformable-objects}. We employ a mixed approach, representing the deformable objects -- we will can them \textit{blobs} -- as particle systems of a set of point-masses connected by massless springs and also subjected to a pressure force, responsible for maintaining the original circular shape.
The study of physically-based deformable models is a fascinating interdisciplinary field that combines "Newtonian dynamics, continuum mechanics, numerical computation, differential geometry, vector calculus, approximation theory and computer graphics (to name a few)" \cite{NealenAndrew2006PBDM}. Given this and considering the pedagogical nature of a master's degree project, we took the opportunity to dive into and understand how physical simulations for computer graphics work. Thus, we decided not to use a readily available soft-body simulation in a framework such as Unity, or any of the physics libraries available to the Web platform, but to develop our own real-time simulation and simplified physics engine from the ground up in Javascript, starting from our own vector library.
The Web platform was chosen because of its ubiquity, graphics and interaction capabilities, and easy, immediate distribution of content.
Therefore, a CPU 2D soft body physics real-time simulation was developed for Web Browsers using Javascript. The HTML Canvas 2D Context\footnote{https://www.w3.org/2015/04/2dcontext-lc-sample.html} is used for rendering, and the animation is achieved with the `requestAnimationFrame` API\footnote{https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html\#dom-animationframeprovider-requestanimationframe}, both part of W3C Web Standards.
In this section, we provide the details of our implementation\footnote{Source code is available at https://github.com/tiago-kth/master-thesis.}.
\subsubsection{Data Structures}
The very first structure needed for our simulation is a Vector library. This library, implemented as a JavaScript class \texttt{Vec}, provides the data structures necessary to represent vectors (and points), storing the vectors' \texttt{x} and \texttt{y} attributes, and also provides a variety of vector operations, such as addition, subtraction, scalar product, projection, calculating the vector's magnitude, obtaining a unit vector in the vector's direction etc. Also, to make it easy to debug and understand the behavior of the system, a method to visualize the vector was also developed. To illustrate how the library works, consider the following operations that define two vectors, adds them together and displays all three vectors anchored at the center of the canvas:
\begin{verbatim}
let p0 = new Vec(W/2, H/2);
let vec_a = new Vec(300, 300);
let vec_b = new Vec(100, -200);
let vec_c = Vec.add(vec_a, vec_b);
// ctx holds the reference to the rendering context
vec_a.display(ctx, p0, "blue");
vec_b.display(ctx, p0, "green");
vec_c.display(ctx, p0, "red");
\end{verbatim}
The resulting rendered image is show in figure \ref{fig:vectors}.
\begin{figure}[h]
\centering
\includegraphics[width=0.45\textwidth]{figures/vector-library.png}
\caption{A basic vector addition with the \texttt{Vec} library.}
\label{fig:vectors}
\Description{Three vectors on a grid, one vector labeled as vec_a, another as vec_b and a third (the sum of vec_a and vec_b) as vec_c}
\end{figure}
With the vector library in place, we move to the main data structures of our simulation. The physics engine we developed for this project was the "mass-aggregate" engine type -- an engine that treats objects as collections of simple point-masses \cite{game-physics-millington}. In this way, our deformable objects, or blobs, represent collections of point-masses, or particles. A \texttt{Particle} class therefore was implemented with several attributes that are usually present in any Particle System and that are relevant to the simulation (\textit{position}, \textit{velocity}, \textit{acceleration} etc.) and to the particles' rendering (\textit{size}, \textit{color}, \textit{transparency} etc.) \cite{particle-ReevesW.T.1983PSTf}.
The particles are, naturally, essential to the simulation, because they are the objects that effectively change position, velocity and acceleration. The forces are applied to them, and collisions happen to them. Therefore, they are the most complex data structure in this simulation. A summary of their main properties is listed on table \ref{tab:particle}.
\begin{table}
\caption{Particles' attributes}
\label{tab:particle}
\begin{tabularx}{\textwidth}{rX}
\toprule
\texttt{position} & vector that holds the particle's current \texttt{x} and \texttt{y} position\\
\texttt{velocity} & vector that holds the particle's current velocity\\
\texttt{acceleration} & vector that holds the particle's current acceleration\\
\texttt{force\_acum} & vector that accumulates the sum of all forces applied to the particle at a given frame\\
\texttt{blob} & reference to the blob object that contains the particle\\
\texttt{springs} & references to the outer springs connected to the particle\\
\texttt{collider\_center} & vector that holds the position of the particle's corresponding external collider (used to evaluate collisions on the blob's external surface)\\
\texttt{internal\_collider\_center} & vector that holds the position of the particle's corresponding internal collider (used to evaluate collisions on the blob's internal surface)\\
\texttt{immediate\_neighbors} & references to the particle's immediate neighbors in the same blob (used in the collision system)\\
\texttt{grid\_cell} & id of the grid cell that currently contains the particle (used to improve the performance of the collision system)\\
\bottomrule
\end{tabularx}
\end{table}
The particles are connected together by springs. The springs are responsible for keeping the blob together, by applying equal and opposite forces to each of its connected particles, as we will discuss in section \ref{section:forces}. They are also implemented as a specific class, \texttt{Spring}, and a summary of their main properties is listed on table \ref{tab:spring}.
\begin{table}
\caption{Springs' attributes}
\label{tab:spring}
\begin{tabularx}{\textwidth}{rX}
\toprule
\texttt{p1} & a reference to one of the particles to which the spring is connected\\
\texttt{p2} & a reference to the other particle to which the spring is connected\\
\texttt{rest\_length} & a value that represents the original length of the spring, when no force is applied to it\\
\texttt{current\_length} & a value that represents the current length of the spring, obtained by calculating the distance between \texttt{p1} and \texttt{p2}.\\
\texttt{normal} & unit vector perpendicular to the spring, that is used to apply the pressure force\\
\bottomrule
\end{tabularx}
\end{table}
Finally, the deformable bodies, the blobs, have their own data structure as well: the \texttt{Blob} class. Since the blobs represent the actual data points in a similar way as bubbles in a Bubble Chart, their size is defined by its corresponding data value, according to a scale function. According to their size, the number and initial positions of particles is defined, which in turn define the number and initial length of the springs. We will detail this process shortly, in section \ref{section:initial-setup}, but first we list the main properties of the \texttt{Blob} class on table \ref{tab:blob}.
\begin{table}
\caption{Blobs' attributes}
\label{tab:blob}
\begin{tabularx}{\textwidth}{rX}
\toprule
\texttt{R} & the initial and ideal blob radius, when no force is applied to its particles.\\
\texttt{rest\_area} & the initial and ideal blob area, which corresponds to the area of a circle with radius \texttt{R}.\\
\texttt{current\_area} & value that keeps track of the current blob's area, evaluated with the Shoelace Formula.\\
\texttt{center} & vector that keeps track of the current position of the blob's center\\
\texttt{particles} & references to the particles that make up the blob.\\
\texttt{springs} & references to the springs that make up the blob.\\
\bottomrule
\end{tabularx}
\end{table}
\subsubsection{Initial Setup}\label{section:initial-setup}
Similarly to how one would proceed with a Bubble Chart, we are representing data points to area objects, encoding some numerical data variable to the objects' areas. Our first step is to find a suitable scaling function to map those data values to actual areas. Since the space on the canvas is limited, it is interesting to represent the sum of all values as a percent of the available canvas area. Having the total value mapped to an area, we can use a simple rule of three to obtain the individual target areas. Depending on the nature of the dataset, one can also use more meaningful maps, that might convey extra information to the reader. For example, in our dataset of government expenditures as percentages of the GDP, we can map the percentage values to areas that correspond to the same percentage of the total available screen area. In this way, the container's area would represent the country's GDP, and the blobs' areas would be a direct visual representation of the actual expenditure in terms of percentages of the GDP.
Since the blobs will initially assume a circular shape, once we have the target areas of each blob, we can determine their radii using the circle's area formula. We then populate the blob's perimeter with adjacent particles, calculating the number of necessary particles based on the blob's radius and the particles' radius (a parameter of the simulation). Next, we connect all adjacent particles and every other particle with springs. The algorithm \ref{algo:init} details this process. Figure \ref{fig:one-blob} shows what an initialized blob looks like, with particles rendered as circles, and springs rendered as straight lines. In our prototype's debug mode, it is possible to render the particles and springs as shown in the figure, or the whole blob as a polygon made of lines connecting the centers of the particles.
\begin{algorithm}
\caption{Blob Initialization} \label{algo:init}
\begin{algorithmic}[1]
\State $\theta \gets \arctan\left(\frac{2 * \text{PARTICLE\_RADIUS}}{blob\_radius}\right)$
\State $n \gets \left\lfloor \frac{2 * \pi}{\theta} + 0.5 \right\rfloor$ \Comment{Rounds to the nearest integer, to have a valid number of particles}
\State $\theta \gets \frac{2 * \pi}{n}$ \Comment{Recalculates the angle between particles considering the new number of particles}
\Function{vectorFromAngle}{$magnitude, angle, p_0$}
\State $x \gets p_0.x + \cos(angle) * magnitude$
\State $y \gets p_0.y - \sin(angle) * magnitude$
\State \Return $\text{new Vector}(x, y)$
\EndFunction
\For {$i \gets 0$ to $n-1$}
\State $position \gets vectorFromAngle(blob\_radius, \theta * i, blob\_center)$
\State $p \gets \text{new Particle}(position)$
\State $\text{add } p \text{ to } particles$ \Comment{the blob's particles list/array}
\EndFor
\For {$i \gets 0$ to $n-1$}
\State $next\_index \gets \begin{cases}
0 & \text{if } i = particles.length - 1 \\
i + 1 & \text{otherwise}
\end{cases}$
\State $s \gets \text{new Spring}(particles[i], particles[next\_index])$\Comment{a spring connecting neighboring particles}
\State $\text{add } s \text{ to } particles[i].springs$ \Comment{the particle's list/array of springs connected to it}
\State $\text{add } s \text{ to } particles[next\_index].springs$
\State $\text{add } s \text{ to } springs$ \Comment{the blob's springs list/array}
\State $s2 \gets \text{new Spring}(particles[i], particles[(i + 2) \mod particles.length])$\Comment{a spring connecting every other particle}
\State $\text{add } s2 \text{ to } springs$ \Comment{the blob's springs list/array}
\EndFor
\end{algorithmic}
\end{algorithm}
\begin{figure}[h]
\centering
\includegraphics[width=0.33\textwidth]{figures/one-blob.png}
\caption{A blob's structure: its particles (circles) and springs (lines).}
\label{fig:one-blob}
\Description{A big circle made of adjacent smaller circles and lines connecting their centers}
\end{figure}
\subsubsection{Simulation overview}
The main animation loop is comprised of the following steps:
\begin{enumerate}
\item Compute and accumulate forces
\item Integrate
\item Handle Collisions
\item Satisfy Boundary Constraints
\item Render
\end{enumerate}
We address each of these steps in the following sections.
\subsubsection{Forces}\label{section:forces}
We compute and accumulate three forces, successively: the spring force, the pressure force and the gravity force.
\paragraph{Spring Force}
As in any mass-spring system, springs exert equal and opposite forces on each object attached to them. According to Hooke’s law, the force exerted by the spring is determined by its displacement (stretching or compression) from its rest length and the spring constant \cite{physics-game-developers-oreilly}:
\[F_s = -k_s \Delta l\]
In this way, the spring constant quantifies the relationship between the force exerted by the spring and its displacement ($\Delta l = l - l_rest$). Hooke’s law indicates that the displacement is directly proportional to the applied force. The negative sign means that the force acts in the opposite direction of the displacement.
In our simulation, all springs have the same spring constant, which is one of the simulation's key parameters, as we shall see later. As we can see in Table \ref{tab:spring}, the \texttt{Spring} object stores the original spring's length, that is, its \textit{rest length}, $l_{rest}$, as well as references to the particles connected to it. These \texttt{Particle} objects, in turn, keep track of their current position, which we will call $\vec{p_1}$ and $\vec{p_2}$. Hooke's law then becomes (acting on particle 1):
\[\vec{F_{s1}} = -k_s (|\vec{p_1} - \vec{p_2}| - l_{rest}) \hat{l} \]
Where
\[\hat{l} = \frac{\vec{p_1} - \vec{p_2}}{|\vec{p_1} - \vec{p_2}|} \]
Similarly, on particle 2 we have an opposite force of:
\[\vec{F_{s2}} = k_s (|\vec{p_1} - \vec{p_2}| - l_{rest}) \hat{l} \]
A real spring will not oscillate forever -- that is, beyond forces, a real spring also experiences drag \cite{game-physics-millington}. To simulate drag in a numerical simulation we add a damping component, proportional to the the relative velocity of the connected particles, $\vec{v_1}$ and $\vec{v_2}$, multiplied by a damping parameter $k_d$, another important simulation parameter.
\[\vec{F_{d1}} = -k_d (\vec{v_1} - \vec{v_2}) \cdot \hat{l} ) \hat{l} \]
\[\vec{F_{d2}} = k_d (\vec{v_1} - \vec{v_2}) \cdot \hat{l} ) \hat{l} \]
Computationally, our procedure is described in Algorithm \ref{algo:spring-force}.
\begin{algorithm}
\caption{Spring force computation} \label{algo:spring-force}
\begin{algorithmic}[1]
\For {every $blob$ of all $blobs$}
\State $springs \gets \text{list/array of all springs in } blob$
\For {every $spring$ of $springs$}
\State $k_s \gets \text{STIFFNESS parameter}$
\State $k_d \gets \text{DAMPING parameter}$
\State $\vec{p_1} \gets \text{position of particle 1 of }spring$
\State $\vec{p_2} \gets \text{position of particle 2 of }spring$
\State $\vec{L} \gets \vec{p_1} - \vec{p_2}$
\State $l \gets |\vec{L}|$ \Comment{Current length}
\State $\hat{l} \gets \frac{\vec{L}}{l}$
\State $l_{rest} \gets \text{rest length of }spring$
\State $\vec{v_1} \gets \text{velocity of particle 1 of }spring$
\State $\vec{v_2} \gets \text{velocity of particle 2 of }spring$
\State $\vec{v_{1,2}} \gets \vec{v_1} - \vec{v_2}$
\State $f \gets (l - l_{rest}) k_s + (\vec{v_{1,2}} \cdot \hat{l}) k_d $
\State $\vec{F} \gets f \hat{l}$
\State \text{add $-\vec{F}$ to $force\_accumulator$ of particle 1}
\State \text{add $\vec{F}$ to $force\_accumulator$ of particle 2}
\State \text{store $l$ in $spring.current\_length$} \Comment{This will be used to compute the Pressure Force}
\EndFor
\EndFor
\end{algorithmic}
\end{algorithm}
Figure \ref{fig:spring-force} illustrates the spring forces acting on the blob's particles.
\begin{figure}[h]
\centering
\includegraphics[width=0.33\textwidth]{figures/spring-force.png}
\caption{Spring forces}
\label{fig:spring-force}
\Description{A big circle made of adjacent smaller circles and lines connecting their centers, with vectors representing the spring forces on the smaller circles}
\end{figure}
\paragraph{Pressure Force}
We included a pressure component in our model to perform the critical role of helping to keep the overall blob's shape and to avoid the blob's collapse or having its borders flipping over one another.
\begin{figure}[h]
\centering
\includegraphics[width=0.33\textwidth]{figures/flipped-over-blob.png}
\caption{A blob with crossed edges (highlighted in red)}
\label{fig:flipped-over}
\Description{A big circle made of adjacent smaller circles and lines connecting their centers. It has a couple of edges crossed over.}
\end{figure}
To model this force, we consider that the blob is filled with an ideal gas, following Matyka \& Ollila implementation \cite{pressure-MaciejMatyka2004PMoS, matyka2004implement}. The empirical form of the ideal gas law is well-known:
\[PV = nRT \]
Where $P$ is the pressure, $V$ is the volume, $n$ is the amount of substance, $R$ is the ideal gas constant and $T$ is the temperature. In our simplified model, the temperature is constant. Hence, the $nRT$ term can be considered constant, which we will call $k_p$, the pressure constant, one important simulation parameter. Furthermore, we are dealing with a 2D model, and thus the volume can be represented by the blob's area, $A_b$:
\begin{equation} \label{eq:pressure}
P = A_b^{-1} k_g
\end{equation}
In our simulation, we are interested in the normal force $F_p$ related to the pressure:
\[P = \frac{F_p}{A} \]
In our 2D model, the pressure translates to a force applied not to an area, but to a line segment represented by the blob's springs, that has a length of $l$. The force is applied in a normal direction, given by the unit vector $\hat{n}$:
\[\vec{F_p} = Pl\hat{n} \]
Applying equation \ref{eq:pressure} yields:
\begin{equation} \label{eq:pressure-complete}
\vec{F_p} = \frac{l}{A_b} k_g \hat{n}
\end{equation}
Where $\hat{n}$ is a normal unit vector to the spring. Considering the positions of the spring's particles $p_1$ and $p_2$, and the length $l$ of the spring, we have the unit vector $\hat{l}$ in the spring's direction:
\[
p_1 = \begin{bmatrix} x_1 \\ y_1 \end{bmatrix}, \quad
p_2 = \begin{bmatrix} x_2 \\ y_2 \end{bmatrix}, \quad
\text{ and then } \hat{l} = \begin{bmatrix} (x_2-x_1)/l \\ (y_2-y_1)/l \end{bmatrix}
\]
In this way, the normal unit vector becomes:
\[
\hat{n} = \begin{bmatrix} -(y_2-y_1)/l \\ (x_2-x_1)/l \end{bmatrix}
\]
From equation \ref{eq:pressure-complete}, we can notice that when the blob is compressed, its area becomes smaller, producing a stronger pressure force that will try to restore the blob's original shape.
Our computational procedure is described in Algorithm \ref{algo:pressure-force}.
\begin{algorithm}
\caption{Pressure force computation} \label{algo:pressure-force}
\begin{algorithmic}[1]
\Function{getNormal}{$spring$}
\State $l \gets spring.current\_length$
\State $\vec{p_1} \gets \text{position of particle 1 of }spring$
\State $\vec{p_2} \gets \text{position of particle 2 of }spring$
\State $x_1 \gets p_1.x$
\State $y_1 \gets p_1.y$
\State $x_2 \gets p_2.x$
\State $y_2 \gets p_2.y$
\State $n.x \gets -(y_2-y_1)/l$
\State $n.y \gets (x_2-x_1)/l$
\State \Return $\hat{n}$
\EndFunction
\For {every $blob$ of all $blobs$}
\State $k_p \gets \text{PRESSURE parameter}$
\State $A_b \gets blob \text{ current area}$
\State $springs \gets \text{list/array of all springs in } blob$
\For {every $spring$ of $springs$}
\State $l \gets spring.current\_length$
\State $f_p \gets \frac{l}{A_b}k_p $
\State $\hat{n} \gets getNormal(spring)$
\State $\vec{F_p} \gets f_p \hat{n}$
\State \text{add $\vec{F_p}$ to $force\_accumulator$ of particle 1 of $spring$}
\State \text{add $\vec{F_p}$ to $force\_accumulator$ of particle 2 of $spring$}
\EndFor
\EndFor
\end{algorithmic}
\end{algorithm}
Figure \ref{fig:pressure-force} illustrates two examples of pressure forces acting on the blobs particles.
\begin{figure}[h]
\centering
\includegraphics[width=0.4\textwidth]{figures/pressure-force.png}
\includegraphics[width=0.4\textwidth]{figures/pressure-force-2.png}
\caption{Pressure force}
\label{fig:pressure-force}
\Description{Two pictures of big circles made of adjacent smaller circles and lines connecting their centers. Pink outwards vectors indicate the pressure force.}
\end{figure}
\paragraph{Gravity Force}
A gravity force is added to the simulation as well. Its computation is far simpler than the other two forces since the force is the same for every particle of the simulation. It is a direct application of Newton's Second Law:
\[ \vec{F} = m\vec{a}\]
In our simulation, we can consider the acceleration $\vec{a}$ as a downward pointing vector with magnitude equal to a gravity constant, $G$ which is another simulation parameter:
\[
\vec{a} = \vec{g} = \begin{bmatrix} 0 \\ G \end{bmatrix}
\]
Computationally, we can simply loop over all particles and add the same force to each particle's force accumulator (algorithm \ref{algo:gravity-force}). Figure \ref{fig:gravity-force} shows this force acting on the blob's particles.
\begin{algorithm}
\caption{Gravity force computation} \label{algo:gravity-force}
\begin{algorithmic}[1]
\For {every $blob$ of all $blobs$}
\State $particles \gets \text{list/array of all particles in } blob$
\For {every $particle$ of $particles$}
\State $m \gets \text{property $mass$ of} particle$
\State $G \gets \text{GRAVITY parameter}$
\State $\vec{g} \gets [0, G]$
\State $\vec{F_g} \gets m\vec{g}$
\State \text{add $\vec{F_g}$ to $force\_accumulator$ of $particle$}
\EndFor
\EndFor
\end{algorithmic}
\end{algorithm}
\begin{figure}[h]
\centering
\includegraphics[width=0.4\textwidth]{figures/gravity-force.png}
\caption{Gravity force}
\label{fig:gravity-force}
\Description{A picture of a big circle made of adjacent smaller circles and lines connecting their centers. Green vectors pointing downwards indicate the gravity force.}
\end{figure}
\subsubsection{Integrator}
A key component of every numerical simulation is the numerical integrator. In a real-time simulation, the motion of objects is not controlled by pre-defined motion sequences. Instead, the simulation depends on a physics model, equations of motion, and a differential equation solver to determine the objects' movements as the simulation unfolds \cite{physics-game-developers-oreilly}.
Therefore, our integrator is responsible for updating each particle's position $p$, velocity $v$, and acceleration $a$ in each frame. We know that the particle's velocity is defined as the change of its velocity over a time period. If we could make this time period infinitely small, we could calculate the exact velocity at any point in time \cite{game-physics-millington}:
\[
v = \lim_{\Delta t\to 0} \frac{\Delta p}{\Delta t} = \frac{dp}{dt} = \dot{p}
\]
Since acceleration represents the rate of change in velocity, we can express it in a similar way \cite{game-physics-millington}:
\begin{equation}
\label{eq:acceleration-derivative}
a = \lim_{\Delta t\to 0} \frac{\Delta v}{\Delta t} = \frac{dv}{dt} = \frac{d^2v}{dt^2} = \ddot{p}
\end{equation}
If we know the particle's acceleration ($\ddot{p}$) and its current velocity ($\dot{p})$, we can work out its next velocity $\dot{p}'$ at some given point by integrating the acceleration expression in equation \ref{eq:acceleration-derivative}:
\begin{equation}
\label{eq:integrator-velocity}
\dot{p}' = \dot{p} + \ddot{p}t
\end{equation}
And then we can find the particle's next position $p'$ by computing the second integral of the acceleration:
\begin{equation}
\label{eq:integrator-position}
p'= p + \dot{p}t = + \ddot{p} \frac{t^2}{2}
\end{equation}
In this way, at each frame, after computing all forces acting on each particle, we will determine the particle's acceleration using Newton's second law of motion, $\vec{a} = \vec{F}m^{-1}$. We then use equations \ref{eq:integrator-velocity} and \ref{eq:integrator-position} to update the particle's position and velocity. We can notice that these equations need a time interval, and in our prototype we use a value defined by a simulation parameter, so we can control the speed of the simulation and quickly adjust the simulation when instabilities arise.
To improve stability, we use a slightly different integration method. Based on the Verlet integration method \cite{VerletLoup1967C"oC}, which is used extensively in molecular dynamics simulations \cite{jakobsen2001advanced}, the so-called Velocity Verlet method combines simplicity with good numerical precision \cite{SwopeWilliamC.1982Acsm-velocity-verlet, wiki:Verlet_integration}. The algorithm \ref{algo:integrator} illustrate our integration procedure based on this method.
\begin{algorithm}
\caption{Integrator} \label{algo:integrator}
\begin{algorithmic}[1]
\For {every $blob$ of all $blobs$}
\State $particles \gets \text{list/array of all particles in } blob$
\For {every $particle$ of $particles$}
\State $\vec{p} \gets \text{property $position$ of } particle$
\State $\vec{v} \gets \text{property $velocity$ of } particle$
\State $\vec{a} \gets \text{property $acceleration$ of } particle$
\State $\vec{F} \gets \text{property $force\_accumulator$ of } particle$
\State $t \gets \text{TIME-STEP parameter}$
\State $d_v \gets \text{VELOCITY DAMPING parameter}$
\State $\vec{p'} \gets \vec{p} + \vec{v}t + 0.5t^2\vec{a}$
\State $\vec{a'} \gets \vec{F} m^{-1}$
\State $\vec{v'} \gets d_v\vec{v} + (\vec{a} + \vec{a'})/2$
\State $\vec{p} \gets \vec{p'}$
\State $\vec{v} \gets \vec{v'}$
\State $\vec{a} \gets \vec{a'}$
\text{clear $force\_accumulator$ of $particle$}
\EndFor
\EndFor
\end{algorithmic}
\end{algorithm}
Notice that when the velocity is updated, the current velocity is multiplied by a damping factor $d_v$, which is a simulation parameter. It controls how much velocity is left after the update. Thus, this damping factor has the role of removing energy added through numerical instability in the integrator, and can also be used to simulate real-world drag \cite{game-physics-millington, physics-game-developers-oreilly}.
\subsubsection{Collision detection}
One important aspect of our prototype is the interaction between the blobs. We expect the blobs to push and shove each other, and that, in practice, translates into detecting and resolving collisions between particles.
The particles are represented as circles centered on their \texttt{position} property with radius \texttt{r}. To detect collisions, the collision system must first compute the interpenetration between pairs of particles. The penetration can be calculated as the difference between the distance from one particle to the other and the minimum distance before the particles start overlapping (the sum of their radii):
\[
\vec{d} = \vec{p_1} - \vec{p_2}
\]
\[
d_{MIN} = r_1 + r_2 = 2r
\]
Figure \ref{fig:collision-detection} illustrates the three possible situations regarding interpenetration.
\begin{figure}[h]
\centering
\includegraphics[width=\textwidth]{figures/scheme-collision.png}
\caption{Collision detection}
\label{fig:collision-detection}
\Description{A scheme showing the three possible situations regarding the position of a pair of circles.}
\end{figure}
It would be unnecessarily expensive to check every possible combination of pairs of particles at each frame. Instead, we use a grid system of cells to check possible collisions only between a given particle and the particles in its cell (or in the eight surrounding cells). Figure \ref{fig:collision-grid} illustrates this idea, showing the particles of two different blobs, and highlighting the particles (in pink) that are in the same cell or in the immediate surrounding cells of a given particle (in blue).
\begin{figure}[h]
\centering
\includegraphics[width=0.5\textwidth]{figures/collision-grid.png}
\caption{Grid system for collision detection}
\label{fig:collision-grid}
\Description{Two blobs made up of particles where one particle is highlighted in blue, and all particles within its cell and the surrounding cells are highlighted in pink.}
\end{figure}
Given the small radius of the particles, it may happen that, from one frame to another, one particle could completely traverse another particle. In this situation, the distance between the two particles would remain above the minimum distance ($2r$) in both frames, and the collision system would not flag a collision. But this could cause part of one blob to cross the boundaries of another, which is very undesirable. To solve this situation, we use larger circles as colliders. Each particle has a corresponding collider, placed in such a way that their outer borders coincide (Figure \ref{fig:collision-detection-colliders}).
\begin{figure}[h]
\centering
\includegraphics[width=0.5\textwidth]{figures/collision-detection-colliders.png}
\caption{Actual colliders used in the collision detection system}
\label{fig:collision-detection-colliders}
\Description{Two blobs made up of particles where some of the particle's colliders (larger circles) are represented.}
\end{figure}
Therefore, the first step of the collision system is to loop over all particles and compute distances to other particles (to be more precise, to compute the distance between their colliders) in its vicinity (algorithm \ref{algo:collision-detection}. If the distance is less or equal to the sum of the colliders' radii, that is if $penetration = d_{MIN} - d \ge 0$, a collision is registered, along with the collision's contact normal $\hat{d}$ (a unit vector in the direction that connects the centers of the colliders).
\begin{algorithm}
\caption{Collision detection} \label{algo:collision-detection}
\begin{algorithmic}[1]
\For {every $particle_1$ of all $particles$}
\State text{Get current cell index, and the indices of the neighboring cells}
\State $neighboring\_particles \gets \text{list/array of particles in neighboring cells}$