Upload
others
View
19
Download
0
Embed Size (px)
Citation preview
Geometric Algorithms and Applications
Dr. Marina L. GavrilovaDr. Marina L. Gavrilova
Assistant ProfessorAssistant ProfessorDept of Comp. Science, University of Calgary,Dept of Comp. Science, University of Calgary,
AB, Canada, T2N1N4AB, Canada, T2N1N4
Topics
Survey of applications of computational geometry to modeling andsimulation of natural processes and GISBrief introduction to the computational methodsCollision detection optimization in a granular materials systemFinding a nearest-neighbour in a multi-particle systemModeling system with cylindrical boundaries on an example of porous materials Applications to modeling of lipid bilayers GIS applicationsImage processing and visualizationFinding a skeleton – coral growthOther problems
Proximity problemsPolygon intersectionsVoronoi diagrams Medial axis problemMotion planning
Computational geometry in modeling of natural processes
Biological systems (plants, corals)Granular-type materials (silo, shaker, billiards)Molecular systems (fluids, lipid bilayers, protein dockingGIS terrain modeling
Areas of applicabilityA spectrum of computational
geometry applications:BiologyMolecular dynamicsGIS (Geographical Information Systems)PhysicsMechanicsChemistry
The Monter Carlo model of a lipid bilayer in water, 8666 atoms
Problems
Problems that are addressed include:computing properties of particles arrangements, such as their volume and topology, in a general d-dimensional space testing intersections and collisions between particlesfinding offset surfaces (related to questions of accessibility of subregions)Solving nearest-neighbours problemsPredicting time of the next collision between particles undergoing continuous motion Updating data structures accurately and efficiently Visualizing algorithms for rendering models
Selected references:Some examples of computational geometry in applications are:
To study the structure of disordered packing of balls and modelsof liquid and glasses {Finney, Medvedev, Gavrilova 98}To model the permeability and the fluid flow through and to perform analysis of voids {Thompson, Medvedev} To simulate the flow of ice in the river, the shaker ball mill, the silo model {Vinogradov, Gavrilova}To study protein crystal structure {Pontius, Medvedev}In molecular dynamics visualization {Zauhar}In coral modeling (surface reconstruction) {Kaandorp}In computer graphics, visualization, GIS, statistical and information retrieval {Okabe, Overmars, Uruttia, Boissonnat}Numerical precision {Yap, Schirra, Fortune, Rokne}
Data structure: represents both physical and topological model properties; Functionality: main functions, interoperability, simplicity, efficiency of updates/queryingExtendibility: reusability, modification, update, addition of new entitiesReliability: achievable and efficient methods, variable precision whenever needed
Algorithm development requirements
ApproachesData structure: both inherent and coherent model properties, attributed geometric data structures (generalized Voronoi diagrams, k-d trees, segment trees, space subdivisions and variants)
Functionality, extendibility: implemented using an OO object library (system design methodology for multi-particle problems, requirements analysis, requirements matching procedure, morphing, encapsulation)
Reliability: exact computation, interval analysis, floating-point arithmetic (intersection tests, expression evaluation; inclusion for the range of functions, ESSA test, ESEA method, iterative approximation, representation by series of sums, Taylor series).
Commonly used data structures
Planar subdivisionsTree-based data structure (segment trees, k-d trees, hierarchical octrees…)Space partitioningsVoronoi diagramsInteracting objects (agents)
Pool of Data StructuresPool of Data Structures
INCIRCLE P P P P( , , , )1 2 3 4 0> INCIRCLE P P P P( , , , )1 2 3 4 0= INCIRCLE P P P P( , , , )1 2 3 4 0<
P1P2
P3
P4
P1
P2
P3
P4
P1P2
P3
P4
Dynamic Delaunay triangulation
Spatial subdivisionsk cells
Segment trees
K-d treesCombination of data structures
PreliminariesGiven a set of spherical objects (sites) S in Rd. Point x from Rd is the nearest neighbor of P from S iff d(x,P) <= d(x,Q), Q from S. Euclidean metric: d(x,P) = d(x,p) - rpManhattan metric: d(x,P) = d(x,p) - rp = |x1 - p1| +…+ |xd - pd|-rpSupremum metric: d(x,P) = d(x,p) - rp = max(|x1 - p1|…|xd - pd|) - rpLaguerre geometry: d(x,P) = d(x,p)2 - r 2p =(x1 - p1)2+…(xd- pd)2 - r2
p
The Generalized Voronoi diagram (VD) of a set of spheres S in Rd is a set of generalized Voronoi regions, defined as:
( ) ( ) ( ) { }{ }PSQQdPdPGVor −∈∀≤= ,,, xxxwhere d(x,P) is the distance function between a point x and a sphere P.The generalized Delaunay tessellation (DT) is the data structure, dual to the generalized VD, containing proximity information for a set S. In the plane, DT is obtained by joining all pairs of sites whose Voronoi regions share a common edge.
VD and DT (power metric)
VD and DT propertiesBisector of a generalized weighted VD is either a hyperbolic curve or a hyperplaneThe VD region is star-shaped with respect to its generatorVoronoi vertex is a vertex of the diagram is the common intersection of exactly d+1 Voronoi regionsVoronoi vertex is equidistant from d+1 sites. It lies in the center of a “sphere” inscribed among d+1 cites[Empty sphere property] This inscribed sphere is “empty”, i.e. it does not contain any other VD sites[Nearest-neighbor property] If Q is the nearest neighbor of P then their Voronoi regions share an edge
Example of Supremum VD and DT
The supremum weighted Voronoi diagram (left) and the corresponding Delaunay triangulation (right) for 1000 randomly distributed sites .
Collision detection optimizationCollision detection optimizationCollaborators: O. Vinogradov, Dept. of Mech Engineering, J. Rokne, Dept of
Computer Science, University of CalgaryProblem: A set of n moving particles is given in the plane or 3D with equations
of their motion. It is required to detect and handle collisions between objects and/or boundaries. Collisions are instantaneous and one-on-one only.
Approach: Use dynamic data structures in the context of time-step oriented simulation model.
Data structures considered are:dynamic generalized DTregular spatial subdivisionregular spatial treeset of segment tree
Reduced model simulationReduced model describes the system of moving objects when objects trajectories are given as analytical functions of time.
A topological event is a specific moment of time when the topology of the data structure changes.
A velocity update event is a specific moment of time when the velocity of an object changes.
An event queue is a data structure that stores topological events and velocity update events in the sorted order according to the time of the event.
Time-step oriented simulation model is defined by a system of equations representing the evolution of the system. The solution of the system allows to predict the system state in the next time interval.
A predict trajectory event in time-step oriented computer simulation occurs when the velocity of a body is updated due to the calculation of the system state at the next timestep.
A collision event in time-step oriented computer simulation occurs when two bodies collide or a body collides with a boundary.
Dynamic Delaunay triangulationDynamic Delaunay triangulation
INCIRCLE P P P P( , , , )1 2 3 4 0> INCIRCLE P P P P( , , , )1 2 3 4 0= INCIRCLE P P P P( , , , )1 2 3 4 0<
P1P2
P3
P4
P1
P2
P3
P4
P1P2
P3
P4
Approachconstruct and maintain a dynamic
Delaunay triangulation for the set of moving disks (in some metric).
Collisions checks are performed only along the Delaunay edges.
NotesO(n log n) to construct DT and O(n) space a topological event occurs when the DT tessellation sites become co-spherical topological events between two collisions: from O(1) up to O(n3)
Determining the time of topological eventThe time of the topological event in a Delaunay d-dimensional quadrilateral of d+2
spheres Pi can be found in Laguerre geometry as the minimum real root t0 of the equation:
( )
1...1.....................1...1...
,,...,,
2,22,21,2
1,12,11,1
222221
111211
2121
++++
++++
++ =
ddddd
ddddd
d
d
dd
wxxxwxxx
wxxxwxxx
PPPPINCIRCLE
where and2..1,... 22,
22,
21, +=−+++= dirxxxw idiiii
( ) 0
1..................1...1...
,...,,
,12,11,1
,22221
,11211
121 >=
+++
+
dddd
d
d
d
xxx
xxxxxx
PPPCCW
Spatial subdivisionsSpatial subdivisionsRegular Spatial SubdivisionApproach
The space is subdivided into cellsCollisions are checked only with disks in neighboring cells - O(1) checks on average
Notesperformance depends on the distribution of object sizes and on the density of packing
k cells
Regular Spatial Tree Approach
Same idea as in regular subdivision, but only occupied cells are stored in memoryCells are stored in a binary tree
NotesAllows to reduce storage at the
expense of access time
Segment treesSegment treesApproach
project disks onto each of the coordinate axismaintain tree of segment endpoints along each axisperform a collision check only when bothof the disks projections intersecta topological event occurs when two segment endpoints on one of the axis collide
Notesperformance depends on the density of packing and the distribution size
ObservationsThe worst-case number of topological events that can happen between two collisions is the largest for the Delaunay tessellation method. This method should be used in particle systems with high collision rate.The regular spatial subdivision is the most space consuming method and should not be used if the memory resources are limited.The regular spatial subdivision and the regular spatial tree methods perform worst for densely packed granular systems. The Delaunay tessellation based method is the only method which performance is independent of the distribution of radii of the particles and their packing density. In order to implement the regular subdivision method the size of the simulation space and the size of the largest particle in the system should be known in advance.
The shaker ball mill modelThe shaker ball mill comprises a massive cylinder filled with steel balls oscillating in a vertical direction with a specified amplitude and frequency.Balls are moving along parabolic trajectories. Collisions between the balls and between the balls and the cylinder are assumed to be central and frictionless (the tangential velocity component of colliding particles is conserved). The cylinder is assumed to have an infinite mass.The inelastic nature of collisions can be represented by introducing restitution coefficients, which represent the ratio between particle velocity components before and after collision.The system of differential equations is solved by using the Newton-Euler’s method.
Experiments
The event-driven simulation environment for shaker ball mill was created at the Dept. of Mechanical and Manufacturing Engineering, U of C. Algorithms were implemented in Object-Oriented Pascal in the Borland Delphi environment. The size of the simulation space(shaker area) was set to 200 by 200 mm. Balls radii were in the range from 1 to 10 mm. The duration of the simulation run was set to 10 sec. Predict trajectory events were computed every 0.005 sec, which defines the duration of the timestep.
Experimental results
Monosized data sets
0
200
400
600
800
1000
1200
1400
0% 10% 20% 30% 40% 50% 60% 70% 80%Packing density
Tim
e, s
ec.
Straightforw ard
Regular subdivisionSpatial tree
Segment treeDynamic PD
Note that the number of collision checks is practically constant for DT
Experimental results
Polysized data sets
0200400600800
100012001400160018002000
0% 10% 20% 30% 40% 50% 60% 70% 80%Packing density
Tim
e, s
ec. Straightforw ard
Regular subdivisionSpatial tree
Segment treeDynamic PD
Note that the segment tree method outperforms the DT based method at low densities but matches the DT performance for packing densities over 65%.
Performance summary
Conclusions: Based on the overall performance, the segment tree can be considered as the best candidate for almost all types of the systems considered. The dynamic generalized Delaunay triangulation method demonstrates consistent performance that practically does not depend on the distribution of radii of the particles or their packing density. It is shown that despite its complexity the method is a good candidate for CDO.
The Nearest-neighbourproblem
Task: To find the nearest-neighbor in a system of circular objects {Gavrilova 01}
Environment: Object-oriented Borland Delphi environment, Pentium II processor.
Approach: To use generalized Voronoi diagram in Manhattan and power metric as a data structure.
The Initial Distribution Generator (IDG) module:Used to create various input configurations: the uniform distribution of sites in a square, the uniform distribution of sites in a circle, cross, ring, degenerate grid and degenerate circle. The parameters for automatic generation are: the number of sites, the distribution of their radii, the size of the area, and the type of the distribution.
The Nearest-Neighbour Monitor (NNM) module:The program constructs the additively weighted supremum VD, the power diagram and the k-d tree in supremum metric; performs series of nearest-neighbour searches and displays statistics.
Tests: large data sets (10000 particles), silo model
Site configurationsSix configurations of sites: uniform square, uniform circle, cross, degenerate grid, ring and degenerate circle.
Experimental results (1)Initialization time: uniform square, degenerate grid and degenerate circle distributions (100 to 10000 sites). The k-d tree method requires much less initialization time than the VD methods.
Uniform Square: Initialization Time vs. Number of Sites
0
2
4
6
8
10
12
0 2000 4000 6000 8000 10000 12000
Number of sites
Tim
e (s
ec.) Suprem
Pow er
k-d
Degenerate Grid: Initialization Time vs. Sites
0
2
4
6
8
10
12
0 2000 4000 6000 8000 10000 12000
Number of sites
Tim
e (s
ec.) Suprem
Pow er
k-d
Degenerate Circle: Initialization Time vs. Sites
0
2
4
6
8
10
12
0 2000 4000 6000 8000 10000 12000
Number of sites
Tim
e (s
ec.) Suprem
Pow er
k-d
Experimental results (2)Query time: query time is less for VD based method in comparison with the k-dtree method for all tested configurations. The difference in time is smallest for degenerate circle distribution.
Degenerate Grid: Query Time vs. Sites
0
0.5
1
1.5
2
2.5
0 2000 4000 6000 8000 10000 12000
Number of sitesTi
me
(sec
.) Suprem
Pow er
k-d
Uniform Square: Query Time vs. Sites
0
0.5
1
1.5
2
2.5
0 2000 4000 6000 8000 10000 12000
Number of sites
Tim
e (s
ec.) Suprem
Pow er
k-d
Degenerate Circle: Query Time vs. Sites
0123456789
0 2000 4000 6000 8000 10000 12000
Number of sites
Tim
e (s
ec.)
Suprem
Pow er
k-d
Application to Silo modelSilo model: the granular-type material system model (provided by O. Vinogradov, Dept. of Mech. Eng, U of C). The model represents a grain elevator with vertical boundaries and a large number of densely packed grain particles. The equations for the model derived by a modification of the Newton-Euler’s method [Sun et. al. 94]. This approach is based on the classical laws of rigid body mechanics:
where F is the force acting on the center of mass of a body, a is the acceleration of the center of mass. The other law used is:
Where M is the total linear momentum relative to the center of mass, I is the moment of inertia and w is the angular velocity of the body.
∑ = aF m
ω=∑ &IM
Application to Silo modelInitialization time is worst for the supremum diagram. Query time of the VD-based methods is better than that of the k-d tree method.
Silo: Query time vs. Number of Sites (1000 queries)
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
0 2000 4000 6000 8000 10000 12000
Number of sites
Tim
e (s
ec.) Suprem
Pow er
k-d
Changing boundary conditions
Collaborators: N.N. Medvedev, V.A.Luchnikov, V. P. Voloshin, Russian Academy of Sciences, Novosibirsk [Luchnikov 01].
Environment: Fortran 77, SunTask: To study the properties of the system of polydisperse spheres in 3D,
confined inside a cylindrical container.Approach: A boundary of a container is considered as one of the elements of
the system. To compute the Voronoi network for a set of balls in a cylinder we use the modification of the known 3D incremental construction technique, discussed in {Gavrilova et. al.} The center of an empty sphere, which moves inside the system so that it touches at least three objects at any moment of time, defines an edge of the 3D Voronoi network.
Tests: porous materials, molecular structures
The Empty Sphere ProblemIn case of spherical objects and a cylindrical boundary, explicit formulas
of the sphere inscribed between the three spheres and a cylinder can be obtained (this speeds up the algorithm significantly).
Assume the cylinder is vertical. (xAssume the cylinder is vertical. (x11,y,y11,r,r11) are the coordinates of the ) are the coordinates of the axis of the cylinder and its radius, (axis of the cylinder and its radius, (xxii,,yyii,,zzii,,rrii), i=2..4 are the ), i=2..4 are the coordinates and the corresponding radii of the spheres. Assume coordinates and the corresponding radii of the spheres. Assume rr44is the smallest radii. Choose the origin at the center of this sis the smallest radii. Choose the origin at the center of this sphere. phere. Shrink all the spheres by Shrink all the spheres by rr44 Increase the cylinder radius by Increase the cylinder radius by rr4. 4. Thus Thus we obtain:we obtain:
( ) ( ) ( )( ) ( ) ( ) ( )( ) ( ) ( ) ( )
=+++=−+−+−+=−+−+−
−=−+−
2222
23
23
23
23
22
22
22
22
21
21
21
rzyxrrzzyyxxrrzzyyxx
rryyxx
ImplementationThe algorithm to build the Voronoi network was implemented in Fortran
77 and tested on Solaris workstation. The figure shows its application for a system of 40 balls with equal radii. Note, that the Voronoi edges at the cylinder surface are curved. This is typical for systems with the non-spherical particles.
Test resultsThe approach was tested on a system representing dense packing of
300 Lennard-Jones atoms. Diameter of a particle was selected equal to the value of Lennard-Jones potential.
Two models were compared: the first was obtained by Monte-Carlo relaxation with the fixed value of a cylinder diameter (right) and the second model was obtained by slightly perturbing the diameter of a cylinder (left).
1. The largest channels of the Voronoi network occur near to the wall of the cylinder. This is an anticipated result, since a flow of liquid through a packing of balls is inhomogeneous and the main streams are at the cylinder wall.
2. A fraction of large channels along the wall is higher for the model with the fixed diameter (right) than for the model with relaxed diameter (left). Relaxation provides more uniform distribution of particles.
Test results
Test results
Factor f represents the correlation between the diameter of the sphere and the diameter of the model. Tests aimed at establishing the correlation between factor f and the distribution of radii of the channels between atoms. Model of 500 atoms obtained by Monte-Carlo method with f=2, f=3 and f=6 were considered.
Test results
Test results1. In the narrow cylinder with factor f=2 a few distinct peaks in the
distribution are observed. The largest number of the channels have radius equal to 0.08 (35% of all channels). This bottle-neck radius corresponds to a hole between three closely packed balls.
2. As the factor f increases, more uniform distribution of the channel radii is observed.
3. As factor f reaches value 6, the distribution of channel radii becomes more uniform, with the larger number of channels with values in the range from 0.1 to 0.5. The number of largest number of channels with the same radius (r=0.08) gradually decreases as f increases.
Application to lipid bilayer modelingCollaborators: N.N. Medvedev, V.A.Luchnikov, Voloshin, Russian
Academy of Sciences, NovosibirskProblem: The phospho-lipid bilayers are used as a model for
membranes. They are simulated by using molecular dynamics or Monte Carlo methods. One of the problems is a detailed mechanismof the molecular diffusion through the membrane.
Approach: 3D Voronoi network, voids between lipids can be visualized and studied.
Specific tasks: - 3D Delaunay tessellation visualization- Dynamic model update
Modeling of lipid bilayers
The The MonterMonter Carlo model of a lipidCarlo model of a lipid bilayerbilayer in water, 8666 atoms, in water, 8666 atoms, blue blue -- water molecules, red and dark blue water molecules, red and dark blue -- atoms in lipid atoms in lipid molecules). molecules).
Modeling of lipid bilayers(Left) The largest empty spheres inside the model (R_(Left) The largest empty spheres inside the model (R_emptysphereemptysphere
> 1.4 ) can be found using the Voronoi> 1.4 ) can be found using the Voronoi--Delaunay technique. Delaunay technique. Voids between the hydrophobic lipid tails (in the center of the Voids between the hydrophobic lipid tails (in the center of the box) can be seen. box) can be seen.
(Right) The channels inside the lipid(Right) The channels inside the lipid bilayerbilayer model can be seen. model can be seen.
Application to biology simulationCollaborators: J. Kaandorp, University of Amsterdam, the NetherlandsProblem: the concept of interacting virtual particles whose dynamics give
rise to complex behaviour, by using cellular automata for modeling and distributed simulation. This approach is used to model growing biological surfaces (corals, polips and sponges).
Approach: Use generalized dynamic Delaunay triangulation to representatbiological models. The statistical analysis of composition of Delaunay simplices allows studying non-random behaviour of the growing models in high details. Computing properties of biological models, such as volume, area, rate of the growth, and the level of interactions between elements can be efficiently solved.
Specific tasks: - medial axis computation- Model rendering- Branch intersection computation- Updating topology
Application to biological simulationExample: the simulation of surface of growing coral.
Related problems
Other areas:GIS renderingSurface simplificationData transmission/compressionGraphics/feature transformKnowledge representation
Coral modeling – DT in 3D
Coral modeling – DT in 3D, extra point
GIS – terrain models
GIS - terrain models
Summary
The generalized Voronoi diagram approach can be efficiently used in simulation of complex physical systems to improve efficiency and perform detailed analysis of the system.This approach is very promising in a number of applications.Current research: in application of the developed methods for biological modeling and simulation of growing surfaces.
ReferencesFinney,J. (1970) Random packing and the structure of simple liquids Roy.Soc.London, 319, 479-495Kaandorp J.A. and J.E. Kuebler (2001) The algorithmic beauty of seaweeds, sponges and corals, Springer-Verlag,Heidelberg, New YorkThompson,K.E. and Fogler, H.S. (1997) Modelling flow in disordered packed bed from pore-scale fluid mechanics. AIChE Journal, 43(6) 1377-1389Gavrilova, M. (2001) Robust Algorithm for Finding Nearest-Neighbors under L-1, L-infand Power Metrics in the Plane, LNCS 2074, Volume I, pp. 663-672, Springer.Gavrilova, M., Rokne, J., Vinogradov, O. and Gavrilov, D. (1999) Collision detection algorithms in simulation of granular materials, 1999 ASME Mech. Mater. Conf., 283-284Luchnikov, V.A., N.N.Medvedev and Gavrilova, M.L. (2001) The Voronoi-DelaunayApproach for Modeling the Packing of Balls in a Cylindrical Container, Lecture Notes in Computer Science LNCS 2074, Volume I, pp. 748-752, SpringerMedvedev, N.N. (2000) Voronoi-Delaunay method for non-crystalline structures, SBRAS Okabe, A., Boots, B., Sugihara, K. (1992) Spatial tessellation concepts and applications of Voronoi diagrams, J. Wiley & Sons, Chichester, EnglandPontius J., Richelle J. & Wodak S.J. (1996) Deviations from standard atomic volumes as a quality measure for protein crystal structures. J. Mol. Biol. 264(1): 121-136Zauhar, R.J. (1995) SMART: A solvent-accessible triangulated surface generator for molecular graphics and boundary element applications, Comp-Aided Mol.Des9, 149-159.
VD in image processingWhat is a Distance Transform?
Given an n x m binary image I of white and black pixels, the distance transform of I is a map that assigns to each pixel the distance to the nearest black pixel (a feature).
Distance Transform as a Temperature Map
•Object pixels are “hot” and red.
•Temperature gets “colder” as you move away
What is a Feature Transform?The feature transform of I is a map that assigns to each pixel the feature that is nearest to it.
L1
L2 L∞
Distance Metrics
Example of a Chain
Illustration
Consider 15X15 image
Algorithm Walkthrough
Experiments set-up
Two algorithms: with polygonal chain pruning and without were considered. Parameters:
k - a number of distinct images of the same size generated for each series of experiments
r - a number of times each experiment is repeated
M - number of image rowsN - number of image columnsP - number of black pixels in the image
The average chain length (AVL) for Algorithm1 was also computed.
0500
1000150020002500300035004000
0 100000 200000 300000
Algm2 5%Algm1 5%Algm2 30%Algm1 30%
Experimental results (2)
Algm 1 – pruning
Algm 2 – no pruning
% - percentage of black pixels in the image
Graph shows running time in sec. (OY axis) vs. number of pixels in image (OX axis)
Results:
Significant improvement in running time
Rate of grows of linear function is very slow
0
50
100
150
200
250
300
350
400
0 200000 400000 600000 800000 1000000
5%15%30%
Algm 1 with pruning was tested
Percentage of black pixels: 5%, 15%, 30%
Results:
Small constant remains regardless of saturation (% of black pixels in image),
Time increases only slightly as the percentage of black pixels increases
Experimental results (3)
Template Matching approach to Symbol Recognition
Compare an image with each template and see which one gives the best mach
Good Match
Image
Template
Most of the pixels overlap means a good match.
Poor Match
However, even a slight misalignment can result in a very bad. Here, only 5 pixels overlap despite nearly identical shape.
Improving Error Tolerance
Morphing
Morphing can be defined as producing an animation that shows how one image deforms into another.
Using Distance transform
Sometimes points do not match up the way we would like them to.
In this example it would be nice if endpoints mapped to endpoints.