Hank Childs, University of Oregon November 6 th, 2013 Spatial-Based and Variable-Based Selections
Announcements Final project – Come in & talk with me OH: – Weds 10-11:30 – Thurs Who wants to take 610 class?
Project #7A You write a VTK program. – I expect that your answers will be partially derived from previous VTK programs – Python OK 4 renderers in 1 window isosurface three slices hedgehogs streamlines Please note that this is the longest time I have allocated for an assignment all quarter
Project #7B You will read a data file and put it into VTK You will compare two VTK data sets and see where they differ You will write code to thin hedgehog plots – (7A prompt will be changed)
Slicing Assume rectilinear mesh with – X={0,1,2,3,4,5,6,7,8,9} – Y={0,1,2,3,4,5,6,7,8,9} – Z={0,1,2,3,4,5,6,7,8,9} How do we generate slice at Y=5?
Slice at Y=5 Output mesh: – X={0,1,2,3,4,5,6,7,8,9} – Y={5} – Z={0,1,2,3,4,5,6,7,8,9} for (int z = 0 ; z < 10 ; z++) for (int x = 0 ; x < 10 ; x++) outF[z*10+x] = F[z*100+5*10+x];
Slicing Assume rectilinear mesh with – X={0,1,2,3,4,5,6,7,8,9} – Y={0,1,2,3,4,5,6,7,8,9} – Z={0,1,2,3,4,5,6,7,8,9} How do we generate slice at Y=5.3?
Slice at Y=5.3 Output mesh: – X={0,1,2,3,4,5,6,7,8,9} – Y={5.3} – Z={0,1,2,3,4,5,6,7,8,9} for (int z = 0 ; z < 10 ; z++) for (int x = 0 ; x < 10 ; x++) outF[z*10+x] = (0.3)*(F[z*100+6*10+x]-F[z*100+5*10+x]) + F[z*100+5*10+x];
Slicing Assume rectilinear mesh with – X={0,1,2,3,4,5,6,7,8,9} – Y={0,1,2,3,4,5,6,7,8,9} – Z={0,1,2,3,4,5,6,7,8,9} How do we generate slice at plane X+Y+Z=0? Answer: we will need “distance functions”
Distance Functions Distance function: measures how far a point is from surface Example: how far are you from the plane X+Y+Z=0? How far is the point (3,0,0) from this plane? Answer: 3 units
(0,0) (1,1) Distance Functions Distance function: measures how far a point is from surface Example: how far are you from the plane X+Y+Z=0? How far is the point (1,1,0) from this plane? 2 units Cross-section at Z=0 Answer: sqrt(2) units
How to use distance functions to slice? Step #1: create distance function Step #2: isosurface with isovalue = 0
Revisiting Y=5.3 Some cells straddle Y=5.3 When classifying, all Y=5 get 0, all Y=6 get Y
Distance Functions: approximate version Distance function: measures how far a point is from surface Example: how far are you from the plane X+Y+Z=0? How far is the point (x,y,z) from this plane? Approx. answer: x+y+z units Why? Approximate answer: the overestimates (on both sides) cancel each other out.
Analogy UCD Math 127A: Introduction to Mathematical Analysis 10 week course First 8 weeks: – Intermediate Value Theorem Last two weeks: – All of derivatives and integrals
Threshold Keep cell if it meets some criteria, else discard Criteria: – Pressure > 2 – 10 < temperature < 20 Cells that meet criteria
How to implement threshold Iterate over cells If a cell meets the criteria, then place that cell in the output Output is an unstructured mesh
Interval Volumes Isolates portion of volume between two values, V_low and V_hi.
Interval volumes vs isosurfaces Interval volume between 2.5 and 2.7. Isosurfaces at 2.5 and 2.7.
How to implement interval volumes Iterate over cells Like marching cubes, but making topologically 3D output (tetrahedrons, not triangles) Now 3 states: below, within interval, above Many, many cases to determine
Box Isolate portion of volume within a box -8 < x < 8 -9 < y < < z < 6.4
How to implement box Iterate over cells Three cases: – Retain cell – Discard cell – Split cell (i.e., straddles box boundary) How to split cell? – Box:Interval Volume as Slicing:Isosurfacing (set up 6 distance fields and use interval volumes) (why not 1 distance field?)
Clip Clip by arbitrary functions
How to implement Clip Same as Box, but different spatial function Iterate over cells Three cases: – Retain cell – Discard cell – Split cell (i.e., straddles clip boundary) How to split cell? – Clip:Interval Volume as Slicing:Isosurfacing (possibly multiple clips)
Slicing by non-planes
How to non-planar slicing Set up distance function for spatial function (cone, sphere) Apply Marching Cubes
Isosurface by one variable, color by another Isosurface by var1, color by var1 Isosurface by var1, color by var2
How to implement isosurface by var1, color by var2 Marching Cubes based on var1. Need operation: – As Marching Cubes calculates each triangle, evaluate var2 for each vertex of that triangle – Create variable var2 on output triangle mesh