4.1 vis_04 data visualization lecture 4 two dimensional scalar visualization part 2: further...
TRANSCRIPT
4.1Vis_04
Data VisualizationData Visualization
Lecture 4Two Dimensional Scalar
VisualizationPart 2: Further Contouring and
Other 2D Techniques
4.2Vis_04
Return to ExampleReturn to Example
Consider this data:
10 -5
1 -2
Where does the zero level contour go?
Can we draw a straight line which willapproximate the contour line?
4.3Vis_04
Joining Intersections Directly
Joining Intersections Directly
It is tempting to approximate by joining intersections with straight lines:
10 -5
-21
4.4Vis_04
AmbiguityAmbiguity
But this does not always work - look at this data:
10 -5
1-3
Try it - it is ambiguous!
4.5Vis_04
What is the Problem?What is the Problem?
The contour of the bilinear interpolant is NOT a straight line – it is a curve -
This is curve of: f(x,y) = (1-x)(1-y)f00+x(1-y)f10+(1-x)yf01+ xyf11 = 0
10 -5
-21
BUT how can we draw it?
Joining intersectionswith straight lineswas only an approximation
4.6Vis_04
Next point oncontour
Tracking ContoursTracking Contours
We can track the contour in small steps through the grid rectangle - starting from the intersection with the edges– take a step, probe at an equal distance to
either side, then predict next point; and so on
-0.3
0.9
Current pointon contour
Probes
-0.3
0.9BUT THIS IS SLOW!!
4.7Vis_04
Solution by Decomposing Cell
Solution by Decomposing Cell
One technique – more efficient than tracking - is to split cell into four triangles
Within a triangle, we can fit a linear model
– F(x,y) = a + bx +cy
How do we split? How do we calculate
a,b,c? What is the gain?
f1
f2 f3
4.8Vis_04
Cell DecompositionCell Decomposition
Problem of drawing the curved lines has been circumvented by decomposing cell into four pieces within which the contours are well defined straight lines
10 -5
-3 1
0.75
4.9Vis_04
Avoiding Cell DecompositionAvoiding Cell
Decomposition
As an alternative to decomposing the cell, we can try to understand how the curved contours of a bilinear interpolant behave
The difficult case is:
+
+
-
-
Opposite vertices: two +and two -
Where do the contour lines go?
4.10Vis_04
Bilinear InterpolantBilinear Interpolant
The bilinear interpolant has contours which are hyperbolas, and can be one of two forms:
In each case there is a saddle point - if saddle point is-ve, then we have case A; if +ve, case B.
+ -
- +
A+ -
- +
B
Saddle point: fx=fy=0 .. Max in one direction, min in other
4.11Vis_04
A Possible MethodA Possible Method
This suggests following method:– in ambiguous case, calculate saddle
point and join intersection points according to how bilinear behaves:
+ -
- +
A+ -
- +
B
saddle negative saddle positive
Try it on the example earlier
4.12Vis_04
Saddle PointSaddle Point
It is possible to calculate the saddle point in terms of vertex values (from fx = fy =0 ):
And the corresponding value:
x = (f00 - f01 ) / D; y = (f00 - f10 ) / D
Saddle value = (f00f11 - f01f10)/D
D = f00 + f11 - f01 -f10
4.13Vis_04
ProblemProblem
In the ambiguous case, will the earlier four triangle method always give the same result as the saddle point method?
5 -150
100-1
Try thiswith bothapproaches
4.14Vis_04
Greater AccuracyGreater Accuracy The greater understanding of the
bilinear leads to a more accurate method
A single straight line approximation can be made more accurate by using two straight line pieces– see Lopes and Brodlie paper on Web site+ -
- +A B
+ -
- +
4.15Vis_04
2D Interpolation - Scattered Data
2D Interpolation - Scattered Data
Often the data will be given, not on a regular grid, but at scattered locations:
f given at eachmarked point
Approach:(i) triangulate(ii) build interpolantin each triangle(iii) draw contours
4.16Vis_04
TriangulationTriangulation
Triangulation is the process of forming a grid of triangles from the data points
How can we construct the triangulation?
4.17Vis_04
TesselationTesselation
We solve the DUAL problem:– Suppose a wolf is stationed at each data
point. Each wolf is equally powerful and dominates the territory closest to its own base
– What are the territories dominated by each wolf?
4.18Vis_04
Tesselation - Two or Three Wolves
Tesselation - Two or Three Wolves
4.19Vis_04
Tesselation - Two or Three Wolves
Tesselation - Two or Three Wolves
4.20Vis_04
Dirichlet TesselationDirichlet Tesselation
The resulting tesselation is known as the Dirichlet or Voronoi tesselation
Given the Dirichlet tesselation for N points
P1, P2, ... PN
there is an algorithm for constructing the tesselation when an extra point is added
4.21Vis_04
Dirichlet TesselationDirichlet Tesselation
P1
P2
P3
Tesselation forP1, P2, P3
QPoint Qadded
4.22Vis_04
Dirichlet TesselationDirichlet Tesselation
P1
P2
P3
Q
4.23Vis_04
Dirichlet TesselationDirichlet Tesselation
P1
P2
P3
Q
4.24Vis_04
Dirichlet TesselationDirichlet Tesselation
– Determine polygon containing Q - here D3, surrounding P3
– Construct perpendicular bisector of P3Q and find intersection with D3 - this becomes point of modified tesselation
– Determine adjacent polygon - here D2
– Repeat the above two steps until D3 is reached again, or there is no intersection
– Remove all vertices and edges interior to the new polygon
4.25Vis_04
Delaunay TriangulationDelaunay Triangulation
P1
P2
P3
Q
4.26Vis_04
Delaunay TriangulationDelaunay Triangulation
Triangulation formed by joining points whose ‘territories’ share a common boundary in the tesselation
This has the nice property that it avoids long skinny triangles
See the nice applets at:www.cs.cornell.edu/Info/People/chew/
Delaunay.html Note the ‘empty circle’ property of
the Delaunay triangulation
4.27Vis_04
Contouring from Triangulated DataContouring from
Triangulated Data
The final step is to contour from the triangulated data
Easy – because contours of linear interpolant are straight lines – see earlier
http://www.tecplot.com
4.28Vis_04
Implementing Triangle-based Contouring
Implementing Triangle-based Contouring
Each vertex can be positive or negative (ignore zero for now)
This gives 23 = 8 possible cases…
… but there are only 2 distinct configurations
– No contour (all same sign)
– Contour (2 of one sign, 1 of the other)
Implementation:– Determine which of 8
cases– Select code for the
appropriate configuration
f1
f2 f3
f1
f2 f3
All same sign
Two same sign
4.29Vis_04
Implementing Rectangle-based Contouring
Implementing Rectangle-based Contouring
For a rectangle, there will be 24 = 16 cases
There are 4 configurations
– All same sign (no contour)
– 3 same sign (one contour piece)
– 2 adjacent with same sign (one contour piece)
– 2 opposite with same sign (two pieces, but ambiguous)
+ +
+ +
+ +
+ -
+ -
+ -
+ -
- +
4.30Vis_04
Surface ViewsSurface Views
A different mapping technique for 2D scalar data is the surface view.
Here a surface is created in 3D space, the height representing the scalar value
Construction is quite easy - suppose we have a rectangular grid
4.31Vis_04
Constructing a Surface View - 1
Constructing a Surface View - 1
4.32Vis_04
Constructing a Surface View - 2
Constructing a Surface View - 2
Surface created as pair of triangles per grid rectangle.Rendering step is then display of triangles.
4.33Vis_04
Examples - with added contours
Examples - with added contours
www.tecplot.com
4.34Vis_04
Image PlotsImage Plots
A further mapping technique for 2D data is the image plot
There are three variants:– dot array : draw a dot at each data
point, coloured according to the value (very fast, but low quality)
4.35Vis_04
Image PlotsImage Plots
Grid lines:
4.36Vis_04
Image PlotsImage Plots
Areas:
4.37Vis_04
Cross SectionsCross Sections
Another option is to look at a cross-section through the data
For example, if x and y are the independent variables, we could fix y and look at f in terms of just x– then repeat for different y
– this reduces the ES2 problem to a
sequence of ES1 problems