Parallel Computation of the Minimum
Separation Distance of Bezier Curves
and Surfaces
Lauren Bissett,
lauren.bissett@uconn.edu
Nicholas Woodfield,
nicholas.woodfield@uconn.edu
REU Biogrid,
Summer 2009
University of
Connecticut
Storrs, CT 06269
Presentation Summary
Background
Overview
CUDA
Bezier Curves
Bezier Surfaces
Benefits/Future work
Background
Animation relies on continuous movement between
frames to give the illusion of motion.
When an unexpected change occurs between frames,
this is known as temporal aliasing.
Background
One method of dealing with temporal aliasing is
detecting self

intersections in geometric objects.
If self

intersections are unnoticed by an animator, it
could lead to the animation looking 'off'.
A scientist looking at a visual of a complicated
molecule likewise could not determine if there are
self

intersections.
Background
One method to detect self

intersections is finding a
geometric object's
minimum separation distance
.
The minimum separation distance is the smallest
doubly normal segment
between any two points on
the object.
A segment is doubly normal if both its endpoints are
normal to the curve/surface.
Background
The algorithm for finding the minimum separation
distance is time

consuming and not practical for use.
Therefore NVIDIA's CUDA parallel programming
langauge will be used to implement the algorithms
so that they run fast enough for practical use.
CUDA
CUDA was developed by NVIDIA for parallel
programming on the GPU.
Allows the launch of thousands of parallel threads of
execution.
Unlike most GPU programming, CUDA
development is relatively easy, because it extends C
(with additional bindings for C++ and Fortran).
It also allows for
general
programming, no prior
knowledge of graphics required
CUDA Memory Model
Threads
–
basic
element of
execution, has own
register and local
memory
Blocks
–
composed of
threads, has own
shared memory
Grid
–
composed
of blocks, contains
global, constant and
texture memory
Our Machine
The machine used for this research used a
QuadroFX 5800 GPU running Windows Vista.
512 threads per block
32 registers per thread
Minimum Separation Distance
To find the minimum separation distance, there are
three major steps:
Generate candidate double normal segments
Newton's method
Find segment of minimum segment length
Finding Candidate Segments
The method of finding potential double normal
segments is simple but time

consuming.
For a given sample size (
n
), take
n
sample points and
pair with all other points in the sample.
Then check if each pair is creates a double normal
segment.
Finding Candidate Segments
Newton's Method
The initial estimates are run on Newton's method
until they converge.
When finished, the double normal segment is
compared to determine if it is of smallest length.
Bezier Curves
Curve case implemented first
It's simple
–
only two parametric values
–
(s,t)
–
to
worry about
Bezier Curve Kernel Organization
Used a 1

Dim grid composed of 1

Dim blocks
Blocks divided into groups, one for each curve
Threads responsible for one s parametric value on
only one curve
Each thread tests its sample points vs all other points
on it's parent curve and all other curves
If the candidate segment passes the double normal
test, we run newton's method on it
Each thread ultimately returns the shortest segment
from its search
Bezier Curve Kernel Organization
What problems can arise?
Sample size > maximum thread allowance
Register usage
Must ensure consistency among multiple blocks
E.g. If we used a thread's built in index value,
and we used 2 blocks per curve, each block
would then only test values between 0 and .5!
This required equations to calculate which thread
belonged to whom
Bezier Curve Kernel Results
Double normals returned in a 2D array
Rows are blocks
Columns are threads in a block
Launched a second kernel to collapse the array into a
1

Dim array the size of the # of blocks
Iterated over those segments, and found the shortest
which is our minimum separation distance
Results
8x to 200x speedup
n
e1
e2
C code
CUDA code
512
0.4
0.4
28s
154.76ms
512
0.2
0.2
26s
154ms
200
0.4
0.4
4.3s
46.6ms
10
0.4
0.4
15ms
1.81ms
Bezier Surfaces
Next we moved onto surfaces
–
bicubic bezier
meshes.
Bezier Surfaces
Surfaces are just an extension of curves, but with
two parametric values
–
u and v.
Each thread in the kernel handles a u,v pair. It then
checks against all other u,v pairs on the surface.
Blocks were extended into 2 Dimensions, to
represent the unit square.
Bezier Surfaces
Similar to curves, the thread determines if the
segment is doubly normal, and if necessary, discards
an old one of greater length if it finds a short one.
And again, Newton's method is run on each doubly
normal segment.
Finally, a similar search through results to find the
minimum separation distance
Bezier Surfaces
The thread results are again searched for the smallest
segment, which is the minimum separation distance.
Results?
The mesh algorithm was largely completed in the
last few days
Curve case, although simple, took two weeks of
tweaking until the code was sastifactory
Mesh case still needs some tweaking
Still confident we'll observe similar results to the
curve case
However, we do not have comparable C code to
compare results
Benefits/Future work
How does this tie into bio

grid?
Nature of the problem:
Self

intersections in molecule simulations are of
interest
Leveraging the GPU for general programming
'Supercomputing for the masses'
Tremendous speedups for low costs
Useful for when supercomputing power is not
present nor available
Future work: Finish the mesh case!
Questions and Answers
Any Questions?
Images
CUDA Memory Model, Dr. Dobbs Supercomputing
for the Masses:
http://www.ddj.com/architect/208401741?pgno=3
Double normal segments & surfaces double normals,
Ed Moore's Ph.D. Thesis
Newton's method:
http://en.wikipedia.org/wiki/Newton%27s_method
Bezier surface w/control points:
http://www.cs.cf.ac.uk/Ralph/graphicspics/bez.GIF
Comments 0
Log in to post a comment