Upload
others
View
3
Download
0
Embed Size (px)
Citation preview
Data Structures and Algorithms in Application to Computer Modelling
CPSC 335CPSC 335Dr. 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
Advances algorithms for 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
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
VD and DT (power metric)
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
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)
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
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.
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.
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
Task: 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
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
Application to lipid bilayer modelingProblem: 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 mechanism of the molecular diffusion through the membrane.
Approach: 3D Voronoi network, voids between lipids can be visualized and studied.
Specific methods: - 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 simulation
Problem: the concept of interacting virtual particles whose dynamics giverise 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 methods: - 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
GIS – terrain models
GIS - terrain models
Summary
A variety of data structures can be effectively used in simulation of complex physical systems to improve efficiency of simulation and perform queries.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.
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.
Illustration
Consider 15X15 image
Illustration
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.
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