Presentation on theme: "Data Visualization Lecture 4 Two Dimensional Scalar Visualization"— Presentation transcript:
1 Data Visualization Lecture 4 Two Dimensional Scalar Visualization Part 2: Further Contouring and Other 2D Techniques
2 Return to Example Consider this data: -5 10 1 -2 Where does the zero level contour go?Can we draw a straight line which willapproximate the contour line?
3 Joining Intersections Directly It is tempting to approximate by joining intersections with straight lines:10-5-21
4 Ambiguity But this does not always work - look at this data: 10 -5 -3 Try it - it is ambiguous!
5 What is the Problem?The contour of the bilinear interpolant is NOT a straight line – it is a curve -10-5-21Joining intersectionswith straight lineswas only anapproximationThis is curve of: f(x,y) = (1-x)(1-y)f00+x(1-y)f10+(1-x)yf01+ xyf11= 0BUT how can we draw it?
6 Tracking ContoursWe can track the contour in small steps through the grid rectangle - starting from the intersection with the edgestake a step, probe at an equal distance to either side, then predict next point; and so on-0.30.9-0.30.9Next point oncontourCurrent pointon contourProbesBUT THIS IS SLOW!!
7 Solution by Decomposing Cell One technique – more efficient than tracking - is to split cell into four trianglesWithin a triangle, we can fit a linear modelF(x,y) = a + bx +cyHow do we split?How do we calculate a,b,c?What is the gain?f1f2f3
8 Cell DecompositionProblem of drawing the curved lines has been circumvented by decomposing cell into four pieces within which the contours are well defined straight lines-5100.75-31
9 Avoiding Cell Decomposition As an alternative to decomposing the cell, we can try to understand how the curved contours of a bilinear interpolant behaveThe difficult case is:+-Opposite vertices: two +and two -Where do the contourlines go?
10 Bilinear InterpolantThe bilinear interpolant has contours which are hyperbolas, and can be one of two forms:+-A+-BIn each case there is a saddle point - if saddle point is-ve, then we have case A; if +ve, case B.Saddle point: fx=fy=0 .. Max in one direction, min in other
11 A Possible Method This suggests following method: in ambiguous case, calculate saddle point and join intersection points according to how bilinear behaves:+-AB-+-+saddle negativesaddle positiveTry it on the example earlier
12 Saddle PointIt 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 ) / DD = f00 + f11 - f01 -f10Saddle value = (f00f11 - f01f10)/D
13 ProblemIn the ambiguous case, will the earlier four triangle method always give the same result as the saddle point method?5-150100-1Try thiswith bothapproaches
14 Greater AccuracyThe greater understanding of the bilinear leads to a more accurate methodA single straight line approximation can be made more accurate by using two straight line piecessee Lopes and Brodlie paper on Web siteB+-+--+A
15 2D Interpolation - Scattered Data Often the data will be given, not on a regular grid, but at scattered locations:f given at eachmarked pointApproach:(i) triangulate(ii) build interpolantin each triangle(iii) draw contours
16 TriangulationTriangulation is the process of forming a grid of triangles from the data pointsHow can we construct the triangulation?
17 Tesselation 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 baseWhat are the territories dominated by each wolf?
20 Dirichlet Tesselation The resulting tesselation is known as the Dirichlet or Voronoi tesselationGiven the Dirichlet tesselation for N pointsP1, P2, ... PNthere is an algorithm for constructing the tesselation when an extra point is added
24 Dirichlet Tesselation Determine polygon containing Q - here D3, surrounding P3Construct perpendicular bisector of P3Q and find intersection with D3 - this becomes point of modified tesselationDetermine adjacent polygon - here D2Repeat the above two steps until D3 is reached again, or there is no intersectionRemove all vertices and edges interior to the new polygon
26 Delaunay Triangulation Triangulation formed by joining points whose ‘territories’ share a common boundary in the tesselationThis has the nice property that it avoids long skinny trianglesSee the nice applets at:Delaunay.htmlNote the ‘empty circle’ property of the Delaunay triangulation
27 Contouring from Triangulated Data The final step is to contour from the triangulated dataEasy – because contours of linear interpolant are straight lines – see earlier
28 Implementing Triangle-based Contouring f1f2f3Each vertex can be positive or negative (ignore zero for now)This gives 23 = 8 possible cases…… but there are only 2 distinct configurationsNo contour (all same sign)Contour (2 of one sign, 1 of the other)Implementation:Determine which of 8 casesSelect code for the appropriate configurationAll same signf1f2f3Two same sign
29 Implementing Rectangle-based Contouring +For a rectangle, there will be 24 = 16 casesThere are 4 configurationsAll 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)+-+-+-
30 Surface ViewsA different mapping technique for 2D scalar data is the surface view.Here a surface is created in 3D space, the height representing the scalar valueConstruction is quite easy - suppose we have a rectangular grid
34 Image 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)
37 Cross SectionsAnother option is to look at a cross-section through the dataFor example, if x and y are the independent variables, we could fix y and look at f in terms of just xthen repeat for different ythis reduces the ES2 problem to a sequence of ES1 problems
Your consent to our cookies if you continue to use this website.