Occasionally someone asks in one of the POV-Ray or other 3D graphics forums: "How do I make a shape or path like a baseball seam?" This page answers the question, with explanations.

The equations come out fairly simple, if not obvious. The curve that the seam follows is a closed loop, a topological circle, so I parametrize the points along it with an angle α with no direct geometric meaning, running from 0 to 360 degrees. (If you didn't see a lower case alpha, then your browser isn't understanding HTML entities for Greek letters -- α and the like, or it's not using the Symbol font.)

We create the basic formula in two steps, with some further steps that may be useful depending on what you're using the formula for.

- Guess a formula for <x,y,z> coordinates
for a point S (for
__S__eam) as a function of α Aim for the right general shape, with the right symmetries but don't worry about distance from the origin. - Normalize the length of the vector defined by S from the origin to a fixed value R, the radius of the baseball.
- The spacing of points along the seam may turn out to be uneven with steadily increasing α; we find some way to fix this.
- To place objects along the seam - stitches, bugs, buildings - we need to define directions and transforms to orient them sensibly.

With xyz axes defined and a sketch of a baseball,
I derived formula by visualizing the baseball seam's curve in
my mind, sketching it on paper, considering its symmetries, inflection points and such,
then sketching crude plots of x(α), y(α), and z(α).
Z(α) came out as a roughly cosine shape
with a frequency of two cycles.
The other two coordinates were sine and cosine but needed some dimples to reverse their
peaks. This can be done by adding a harmonic of frequency of 3.

With a little more thought and refinement, and defining a couple constants, B and F,
i wrote down this formula for the unnormalized x,y,z coordinates:

B is a constant with a value in the range of about 0.4 to 0.8, with 0.6 or a little more being the best-looking. It controls the shape of the curve, how much the loops backfold. The middle transparent ball in 3D rendering above shows this the best - how the top and bottom loops of the seam bend to the center. If B is too big, they would touch. Too small, and they'd not backfold at all. When B is zero, the seam, seen in that orientation, would appear as a circle with a wave bending it in and out of the screen.

The other constant F doesn't have as much effect on the curve, but after my first attempt where i omitted it (assuming F=1) i discovered it's better to allow for it. The image shown at the top of this page, made during that first attempt, used B=0.6 and F=1.0 which certainly looks baseballseamesque.

Of course, you may use any crazy values for B and F you like for making wild shapes.

B=0.4 F=1.0 |
B=0.6 F=1.0 |
B=0.8 F=1.0 |

click for larger image |

Step Two is basic 3D math. A seam point S(α) should be on a sphere of radius R, but we have
are given the unnormalized point <x_{u}, y_{u}, z_{u}>.

= 1+B

Use these final

Note that the distance of the point, before we normalize it, varies with α in a way involving
*sin*^{2}(2α) and *cos*^{2}(2α); if we choose B and F so that

F^{2} - 2B = 2 B

F^{2} = 4B

F = 2*sqrt*(B)

F

F = 2

then these terms will simplify to a constant. We then have r

I used color dispersion with glassy baseballs to make the image interesting, and show the seam from many angles. The script should work fine with any POV-Ray from 3.5 on, and Mega-POV. I think i used version 3.1g once upon a time. (This script has been revised since the original posting of these pages in 1999. Back then, I had hacked a bizarre 9-component color space to implement color dispersion with metamerism effects.)

As the seam-tracing parameter α increases, do we get points evenly
spaced along the seam? By differentiating the coordinates <x,y,z> w.r.t. α,
and now taking α as measured in radians, we define a velocity vector **V**:

V

= 1 + 9B

Hmmm, if we choose F=3B, we get constant speed for free. Earlier, we had found a constant
unnormalized radius by setting F^{2} = 4B. If we insist on both, we find
B=4/9= 0.444… which is somewhat short of the artistic ideal of B near 0.6 found earlier.
But then, we're now setting F=4/3 instead of F=1 like we had before - we might as well
render an image to see what these "magic" numbers lead to:

Hey, looks great! Except for the even spacing of the beads along the seam path, it looks quite similar the B=0.6, F=1.0 case. Well let us officially adopt the values:

B = 4/9 = 0.4444…

F = 4/3

*r*_{u}^{2} = 13/9

V^{2} = 1 + 9B^{2} + 6B

(*geometry units per radian*)

*x = (1/13)R[9 **cos*(α) - 4 *cos*(3α)]

*y = (1/13)R[9 **sin*(α) + 4 *sin*(3α)]

*z = **(12/13)R cos*(2α)

F = 4/3

V

(

So far all we've done is find points along a seam. In a real projects, we would probably want to position complex objects in proper orientation along the seam, for example, a element of a stitch, to be repeated along the entire path. To do this we need a way of defining directions relative to the curve at any point along it. A set of mutuallly perpendicular, unit-lengths vectors, known as a triad, can be set up at each point along the seam with a little easy differential calculus.

One direction easily defined - the "V" vector we just defined above. This points straight along the curve.

Another direction easily defined is simply radially away from the center of the
baseball - normal to the baseball's surface at any point along the seam. Call this **N**
If for some given α our point S(α) is at <x, y, z> then **N**
is simply <x, y, z> normalized to unit length.

The third unit vector in the travelling triad, call it **W** for side__W__ays,
is just the cross product of **V** and **N**.
If you were an ant walking along the seam in the direction of increasing α, **W** would always point to your right.

It is not worth the bother to write out an mathematical expression for **W** in terms
of trig functions. **V** and **N** are easy enough to calculate, and all we need to do
for **W** is figure a cross product, and be careful about normalizing.

N

N

N

W

W

W

Paul Bourke at Swinburne has a page describing a baseball seam curve using trig functions phase modulated by more trig functions. Not as analytically tractable as our truncated harmonic series. But he has pages describing many other interesting curves, the websurfing of which could kill for you a whole day of precious time.

Auto-CAD users may like this tutorial that
creates a baseball seam with stitching using four circular arcs and Auto-CAD's ability to replicate objects
and holes.

For questions, comments, beer critiquing sessions, or if you wish to make an irresponsibly large donation, contact Daren Scot Wilson at GreenSquiggle@comcast.com.

Last Updated June 18th, 2006

Previous major update: summer 1998.