Cameron's Blog - Tufte Stufte

Tufte Stufte

Contents

This is not a margin note.This is a margin note. As you can see, it is to the right of the left, and it indeed appears to be smaller. Were it a margin note as one might presuppose, it would be to the right of the left and perhaps a bit smaller.

In the having of a new thought, I find myself overcome with thoughtfulness. You might say, perhaps you would be! You would be overcome with thoughtfulness, as it is a thought.

Thank you for saying so.

Quick, look at some math! \[ x = 2+2 \] Tell me, what is \(x\)?

Even better, here is a chart with made-up numbers. Look how fancy and interactive it is.

Don’t worry, it’s quite boring – you’re not missing out on anything.But no, in all seriousness, I thought I’d take the chance to explore Bezier curves while I’m mucking about with some fun looking theming. Bezier curves came up at work, the details of which I don’t really know whether or not I can share. So, I won’t.

bezier <- function(t, p) {
  # A simple Bezier curve
  x = (1 - t) * (1 - t) * p[1, 1] + 2 * (1 - t) * t * p[2,1] + t * t * p[3,1]
  y = (1 - t) * (1 - t) * p[1, 2] + 2 * (1 - t) * t * p[2,2] + t * t * p[3,2]
  
  return(c(x,y))
}

points <- matrix(c(0, 5, 1, 0, 2, 3), ncol = 2)
line <- matrix(bezier(0:100/100, points), ncol=2)
head(line)
##        [,1]   [,2]
## [1,] 0.0000 0.0000
## [2,] 0.0991 0.0399
## [3,] 0.1964 0.0796
## [4,] 0.2919 0.1191
## [5,] 0.3856 0.1584
## [6,] 0.4775 0.1975

Basically, we just plot a bunch of smaller points on a new, continuously defined function that has a nifty little bend in it.

Neato. What a great Bezier curve. Thanks to xan on StackOverflow for providing the pseudocode for that Bezier curve.

Now, I’d like to ask you to hang out with that curve for a little while and consider it’s elegance, if you would be so kind.