diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2024-10-10 17:58:30 -0400 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2024-10-10 17:58:30 -0400 |
| commit | 6a18f738c8dd6e3fe9f21c27f70f7df201e54d24 (patch) | |
| tree | 89075957cd8110d11fb703ff7d4a1f900884f536 | |
| parent | 6e0903b459b339e404ad519467353ab0b526cfb5 (diff) | |
| download | balls-6a18f738c8dd6e3fe9f21c27f70f7df201e54d24.zip | |
move report to its own directory
| -rw-r--r-- | report/k5.gv (renamed from k5.gv) | 0 | ||||
| -rw-r--r-- | report/k5_1.gv (renamed from k5_1.gv) | 0 | ||||
| -rw-r--r-- | report/k5_2.gv (renamed from k5_2.gv) | 0 | ||||
| -rw-r--r-- | report/k5_3.gv (renamed from k5_3.gv) | 0 | ||||
| -rw-r--r-- | report/k5_4.gv (renamed from k5_4.gv) | 0 | ||||
| -rw-r--r-- | report/k5_5.gv (renamed from k5_5.gv) | 0 | ||||
| -rw-r--r-- | report/k5_6.gv (renamed from k5_6.gv) | 0 | ||||
| -rw-r--r-- | report/k5_7.gv (renamed from k5_7.gv) | 0 | ||||
| -rw-r--r-- | report/report.tex (renamed from report.tex) | 13 |
9 files changed, 8 insertions, 5 deletions
diff --git a/report.tex b/report/report.tex index a2d8409..2003af2 100644 --- a/report.tex +++ b/report/report.tex @@ -1,4 +1,4 @@ -\documentclass{article} +\documentclass[11pt]{article} \usepackage{graphicx} \usepackage{listings} \usepackage{xcolor} @@ -56,6 +56,7 @@ A concrete example will illustrate how this works. Consider the case of $n = 5$. $B = \{0, 1, 2, 3, 4\}$. Each ball has to be tested for collision with every other ball, so $C = \{(0, 1), (0, 2), (0, 3), (0, 4), (1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)\}$. + This is what $G$ will look like: \includegraphics[width=0.25\textwidth]{"k5.png"} @@ -77,9 +78,11 @@ Note that no edges within a cell share an endpoint---they can be computed concur Pseudocode for partitioning the collisions: \begin{lstlisting} struct Collision { Ball b1, b2; } +typedef [][]T Partition<T> \end{lstlisting} \begin{lstlisting} -Partition<Collision> partitionCollisions([]Ball balls) { +Partition<Collision> +partitionCollisions([]Ball balls) { G := complete graph on balls P := empty partition @@ -93,7 +96,8 @@ Partition<Collision> partitionCollisions([]Ball balls) { } \end{lstlisting} \begin{lstlisting} -[]Edge matching([]Edge E) { +[]Edge +matching([]Edge E) { M := empty []Edge for each Edge e in E { @@ -113,8 +117,7 @@ Partition<Collision> partitionCollisions([]Ball balls) { The part of the program that constructs the partition can be found in \texttt{partition.cpp}. The program simply initializes the balls, and passes them to \texttt{partitionCollisions()} to construct the partition. -Each frame it loops through the cells of the partition and uses \texttt{parallel\_for()} to call \texttt{collideBall()} with each pair of balls in the cell. -This is performed by \texttt{animate()} in \texttt{balls.cpp}. +Each frame, a call to \texttt{animate()} loops through the cells of the partition and uses \texttt{parallel\_for()} to call \texttt{collideBall()} with each pair of balls in the cell. \texttt{parallel\_for()} was also used to parallelize some other trivial loops with no depences between iterations. |