Arvind RaoMathematician / Software Engineer. <a href="https://twitter.com/cwcomplex" target="_blank">@cwcomplex</a>.daily1
https://rao.im
Thu, 03 Mar 2022 00:00:00 +0100Perspective Projection<p>Derivations of the perspective projection matrix, whether in books or on the web, always feel either overly complicated or completely lacking in detail–sometimes the perspective projection matrix is just stated without much explaination. In surveys of image projection, that is projection of a 3D scene to 2D, orthographic projection is presented as a contrasting method without relation to perspective projection. While the light model–how light travels to the image plane–underlying the different projection types differ, both can be formulated as projective transformations from their respective view volumes to the canonical view volume. Once in the canonical frame, $x$ and $y$ coordinates are already considered <em>projected</em>, which is to say they are in image plane coordinates; so <mark>both perspective projection and orthographic projection are image projections on each depth slice of their respective view volumes</mark>. When rendering to the screen, depth information is required to determine those objects and parts of objects not occluded by other objects.</p>
Thu, 03 Mar 2022 00:00:00 +0100
https://rao.im/computer%20graphics/2022/03/03/prospective-projection/
https://rao.im/computer%20graphics/2022/03/03/prospective-projection/Projecting a 3D Scene to the Image Plane<p><strong>Given a 3D scene in world coordinates, how does an image of the scene form in the camera, and how do 3D scene points project to the image plane?</strong> The short answer to the later question is the <a href="#the-camera-matrix">camera matrix</a>. And this short note is devoted to deriving the <a href="#the-camera-matrix">camera matrix</a>. First some mathematical preliminaries.</p>
Sat, 26 Feb 2022 00:00:00 +0100
https://rao.im/computer%20graphics/2022/02/26/camera-matrix/
https://rao.im/computer%20graphics/2022/02/26/camera-matrix/Rotating Homogeneous Polynomials & Representations of $SO(3)$<p>Under the guise of rotating solid spherical harmonic functions, I want to investigate the computational aspects of representing rotations of homogeneous polynomials. The connection being that harmonic homogeneous polynomials are solid spherical harmonics. My goal in this note is to rotate solid homogeneous polynomials ( in variables $x$, $y$, and $z$ ) by computing representations of $SO(3)$ on \(\mathcal{P}_d\), homogeneous polynomials of degree $d$. One nice aspect of computing representations of $SO(3)$ is that only algebra is required. Differential equations typically used to describe/derive spherical harmonics make no appearance in what follows.
<!--more--></p>
Fri, 25 Oct 2019 00:00:00 +0200
https://rao.im/mathematics/2019/10/25/compute-so3-repns/
https://rao.im/mathematics/2019/10/25/compute-so3-repns/Area Forms & Normals<p>To compute the area form of $S^3$, I used a general <em>formula</em> for $S^n \subset \mathbb{R}^{n+1}$ that I found in Lee’s <em>Introduction to Smooth Manifolds</em>.</p>
Tue, 10 Apr 2018 00:00:00 +0200
https://rao.im/mathematics/2018/04/10/computing-normals/
https://rao.im/mathematics/2018/04/10/computing-normals/Parameterizing the Space of 3D Rotations<p>3D medical images in the NifTI format store data from MRI acquisitions of some anatomy, like a human brain or heart. When I was a postdoc @Penn <a href="https://www.cbica.upenn.edu">my lab</a> was primarily interested in studying brains. Each image associates grayscale values ( in the simplest case ) to discrete coordinates $(i,j,k)$, which describe voxel locations. And for reasons best explained by <a href="https://nifti.nimh.nih.gov/nifti-1/documentation/faq#Q17">NifTI FAQ</a> it’s useful/important to align the acquired image to some other coordinate system. This alignment is stored in the image header, as a rigid motion plus an offset. Here’s a bit of <a href="https://nifti.nimh.nih.gov/pub/dist/src/niftilib/nifti1.h">NifTI documentation</a> motivating the need to keep the alignment.</p>
Sat, 30 Dec 2017 00:00:00 +0100
https://rao.im/mathematics/2017/12/30/parametrizing-the-space-of-3d-rotations/
https://rao.im/mathematics/2017/12/30/parametrizing-the-space-of-3d-rotations/3 Points Make a Circle<p>While learning about Voronoi diagrams from <a href="https://www.amazon.de/Computational-Geometry-Applications-Mark-Berg/dp/3540779736">Computational Geometry</a>, I had trouble justifying a single statement from a proof regarding the complexity ( as a function of $n$ sites ) of Voronoi diagrams. For completeness I’ll restate the theorem here.</p>
Fri, 30 Jun 2017 00:00:00 +0200
https://rao.im/mathematics/2017/06/30/three-points-make-a-circle/
https://rao.im/mathematics/2017/06/30/three-points-make-a-circle/Functional Prime Number Sieve<p>In a <a href="http://www.rao.im/mathematics/2014/04/20/super-simple-primality-testing/">post a few years ago</a> I discussed primality testing. For some reason I thought I described the basic prime number sieve (I’m pretty sure there is only one) there, but apparently I didn’t. No worries. The prime number sieve solves a different problem; that of generating a list of the first $N$ primes. One could use a primality testing method to do this as well; namely filter a list of numbers with the primality test as a predicate; but sieve based methods are faster and conceptually much easier.</p>
Tue, 06 Jun 2017 00:00:00 +0200
https://rao.im/mathematics/2017/06/06/prime-number-sieve/
https://rao.im/mathematics/2017/06/06/prime-number-sieve/Losing My Orientation<p>While trying to grok $SO(3) \cong \mathbb{RP}^3$ and understand various parametrizations of $SO(3)$, I wandered a bit (okay maybe more that litte:) ) and started to think about projective space itself. It is well know that real projective spaces alternate between being orientable and non-orientable, as dimension increases. Specifically odd dimensional projective spaces are orientable but even ones are not. For example, $\mathbb{RP}^1$ and $\mathbb{RP}^3$ are orientable but $\mathbb{RP}^2$ is not.</p>
Fri, 12 May 2017 00:00:00 +0200
https://rao.im/mathematics/2017/05/12/losing-my-orientation/
https://rao.im/mathematics/2017/05/12/losing-my-orientation/Sum of the First $N$ Natural Numbers<p>Lately I’ve been thinking about the content of my high school mathematics courses. In my college algebra and trigonmetry class we were introduced to proofs by induction–of all things–somewhere towards the end of my junior year. An important proof technique, for sure. However, the combinatorial expressions they were applied to, like the sum of first $N$ natural numbers, seemed miraculous. Proof by induction is fairly straight forward. But how does one even guess at a closed formula for such expressions? I remember the teacher saying something to the effect “you need to be smart”. I suppose so, but we can actually construct the closed form of the sum of the first $N$ natural numbers.
<!--more--></p>
Sat, 11 Jun 2016 00:00:00 +0200
https://rao.im/mathematics/2016/06/11/sum-of-N/
https://rao.im/mathematics/2016/06/11/sum-of-N/Average Length of the Longest Arc in $S^1$<p>Suppose that we draw $n$ points $ a_i \sim Uniform(S^1)$ for $i = 1 \ldots n $. These points determine a partition or set of disjoint arcs of $S^1$. What is the average length of the longest arc? To even measure the $n$ arc lengths, we need an ordering of the <MTMarkdownOptions output="raw"> $\{ a_i \}$ </MTMarkdownOptions>, <MTMarkdownOptions output="raw">$a_{(1)}, \ldots, a_{(N)} $</MTMarkdownOptions>.</p>
Tue, 13 May 2014 00:00:00 +0200
https://rao.im/mathematics/2014/05/13/average-length-of-longest-arc/
https://rao.im/mathematics/2014/05/13/average-length-of-longest-arc/