Several of these sections describe efficient low-level
operations. Spending energy on simple problems may seem a
waste of time, so why do I do it?
I like to do geometry as simply as possible. It is a joy
to make a program simultaneously smaller, faster, and more
robust. All implementations are tested on the largest
datasets available.
As simple as possible (but no simpler) is a theme of these
data structures and algorithms. Some of these techniques, such as
the uniform grid, appear almost
trivially simple (tho efficient implementation is more
intricate than may be apparent). They are fast only for
"expected data" and are
totally uninteresting to the theoreticians since
the worst case performance is abysmal. The only reasons for
considering them are these.
- The set of "expected data" is large, including every
real data set that I've ever tried.
- On such data, the constant factor for the time is quite small.
- Being so simple, they are easy to implement, correctly, and
optimize. This contrasts to some asymptotically efficient
algorithms that are so complicated that they have not been
implemented yet.
- Being so simple, they are also parallelizable, should parallel
machines become widely used again.
- These heuristic methods occasionally solve problems that do not
have worst-case efficient methods. One example is this. Consider a
set of N red line segments and N blue ones. Assume that there are probably
theta(N2) red-red intersections and also
theta(N2) blue-blue intersections, but you do not know
them. Assume that there are probably theta(1) red-blue
intersections. The problem is to find these, in theta(N)
time. The closest theoretical algorithm requires knowing
the red-red intersections. However, this is easy with a
uniform grid, w/o knowing the red-red intersections.
- Nevertheless, there are interesting theoretical questions
in analyzing when these heuristic methods succeed and fail.
Detailed information is
here.
This 8 line program, an update of what I wrote in 1970,
tests if a point is inside a polygon in E2. It
handles multiple components with nested holes and islands.
Compared to other routines attempting to test point
inclusion, PNPOLY tends to be, simultaneously, smaller,
faster, and more general.
Slides
of a good summary talk presented at Koc University, Istanbul,
16 July, Sabanci University, Istanbul, 20 July, Bilkent
University, 26 July, and Middle Eastern Technical University,
27 July 2004.
This parallelizable algorithm finds all the intersections
among a large number of small line segments in E2.
The time to find all K intersections among N
line segments is an expected (N+K), altho an
adversary can choose input to raise that to
N2. However no real data sets have
exhibited that behavior. Data has been used from cartography,
VLSI design, and nonuniform meshes.
This is a common operation in many higher-level operations
such as boolean combinations. (1977)
Uniform grids are useful in many of the following
applications. This idea is intended to be just sophisticated
enough to solve the problem, without being so complicated that
it is difficult to implement, including the messy special
cases, and parallelize.
The concept, which is useful for culling pairs of objects
that may intersect, is to overlay a uniform grid on the data.
Then iterate over the elements, finding which grid cells each
passes thru. Finally, iterate over the cells, comparing pairs
of elements that pass thru the same cell. Implementing this
properly requires some attention to detail. This method works
well even when the data is unevenly distributed, where one's
first impulse would be to use the, more complicated, quadtree.
(1977)
[afkn-gcugd-89]
V. Akman, WR Franklin, M. Kankanhalli, and Chandrasekhar
Narayanaswami. Geometric computing and the uniform grid data
technique. Computer Aided Design,
21(7):410-420, 1989.
[fnkszw-ugtid-89]
WR Franklin, C. Narayanaswami, M. Kankanhalli, D. Sun,
Meng-Chu Zhou, and P. YF Wu. Uniform grids: A technique for intersection
detection on serial and parallel machines. In
Proceedings of Auto Carto 9: Ninth International Symposium
on Computer-Assisted Cartography, pages 100-109,
Baltimore, Maryland, 2-7 April 1989.
[fcksa-eugid-88] WR
Franklin, N. Chandrasekhar., M. Kankanhalli, Manoj Seshan, and
V. Akman. Efficiency of uniform grids for intersection
detection on serial and parallel machines. In
Nadia Magnenat-Thalmann and D. Thalmann, editors, New
Trends in Computer Graphics (Proc. Computer Graphics
International'88), pages 288-297. Springer-Verlag, 1988.
[fcka-fidspm-88] WR
Franklin, N. Chandrasekhar., M. Kankanhalli, and V. Akman. Fast
intersection detection on serial and parallel machines using
the uniform grid technique. Unpublished.
[f-aggo-84]
WR Franklin. Adaptive grids for geometric
operations. Cartographica, 21(2-3):161-167,
Summer - Autumn 1984. monograph 32-33.
[f-aggo-83]
WR Franklin. Adaptive grids for geometric
operations. In Proc. Sixth International Symposium
on Automated Cartography (Auto-Carto Six), pages 230-239,
Ottawa, 1983.
Nearpt2 is an online program to find nearest points in
2D. It reads a list of points, and preprocesses them into a
data structure. Then it reads a list of query points, and,
one by one, finds the closest fixed point to each query point.
Nearpt2 is very fast and very small. One test used
vertices of two nonuniform meshes from Mark Shepherd.
Processing the 10267 fixed points took about 0.01 CPU seconds
on a 1600 MHz Pentium. Querying all 8005 test points took
about 0.02 seconds.
Another test used 10,000,000 uniformly randomly generated
fixed points and another 10,000,000 query points. The total
preprocessing time was 12 CPU seconds on my laptop. The total
query time was 65 seconds. The virtual memory was 460MB. The
elapsed time including the main program's I/O was 415 seconds. (2003).
More info and the code is here.
Nearpt3 is a pair of subroutines to find nearest
points in E3. Preprocess takes a list of fixed points,
and preprocesses them into a data structure. Query
takes a query point, and returns the closest fixed point to
it.
Nearpt3 is very fast, very small, and can process
very nonhomogeneous data. The largest example run on a laptop
computer was St Matthew from the Stanford Digital Michelangelo
Project Archive, with 184,088,599 fixed points.
Preprocessing the David data set, with 28,158,109 fixed
points, into a 7233 grid took 0.6 microseconds per
fixed point. Each query required 6 microseconds. The
platform was an IBM T43p laptop computer with a 2GHz Intel
Pentium M processor and 2GB of memory.
More info is here.
(12/7/2005)
Connect finds the connected components in a 3-D
rectangular volume of binary voxels (the universe). For
each component, Connect writes its volume, surface area, and
voxels (grouped into runs). Connect can do both 6-connectivity
and 26-connectivity.
Connect is very space- and time-efficient. E.g., processing
one test volume of size 544x544x512, which has 151,519,232 voxels,
about 1/2 empty, to find the 534,723 components, takes only 15 CPU
seconds on a 1600MHz Pentium.
Processing a 2-D 18573x19110 image took 25 CPU seconds.
More details, and the code, are here. (1999)
[capri] G Nagy, T
Zhang, WR Franklin, E Landis, E Nagy, and D Keane. Volume and Surface Area Distributions of Cracks in
Concrete 4th International Workshop on Visual Form
, Capri, Italy, 28-30 May 2001. (paper), (poster).
Volumetric images of small mortar samples
under load are acquired by X-ray microtomography. The images
are binarized at many different threshold values, and over a
million connected components are extracted at each threshold
with a new, space and time efficient program. The rapid
increase in the volume and surface area of the foreground
components (cracks and air holes) is explained in terms of a
simple model of digitization. Analysis of the data indicates
that the foreground consists of thin, convoluted manifolds
with a complex network topology, and that the crack surface
area, whose increase with strain must correspond to the
external work, is higher than expected.
[acse2003] E
Nagy, T Zhang, WR Franklin, G Nagy & E Landis 3D Analysis of Tomographic Images , 16th ASCE
Engineering Mechanics Conference, 16-18 July 2003, U of
Washington, Seattle, Electronic Proceedings.
[conspec]
T Zhang, WR Franklin, E Landis, E Nagy & G Nagy
A Study of Concrete Specimen Change Under Fracture
Volumetric images of small mortar cylinders under load are
acquired by X-ray microtomography. The images are binarized at
different threshold values, and the connected components are
extracted at each threshold with a 3D space- and
time-efficient program. Statistics of volume and surface area
of separated concrete segments and cracks are collected and
analyzed. Under increasing load, the concrete specimen can
undergo size distortion. The largest segments and cracks
account for 99% of the change. Some segments and cracks
merge.
Paper.
Localtopo is a new data structure for representing polygons
and polyhedra by the location and purely local topology of
each vertex. This contrasts with the complete topologies used
in many CAD systems. My local data structure simplifies many
operations, such as determination of the mass properties of
boolean combinations of objects.
[localtopo]
WR Franklin. Local topological properties of
polyhedra. Sept 1992. Unpublished talk.
[f-ppcvn-87]
WR Franklin. Polygon properties calculated from the vertex
neighborhoods. In Proc. 3rd Annu. ACM
Sympos. Comput. Geom., pages 110-118, 1987.
[f-rnrpp-83]
WR Franklin. Rays - new representation for
polygons and polyhedra. Computer Graphics and
Image Processing, 22:327-338, 1983.
E.g., an investigation into why raster graphics algorithms can
be surprisingly counterintuitive and difficult.
For example, consider finding the raster line segment
between two points, such as with the Bresenham algorithm.
Now, pick two points on the interior of that line and draw the
new line segment between them. Probably the points of the new
line segment will not be a subset of the points of the
original line segment. This does not happen with ideal,
vector, lines.
The deep reason that raster graphics can be harder than
vector graphics is that, in algebra, the integers are harder
than the reals, not easier. E.g., first order logic over the
reals with addition and multiplication is solvable. Not so
over the integers.
[f-prga-85]
WR Franklin. Problems with raster graphics
algorithms. In L.R.A. Kessener, F.J. P.s, and
M.L.P. van Lierop, editors, Data Structures for Raster
Graphics, proceedings of a Workshop held at Steensel, The
Netherlands, June 24-28, 1985. Springer-Verlag
EurographicSeminars, 1986.
[f-cesua-84]
WR Franklin. Cartographic errors symptomatic of
underlying algebra problems. In
Proc. International Symposium on Spatial Data
Handling, volume 1, pages 190-208, Zürich, 20-24
August 1984.
This relies on the useful property that, if the input
faces are IID (independently and identically distributed),
then the expected number of visible edge pieces is linear in
the number of input edges, and I can find them all in expected
linear time.
This is remarkable since the total number of intersections
of the projected input edges might be superlinear if the
edges' lengths do not shrink fast enough. However, in that
case, most of those intersections are hidden, and I can delete
them in groups w/o spending even constant time per one. (1978)
[fk-poshs-90]
WR Franklin and M. Kankanhalli. Parallel object-space hidden surface
removal. In Proceedings of SIGGRAPH'90,
volume 24, pages 87-94, August 1990.
[f-ltehs-88] WR
Franklin. A linear time exact hidden
surface algorithm. In K. I. Joy et al, editor,
Tutorial: Computer Graphics: Image Synthesis, pages
218-224. 1988. (Reprint of my 1980 SIGGRAPH paper.)
[fa-agpvo-88]
WR Franklin and V. Akman. Adaptive grid for polyhedral visibility in object
space, an implementation. Computer
Journal, 31(1):56-60, February 1988.
[fa-sehla-87] WR
Franklin and V. Akman. A simple and efficient haloed line
algorithm for hidden line elimination.
Computer Graphics Forum, 6(2):103-109, May 1987.
[f-ehsao-81]
WR Franklin. An exact hidden sphere
algorithm that operates in linear time.
Comput. Graph. Image Process., 15:364-379, 1981.
[f-ltehs-80]
WR Franklin.
A linear time exact hidden surface algorithm.
Comput. Graph., 14(3):117-123, 1980, (SIGGRAPH Proceedings).
[f-chsa-78]
WR Franklin. Combinatorics of hidden
surface algorithms. PhD Thesis. Technical Report
TR-12-78, Center Res. Comput., Harvard Univ., Cambridge, MA,
1978.
Scanned in 4 parts:
This is a better method for creating octrees by a bottom-up
approach instead of using top-down subdivision. The idea is to
intersect 1-D rays with the object, split the part of each ray
that is inside the object into bintrees, group adjacent
bintrees into quadtrees, then group adjacent quadtrees into
octrees. This whole process has a systolic computation
flavor. The advantage of this method is that it iss easier to
intersect the object with a line than with a cube.
(1985)
[fa-bospj-85] WR
Franklin and V. Akman. Building an octree from a set of
parallelepipeds. IEEE Computer Graphics and
Applications, 5(10):58-64, October 1985.
[fa-odscs-85]
WR Franklin and V. Akman. Octree data
structures and creation by stacking. In Nadia
Magenat-Thalmann, editor, Computer Generated Images, State
of the Art. Springer-Verlag, 1985.
[fa-bospi-85] WR
Franklin and V. Akman. Building an octree from a set of
parallelepipeds. In Graphics Interface,
1985.
[af-rorhp-89]
V. Akman and WR Franklin. Representing objects as rays, or how to pile up an
octree? Computers and Graphics,
13(3):373-379, 1989.
[af-rrkt-89]
V. Akman and WR Franklin. Ray
representation for k-d trees. Pattern
Recognition Letters, pages 315-320, November 1989.
This algorithm combines two different triangulations of
the same 3D faceted object, to determine which pairs of
tetrahedra overlap, and the intersection volumes. This is
useful for interpolating data from one triangulation of an
object to another.
(1992)
[fk-vo3tp-93] WR
Franklin and M. S. Kankanhalli. Volumes from
overlaying 3-D triangulations in parallel. In
D. Abel and B.C. Ooi, editors, Advances in Spatial
Databases: Third Intl. Symp., SSD'93, volume 692 of
Lecture Notes in Computer Science, pages
477-489. Springer-Verlag, June 1993.
Consider a polyhedron that is triangulated
into tetrahedra in two different ways. This paper presents an
algorithm, and hints for implementation, for finding the
volumes of the intersections of all overlapping pairs of
tetrahedra. The algorithm should parallelize easily, based on
our experience with similar algorithms. One application for
this is, when given data in terms of one triangulation, to
approximate it in terms of the other triangulation. One part
of this algorithm is useful by itself. That is to locate a
large number of points in a triangulation, by finding which
tetrahedron contains each point.
Keywords: tetrahedron, triangulation, overlay, uniform
grid, finite element model, mass property, uniform grid,
parallel, point location
UNION2 is a demo program that finds the
area and perimeter of the union of many random equal-sized
squares. For example, for 100,000,000 squares with edge
length 0.0006, the cpu execution time on a 1600 mhz pentium
was only 11 minutes.
UNION3 is a fast algorithm for computing the volume, area,
and other mass properties, of the union of many polyhedra.
UNION3 is well suited for parallel machines. A prototype
implementation for identical random cubes has processed
20,000,000 polyhedra, containing half a billion subfacets, on
a dual processor Pentium Xeon workstation in about one
hour.
UNION3 processes all the polyhedra in one pass instead of
repeatedly combining them pair by pair. The first step finds
the candidate output vertices. These are the 3-face
intersections, edge-face intersections, and input vertices.
Next, the candidates are culled by deleting those inside any
polyhedron. The volume is the sum of a function of each
survivor. There is no statistical sampling. Input
degeneracies are processed with Simulation Of Simplicity.
Since UNION3 never explicitly determines the output
polyhedron, messy non-manifold cases become irrelevant. No
complicated topological structures are computed. UNION3's
simple flat data structures permit it to fork copies of itself
to utilize multi-processor machines. The expected time is
linear in the number of input, even when the number of
intersections is superlinear.
The principal data structure is a 3-D grid of uniform
cells. Each cell records overlaps of itself with any edge,
face, or polyhedron. Intersection tests are performed only
between objects overlapping the same cell. However, if a cell
is completely contained in some polyhedron, (covered),
then no intersection tests are performed in it, since none of
those intersections would be visible. Indeed, altho there may
be a cubic number of intersections, all but a linear number
occur in these covered cells, and are never computed.
Therefore the final time is linear.
[nf-dmppcj-91]
C. Narayanaswami and WR Franklin. Determination of mass properties
of polygonal CSG objects in parallel.
Internat. J. Comput. Geom. Appl., 1(4):381-403, 1991.
[siam2003] WR
Franklin, Mass
Properties of the Union of Millions of Polyhedra ,
SIAM Conference
on Geometric Design and Computing, 10-13 November 2003,
Seattle, Washington, USA.
[dimacs2003]
WR Franklin, Mass Properties of the Union
of Millions of Polyhedra , DIMACS
Workshop on Computer Aided Design and Manufacturing, 7-9
Oct 2003. Paper and
talk.
[dimacs2002]
WR Franklin Mass Properties of the Union of Many Squares
(Geometric Operations on Hundreds of Millions of
Objects), DIMACS
Workshop on Implementation of Geometric Algorithms,
4-6 Dec 2003, Rutgers University.
Local topological data structures, uniform
grids, KISS lead to fast implementations on large datasets.
This talk describes our algorithm and implementation to find
the area and perimeter of the union of many squares. For
100,000,000 squares with edge length 0.0006, the CPU execution
time on a 1600 MHz Pentium was only 11 minutes. Similar
principles have led to other fast implementations. For
example, finding the connected components in a 1024x1088x1088
universe of bits took 96 seconds, and connecting the
components in a 2D example of 18573x19110 bits took 25
seconds. Another program finds the areas of all the nonempty
intersections of two planar graphs. One example overlaid
coterminous US counties on hydrography polygons. The two maps
totalled 130K vertices and 5000 polygons. The execution time,
excluding I/O, was 1.58 CPU seconds.
[kf-apcus-92]
M. Kankanhalli and WR Franklin. Area and
perimeter computation of the union of a set of iso-rectangles
in parallel. J. Parallel Distrib. Comput.,
27:107-117, 1995.
[nf-bcpp-92]
C. Narayanaswami. and WR Franklin. Boolean combinations of polygons in
parallel. In Proceedings of the 1992
International Conference on Parallel Processing, August
1992.
[nf-eihc-92]
C. Narayanaswami and WR Franklin. Edge intersection on the Hypercube
computer. Information Processing Letters,
41(5):257-262, 3 April 1992.
[nf-dmppci-91]
C. Narayanaswami and WR Franklin.
Determination of mass properties of polygonal CSG
objects in parallel. In Joshua Turner, editor,
Proc. Symposium on Solid Modeling Foundations and CAD/CAM
Applications, pages 279-288. 5-7 June 1991.
[fckaw-egoc-90] WR
Franklin, N. Chandrasekhar, M. Kankanhalli, V. Akman, and
P. YF Wu. Efficient geometric operations for
CAD. In Michael J. Wozny, Joshua U. Turner, and
K. Preiss, editors, Geometric Modeling for Product
Engineering, pages 485-498. Elsevier Science Publishers
B.V. (North-Holland), 1990.
[fck-pagc-siam-89]
WR Franklin, N. Chandrasekhar, and M. Kankanhalli. Parallel algorithms for geometric
computing. In Final Program, SIAM Conference on
Geometric Design, page A17, 6-10 Nov 1989. (abstract
only).
[f-eiclb-89]
WR Franklin, M. Kankanhalli, C. Narayanaswami, and V. Akman.
Efficient intersection calculations in large
databases. Short version published in
International Cartographic Association (ICA) 14th World
Conference, pages A-62 - A-63, Budapest, August 1989. Unpublished full paper.
[fkn-epgol-89] WR
Franklin, M. Kankanhalli, and C. Narayanaswami. Efficient primitive geometric operations on large
databases. In Proceedings National Conference
Challenge for the 1990s GIS Geographic Information
Systems, pages 1247-1256, Ottawa, 27 February - 3 March
1989. Canadian Institute of Surveying and Mapping.
[f-epiu-82]
WR Franklin. Efficient polyhedron intersection and
union. In Proc. Graphics Interface, pages
73-80, Toronto, 1982.
[akman-dublin]
V. Akman, A. Arslan, WR Franklin, and P. J. W. ten Hagen.
Implementing a topological
picturebook. In Proc. 13th IMACS World Congress on
Computation and Applied Maths, Dublin, 1991.
[akman-mental]
V. Akman, D. Ede, WR Franklin, and P. J. W. ten Hagen. Mental models of force and motion. In
Okyay Kaynak, editor, Proc. IEEE International Workshop on
Intelligent Motion Control, volume 1, pages 153-158,
Bogazici University, Istanbul, 20-22 August 1990. IEEE
Press. Catalog No. 90TH0272-5.
[akman-design-89]
V. Akman, WR Franklin, and B. Veth. Design
systems with common sense. In PJW ten Hagen and
P. Veerkamp, editors, Proceedings of the Third
Eurographics Workshop on Intelligent CAD Systems: Practical
Experience and Evaluation, pages 317-322, Texel, the
Netherlands, 3-7April 1989. Springer-Verlag.
[fa-wcusp-87] WR
Franklin and V. Akman. A workbench to
compute unobstructed shortest paths in three-space. In
Proc. 1st Internat. Conf. Indust. Applied Math.,
pages 1-38, Paris, France, 1987.
[akman-barcelona-86]
V. Akman and WR Franklin. Locus techniques
for shortest path problems in robotics. In IFAC
Symposium on Robot Control (SYSROCO'85). Barcelona, 1986.
[af-oqiss-86] V. Akman
and WR Franklin. On the question `is
$\sum_1^n \sqrt{a_i}\le l' ?$ EATCS Bulletin,
(28):16-20, February 1986.
[fa-rvrvs-86] WR
Franklin and V. Akman. Reconstructing visible regions from visible
segments. BIT, 26:430-441, 1986.
[fa-sp3sv-85] WR
Franklin and V. Akman. Shortest paths in 3-space, Voronoi diagrams with
barriers, and related complexity and algebraic
issues. In Proceedings of the NATO Advanced
Study Institute on Fundamental Algorithms for Computer
Graphics, volume 17 of NATO ASI Series F, pages
895-917. Springer-Verlag, Ilkley, Yorkshire, England, 30 March
- 12 April 1985.
[fav-vdbpm-85] WR
Franklin, V. Akman, and C. Verrilli. Voronoi diagrams with barriers and on
polyhedra for minimal path planning. Visual
Comput., 1(2):133-150, October 1985.
[akman-robexs-85]
V. Akman and WR Franklin. Partitioning the space to calculate shortest paths
to any goal around polyhedral obstacles. In
Proceedings of ROBEXS'85, the First Annual Workshop on
Robotics and Expert Systems, NASA/Johnson Space Center,
27-28 June 1985.
[fa-spsgo-84] WR
Franklin and V. Akman. Shortest paths between source and goal
points located on/around a convex polyhedron. In
22nd Annual Allerton Conference on Communication, Control,
and Computing, Urbana, Illinois, USA, 3-5 October 1984.
[wrf-sigplan-84] WR
Franklin. A simpler
iterative solution to the Towers of Hanoi problem.
SIGPLAN Notices, 19(8):87-88, August 1984.
[wrf-vlsi-82] WR
Franklin. Software
engineering reasons for vlsi design methodology.
In IEEE Computer Society Workshop Report: VLSI and
Software Engineering Workshop, pages 86-89. Port Chester,
NY, USA, 4-6 October 1982.
[wrf-cg-82]
G. Wazzan, WR Franklin, W. R. Spillers, A. Greenwood,
T. F. Gantry, and H. Chu. Simulation of
buried power transmission systems: Some computer graphics
options. Computers and Graphics, 6(1):7-14,
1982.
[f-3gduh-81]
WR Franklin. 3-D
geometric databases using hierarchies of inscribing
boxes. In Proceedings of the 7th Canadian
Man-Computer Conference, pages 173-180, Waterloo,
Ontario, Canada, 10-12 June 1981.
[wrf-cga-81]
WR Franklin and Alan H. Barr. Faster calculation of superquadric
shapes. IEEE Computer Graphics and
Applications, 1(3):41-47, July 1981.
[f-eadvp-79]
WR Franklin. Evaluation of algorithms to
display vector plots on raster devices. Computer
Graphics and Image Processing, 11(4):377-397, December
1979.
[wrf-crc00]
WR Franklin, Applications of
Geometry. In Handbook of Discrete and
Combinatorial Mathematics, chap. 13.8, pp. 867-888, CRC
Press, editor: Kenneth H Rosen, 2000.
[wrf-business-83]
WR Franklin. Software aspects of business
graphics. Computers and Graphics, 7(1),
1983. (invited paper).
[nisen-maturation-78]
W. G. Nisen and WR Franklin. The maturation of computer
graphics. ICP Interface Manufacturing and
Engineering, 3(4):5-11, 1978.