Barycentric coordinates and random distribution of points

This morning, John D. Cook posted an article about generating uniformly distributed points over the interior of a triangle. He offered three options, one that failed to distribute the points uniformly and two that succeeded. I want to talk about the failure.

In the failure, he used barycentric coordinates to describe locations within the triangle. These coordinates, which I called area coordinates (because that’s the terminology I learned 40 years ago) in a post written a few years ago are a set of three values in the [0, 1] range, each representing how close the point in question is to one of the triangle’s corners. You can follow the links to get more complete descriptions. One important characteristic of these coordinates is that they are not independent of one another—their sum has to equal one.

Cook’s failed approach (which he knew would fail) consisted of three steps:

  1. Generate random numbers α, β, and γ from the interval [0, 1].
  2. Normalize the points to have sum 1 by dividing each by their sum.
  3. Return αA + βB + γC.

where A, B, and C are the three corner points of the triangle.

He gives an example of randomly generated points and shows that this procedure doesn’t lead to a uniform distribution of the points over the interior of the triangle. But he doesn’t explain why, which is what I spent some time this afternoon exploring.

Cook’s first step generates uniformly distributed points in the unit cube that has one of its corners at the origin of the Cartesian (α,β,γ) coordinate system.

Cube of uniform distribution

The normalization in the second step creates three new values, α-, β-, and γ-, where

α-=αα+β+γ

β-=βα+β+γ

γ-=γα+β+γ

This projects the point onto the α+β+γ=1 plane, which slices through the cube, making a tilted equilateral triangle whose corners are at the (1, 0, 0), (0, 1, 0), and (0, 0, 1) corners of the cube. I’m going to call this the normalization plane.

Cube with normalization plane

By “projection,” I mean the point is moved along the line defined by the point and the origin until it intersects with the plane. That movement could be either toward the origin or away from it, depending on which side of the normalization plane the original point lies. Here’s a figure that illustrates this idea:

Projection onto normalization plane

If the point generated in Step 1 lies anywhere on the red line, the normalization in Step 2 will move it to the red dot. I’ve changed the viewing angle so it’s easier to see that the red dot is on the normalization plane.

The line I’ve drawn above, which runs out from the origin to the opposite corner of the cube, is the longest such line that can be drawn. It’s length is 31.732. The shortest such lines, of which there are three, run out from the origin to the adjacent corner on an axis; they all have lengths of 1.

The lengths of the lines correspond to the relative likelihood of a point on the normalization plane being generated by the combination of Steps 1 and 2. So a point near the center, as in the image above, is 1.732 times as likely to be generated as a point out near one of the corners. This is how we get nonuniformity in the normalized points even though the original random points are uniform.

Here’s an illustration. I generated 10,000 points uniformly in the unit cube and normalized them. An isometric view looking toward the origin from the opposite corner of the cube shows the points on the normalization plane distributed like this:

Random points after normalization

This matches the distribution over an equilateral triangle shown on this MathWorld page, which uses the same procedure we are.1

Cook’s final step is just a distortion of the above equilateral triangle to a more general triangle. If you look at his first figure, it should be pretty obvious how it’s just a squeezed, stretched, and rotated version of the figure above. The main features of the distribution—sparse near the corners, denser at the midsides, and densest at the centroid—are maintained through the distortion.

I suppose I could work out the joint probability distribution of the normalized coordinates using the technique I talked about in this post and this one. But my goal was to understand why the distribution had the pattern it does, not to work out all its mathematical details. Thinking about the line lengths got me there.


  1. MathWorld calls them trilinear coordinates instead of barycentric or area coordinates. Varying nomenclature can be fun! 


Iowa jewel box bank 3

I was in Cedar Rapids Wednesday afternoon to see the final Louis Sullivan jewel box bank in Iowa. It was kind of disappointing but still had some nice details.

Front facade

The first disappointment was that the bank is now a restaurant with the 80s-style name of Peppercorn.1 This means the interior will be very different from the original. I say “will be” because the second disappointment was that the restaurant was closed, I couldn’t see the interior for myself. I thought about killing a couple of hours around Cedar Rapids and having dinner at Peppercorn, but it just didn’t seem worth it. I could see the true Sullivan details on the exterior.

Which leads to the third disappointment. The decorative border around the entranceway is missing. You can see a slightly different color in that area where the border used to be.

Entrance

The now-missing entrance details can be seen on the building’s Wikipedia page, in a photo taken about 20 years ago.

Let’s move on to the good stuff. There are several nice terracotta accent pieces on the front and side façades.

Terracotta accent piece

At the time of construction, the bank’s name was People’s Savings Bank, and you can see the stylized initials in the center of the piece. The rough texture is carried through on the horizontal pieces under the windows and on some other accent pieces above the windows.

Facade detail

The square terracotta decorations on the chimneys are geometric and also have that rough texture on the outside surfaces.

Chimney decoration

I like the changing depth of the central diagonal lines. They start out nearest to us at the corners but duck under the other diagonals as they run into the middle diamond.

You can see all but the lower bit of the stained glass windows on the front façade.

Stained glass windows

The figures on the tops of the pilasters are grotesque lions. I like these more than the gilded and less stylized lions at the entrance of the Grinnell bank.

Lion atop pilaster

The photos on the Wikipedia page show that both the square grille and the lions used to be part of the decoration above the entrance.

Finally, there’s the historic landmark plaque in the doorway.

Historic plaque

Eventually, I’m going to travel east to see the three jewel box banks in Ohio and Indiana. I’m holding off until the restoration of the one in Newark, Ohio, is finished.


  1. Strictly speaking, if this were the 80s, Peppercorn would be the surname of the fictional owner, and the restaurant would be something like R.J. Peppercorn’s. Close enough. 


Iowa jewel box bank 2

This morning I visited the Louis Sullivan jewel box bank in Grinnell, Iowa. Built in 1914, this one is known as the Merchant’s National Bank.

Merchants National Bank

Like the others, it’s a National Historic Landmark.

Historic plaque

Personally, I think Sullivan went overboard on the entranceway decoration here. The gigantic enclosure for the front stained glass window is too big for the building,

Front facade

and the lions on either side of the entrance are heading into the realm of kitch.

Edge of entranceway

I like decoration, but this is a far cry from “form follows function.”

The current lions, by the way, are reproductions, built after some vandalism to the originals. The originals were moved into the building. One of them is in pretty good shape,

Preserved lion

while the other’s broken pieces are kept behind glass.

Broken lion

I prefer the long side of the building, with its repeated tall stained glass windows and columns.

Long side of building

Capital

The top edge of the building might be considered overdone,

Top edge of building

but I think its distance from the viewer tones it down. The repeated elements over the plain windows on the front and side are considerably simpler because they’re closer to us.

Plain window

As you can see, this building, like the one in Algona, is currently home to the local Chamber of Commerce. The difference is that this building used to be a bank, while Algona’s never was.

While it was still a bank, it got an addition that I think deserves some praise. Here, you can see the addition (which is still a bank) in context with the original building.

Original and addition

Three things I like about the addition:

Inside, you get a better view of the stained glass windows at the front and the side.

Front stained glass window and clock

Side stained glass windows

I don’t know if the pendant lighting is original, but it looks like it.

Pendant light

There’s a collage of images on a wall at the rear of the original building, next to the doors that lead into the addition. Most of them are old photos, but they also included some drawing excerpts, which I appreciated.

Drawings

Too bad other people don’t see the beauty in title blocks.


Iowa jewel box bank 1

With the Labor Day weekend behind me, I drove from Minnesota down into Algona, Iowa, to see the first of three Louis Sullivan jewel box banks in the Hawkeye State.

Long side of bank

Front of bank

Strictly speaking, this isn’t—and never was—a bank. Wikipedia calls it the Henry Adams Building, and the plaque on the side calls it the Algona Land and Loan Office.

Historic plaque

For much of its life, it was the home of the Druggists Mutual Insurance Company. It now contains the offices of the Algona Chamber of Commerce.

Entranceway

The pedestals with the pots are part of an entranceway that sits forward of the true front wall of the building. The terracotta squares at the two bottom corners are nicely detailed.

Entranceway terracotta piece

The windows on the long side of the building are decorated in a more geometric, less organic way.

Side window upper detail

Side window lower corner detail

Side window sill detail

A feature I especially liked is the decorative strip along the bottom of the wall.

Bottom of wall

According to the nice young woman working in the Chamber of Commerce office, virtually nothing of the interior—except maybe the tile floor, most of which is covered by carpeting—is original or even a restoration of the original, so I won’t show much of it. The front stained glass windows may be original,

Interior view toward entrance

Front stained glass window

and the stained glass windows along the side are apparently modeled on the originals.

Side stained glass window

This building is certainly a step below the palaces I saw in Columbus and Owatonna, but it still has some nice details. If a set of drawings exist somewhere, I’d like to see them to get a sense of what Sullivan intended for the interior.