Presentation is loading. Please wait.

Presentation is loading. Please wait.

4.1 Vis_04 Data Visualization Lecture 4 Two Dimensional Scalar Visualization Part 2: Further Contouring and Other 2D Techniques.

Similar presentations

Presentation on theme: "4.1 Vis_04 Data Visualization Lecture 4 Two Dimensional Scalar Visualization Part 2: Further Contouring and Other 2D Techniques."— Presentation transcript:

1 4.1 Vis_04 Data Visualization Lecture 4 Two Dimensional Scalar Visualization Part 2: Further Contouring and Other 2D Techniques

2 4.2 Vis_04 Return to Example n Consider this data: Where does the zero level contour go? Can we draw a straight line which will approximate the contour line?

3 4.3 Vis_04 Joining Intersections Directly n It is tempting to approximate by joining intersections with straight lines:

4 4.4 Vis_04 Ambiguity n But this does not always work - look at this data: Try it - it is ambiguous!

5 4.5 Vis_04 What is the Problem? n 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)f 00 +x(1-y)f 10 +(1-x)yf 01 + xyf 11 = BUT how can we draw it? Joining intersections with straight lines was only an approximation

6 4.6 Vis_04 Next point on contour Tracking Contours n 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 Current point on contour Probes BUT THIS IS SLOW!!

7 4.7 Vis_04 Solution by Decomposing Cell n One technique – more efficient than tracking - is to split cell into four triangles n Within a triangle, we can fit a linear model – F(x,y) = a + bx +cy n How do we split? n How do we calculate a,b,c? n What is the gain? f1f1 f2f2 f3f3

8 4.8 Vis_04 Cell Decomposition n Problem of drawing the curved lines has been circumvented by decomposing cell into four pieces within which the contours are well defined straight lines

9 4.9 Vis_04 Avoiding Cell Decomposition n As an alternative to decomposing the cell, we can try to understand how the curved contours of a bilinear interpolant behave n The difficult case is: Opposite vertices: two + and two - Where do the contour lines go?

10 4.10 Vis_04 Bilinear Interpolant n 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: f x =f y =0.. Max in one direction, min in other

11 4.11 Vis_04 A Possible Method n This suggests following method: – in ambiguous case, calculate saddle point and join intersection points according to how bilinear behaves: A B saddle negativesaddle positive Try it on the example earlier

12 4.12 Vis_04 Saddle Point n It is possible to calculate the saddle point in terms of vertex values (from f x = f y =0 ): n And the corresponding value: x = (f 00 - f 01 ) / D;y = (f 00 - f 10 ) / D Saddle value = (f 00 f 11 - f 01 f 10 )/D D = f 00 + f 11 - f 01 -f 10

13 4.13 Vis_04 Problem n In the ambiguous case, will the earlier four triangle method always give the same result as the saddle point method? Try this with both approaches

14 4.14 Vis_04 Greater Accuracy n The greater understanding of the bilinear leads to a more accurate method n 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

15 4.15 Vis_04 2D Interpolation - Scattered Data n Often the data will be given, not on a regular grid, but at scattered locations: f given at each marked point Approach: (i) triangulate (ii) build interpolant in each triangle (iii) draw contours

16 4.16 Vis_04 Triangulation n Triangulation is the process of forming a grid of triangles from the data points How can we construct the triangulation?

17 4.17 Vis_04 Tesselation n 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?

18 4.18 Vis_04 Tesselation - Two or Three Wolves

19 4.19 Vis_04 Tesselation - Two or Three Wolves

20 4.20 Vis_04 Dirichlet Tesselation n The resulting tesselation is known as the Dirichlet or Voronoi tesselation n Given the Dirichlet tesselation for N points P 1, P 2,... P N there is an algorithm for constructing the tesselation when an extra point is added

21 4.21 Vis_04 Dirichlet Tesselation P1P1 P2P2 P3P3 Tesselation for P 1, P 2, P 3 Q Point Q added

22 4.22 Vis_04 Dirichlet Tesselation P1P1 P2P2 P3P3 Q

23 4.23 Vis_04 Dirichlet Tesselation P1P1 P2P2 P3P3 Q

24 4.24 Vis_04 Dirichlet Tesselation – Determine polygon containing Q - here D 3, surrounding P 3 – Construct perpendicular bisector of P 3 Q and find intersection with D 3 - this becomes point of modified tesselation – Determine adjacent polygon - here D 2 – Repeat the above two steps until D 3 is reached again, or there is no intersection – Remove all vertices and edges interior to the new polygon

25 4.25 Vis_04 Delaunay Triangulation P1P1 P2P2 P3P3 Q

26 4.26 Vis_04 Delaunay Triangulation n Triangulation formed by joining points whose territories share a common boundary in the tesselation n This has the nice property that it avoids long skinny triangles n See the nice applets at: Delaunay.html n Note the empty circle property of the Delaunay triangulation

27 4.27 Vis_04 Contouring from Triangulated Data n The final step is to contour from the triangulated data n Easy – because contours of linear interpolant are straight lines – see earlier

28 4.28 Vis_04 Implementing Triangle-based Contouring n Each vertex can be positive or negative (ignore zero for now) n This gives 2 3 = 8 possible cases… n … but there are only 2 distinct configurations – No contour (all same sign) – Contour (2 of one sign, 1 of the other) n Implementation: – Determine which of 8 cases – Select code for the appropriate configuration f1f1 f2f2 f3f3 f1f1 f2f2 f3f3 All same sign Two same sign

29 4.29 Vis_04 Implementing Rectangle- based Contouring n For a rectangle, there will be 2 4 = 16 cases n 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)

30 4.30 Vis_04 Surface Views n A different mapping technique for 2D scalar data is the surface view. n Here a surface is created in 3D space, the height representing the scalar value n Construction is quite easy - suppose we have a rectangular grid

31 4.31 Vis_04 Constructing a Surface View - 1

32 4.32 Vis_04 Constructing a Surface View - 2 Surface created as pair of triangles per grid rectangle. Rendering step is then display of triangles.

33 4.33 Vis_04 Examples - with added contours

34 4.34 Vis_04 Image Plots n A further mapping technique for 2D data is the image plot n There are three variants: – dot array : draw a dot at each data point, coloured according to the value (very fast, but low quality)

35 4.35 Vis_04 Image Plots Grid lines:

36 4.36 Vis_04 Image Plots Areas:

37 4.37 Vis_04 Cross Sections n Another option is to look at a cross- section through the data n 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 E S 2 problem to a sequence of E S 1 problems

Download ppt "4.1 Vis_04 Data Visualization Lecture 4 Two Dimensional Scalar Visualization Part 2: Further Contouring and Other 2D Techniques."

Similar presentations

Ads by Google