The GNU 3DLDF Spheres Page

Author: Laurence D. Finston

This copyright notice applies to the text and source code of this web site, and the graphics that appear on it. The software described in this text has its own copyright notice and license, which can be found in the distribution itself.

Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024 The Free Software Foundation, Inc.

Permission is granted to copy, distribute, and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of this license is included in the file COPYING.TXT

Last updated: October 20, 2009

Table of Contents

Sphere and Dome Models

Back to top
Back to Quadric Surfaces page
Back to main page


I've now added the data type sphere to the 3DLDF language. It corresponds to the type class Sphere in the C++ code. There are currently two types of spheres: Globe-Type Spheres and Panel-Type Spheres (illustrated below).

The 3DLDF code for the following images is in the file sphrsmp0.ldf.
The file sphrsmp0.tex contains TeX code for including the images generated from sphrsmp0.ldf.
The file sphrsmp0.txt is the same as sphrsmp0.tex. It can be viewed if your browser is as stupid as mine, and won't display the latter as plain text.

Both types of spheres are created with their centers at the origin by default. Assuming they haven't been transformed, globe-type spheres have horizontal circles (i.e., circles parallel to the x-z plane) of different sizes, with their centers at different positions along the the y-axis. The vertical circles, however, are all the same size, with their centers at the origin, but rotated at equally spaced angles about the y-axis. Globe-type spheres thus have north and south poles only.

[Globe-Type Sphere]

Globe-Type Sphere

Again, assuming they haven't been transformed, panel-type spheres have horizontal circles like globe-type spheres. Unlike globe-type spheres, however, the vertical circles are similar to the horizontal circles, but rotated by 90°. That is, they are of different sizes and their centers are at different positions along the x-axis. Panel-type spheres thus have east and west poles, as well as north and south ones. They also have an additional vertical circle that lies in the x-y plane. Without this circle, the series of steps formed by the horizontal circles makes the sphere look less spherical. However, this may not help if the sphere is transformed. This is a general problem with wire-frame representations of spheres.

I did try adding a third set of circles, parallel to the x-y plane, with their centers along the z-axis. Such spheres have front and back poles, too. However, while indisputably spherical (in the sense that all of the points on the circles lie on the sphere), they were rather confusing to look at. I therefore decided not to use them.

[Panel-Type Sphere]

Panel-Type Sphere

spheres can be constructed, drawn, and transformed, but I haven't yet implemented a full set of parser rules for operations on them. I plan to work on parser rules and functions for the following features in the near future:

  1. Determining the location of a point with respect to a sphere.

There are other features that I'd like to implement, but they will probably take much more time:

  1. Determining the circle or ellipse that represents the outline of a particular projection of a sphere.
  2. Finding the figures formed by the intersection or union of a sphere with another sphere or other non-planar figures, such as polyhedra, ellipsoids, cylinders, tori, etc.
  3. Rendering the surface of spheres (and other solids) realistically.

Back to contents
Back to top
Back to Quadric Surfaces page
Back to main page


The 3DLDF code and TeX code for the examples in this section can be found sphrint_0.ldf and sphrint_0.txt , respectively.

Intersection of a Sphere and a Line

[Sphere-Line Intersection 1]

Intersection of a Sphere and a Plane

If the plane is merely tangent to the sphere, the intersection is a point. I haven't accounted for this case yet. However, if it actually passes through the sphere, it is a circle.

In the following sequence of images, the sphere has a radius of 3cm. In the first image, its center is located at (0, -2.75cm, 0). The center of the rectangle is at the origin, and it's rotated by 5° about the x and z-axes. In each of the subsequent images, the sphere is shifted upwards (along the positive y-axis) by 1cm, and the rectangle is rotated by an additional 5° about the x and z-axes.

[Sphere-Plane Intersection 1]

[Sphere-Plane Intersection 2]

[Sphere-Plane Intersection 3]

[Sphere-Plane Intersection 4]

Back to contents
Back to top
Back to Quadric Surfaces page
Back to main page