Chapter 9 Advanced Algorithms Yingcai Xiao Constructing Topology • Data collected in the real world ① Usually scattered, not confirming to a grid. ② Can be interpolated into a grid. But problem rises when we use global interpolation methods. Scattered Data: sample points distributed unevenly and non-uniformly throughout the volume of interest. Example Data: chemical leakage at a tank-farm. n Thin-plate Spline f ( x, y, z ) = bd i i =1 2 i log ( d i ) + c1 + c 2 x + c 3 y + c 4 z Volume Spline n f ( x, y, z ) = bd i i =1 3 i + c1 + c 2 x + c 3 y + c4 z Shepard method f ( x, y, z ) = n 1 di vi i =1 n 1 di i = 1 • Data collected in the real world ① Can we use local interpolation with the closest points? ② Need to find and connect the closest points. ③ Demo in 2D. Visualizing Unstructured Points Triangulation: Connect points to form a triangulated topological structure. (topology generation) Triangulation Use Edge Swapping to make a Delaunay Triangulation. 1. Find the minimum bounding triangle. (may need to add a fake point) 2. Add one point at a time, do triangulation. 3. After each point is added, check if the joined triangles are optimal or not; if not swap the joining edge (edge swapping). Check all other triangles and make sure they are still optimal after adding the current point. 4. Repeat step 3 to add each point and we when all points are added and all triangles are optimal. 5. Clean up: remove all fake points and related triangles. Triangulation Properties of Delaunay Triangulation: 1. Circumsphic property: no other points in the circumspheres. 2. Optimal property: The minimum interior angle of a triangle is greater than or equal to the minimum interior angle of any other triangulation 3. It is the dual of the Diritchlet tessellation ① Voronoi cell, Centroid ② A collection of connected Voronoi cells tessellete the area (partition, coverage) Triangulation Formal definition of Triangulation: N dimensional triangulation of a point set P=(P1, P2, ……,Pn) is a collection of ndimensional simplexes (triangles) whose defining points lie in P. Optimal Triangulation: a triangulation that generates maximized minimum angles. Delaunay Trianglation: an optimal triangulation, which satisfies the circumshpere condition. Circumsphere Condition: the circumshpere of any n-dementional simplexe contains no other points of p except the n+1 points defining the simplex. Triangulation Example VTK Code: vtkPolyData *p= vtkPolyData::New(); pSetPoints(pnts); //pnts: pointer to an array of points, vtkFloatPoints vtkDelaunay3D *d= vtkDelaunay3D::New(); dSetInput(p); dSetTolerance(0.0001); vtkPolyDataMapper *m= vtkPolyDataMapper::New(); mSetInput(dGetOutput); vtkActor *a= vtkActor::New(); aSetMapper(m); Visualizing Unstructured Points Splatting for Point Data Gaussian Splatting s: scale factor SF(r) = se - f (r/R)2 R: radius of influence Data value assigned to grid nodes within the radius of influence of the data point. Scalar Algorithms Marching Triangles for Contour Lines 8 cases, 3 unique, doted vertexes are inside: v > contour value Marching Tetrahedrons for Isosurface. Dividing Cubes • Generate contour surfaces using dense point clouds. • For each voxel, interpolate into it if the contour going through it, display points around the interpolated surface. • Subdivide the voxel to have each subvoxel cover one pixel. Draw a point in the subvoxel if it is near the isosurface (nodal values brace the threshold values). • Display points are much faster than surfaces. • The resulting surface is not continuous. Dividing Cubes Carpet Plots • Display a 2D grid (a slice of a 3D grid) as a 3D extruded surface based on the data values • The extrusion is perpendicular to the 2D slice and is proportional to the data values. Carpet Plots V(r) = e-r cos(10r); Clipping Geometry with a Scalar Field Original Geometry Clipped Geometry Clipping Geometry with a Scalar Field • Data controlled geometry change. • To reveal the inside of a volume. Ex. Data values: v(x,y,z) = x + y + z – c Isosurface: v=0 defines a plane, use it to cut geometry. Marching Cube Cases: Vertex inside/outside 256=>15 Unique cases Clipping Geometry with a Scalar Field Marching Triangles: 8 cases, 4 unique (doted vertexes are inside: v < 0) Clip a plane by a cylinder and a sphere. vtkImplicitBoolean *ib = vtkImplicitBoolean::New(); ibAddFunction(cylinder); ibAddFunction(sphere); vtkClipPolyData *c = vtkClipPolyData::New(); cSetInput(planGetOutput()) cSetClipFunction(ib); cGenerateClippedOutputOn(); cGenerateClipScalarsOn(); cSetValue(0) // v = 0; Vector Algorithms Stream Tubes Stream Lines depict flow direction of a vector fields What about temperature? Color coding. How about add speed, acceleration, vortisity (twist)? Tensor Algorithm Hyperstreamlines High Dimensional Visualization F(x), F(x,y), F(x,y,z), F(x1, x2, x3, ……) • Glyph, use each part of the glyph for a variable. • Use Parallel Coordinate Systems x1 x2 x3 x4 Plot of a four dimensional point. Parallel Coordinate Systems • Brushing • Minimal Example • Reordering • Coloring x1 x2 • Compositing • Progressive Rendering • Bundling x3 x4 Plot of a four dimensional point. Parallel Coordinate Systems http://www.xdat.org http://www.cs.tau.ac.il/~aiisreal/ https://github.com/syntagmatic/parallel-coordinates https://syntagmatic.github.io/parallel-coordinates/ http://www.ggobi.org/docs/parallel-coordinates/ http://en.wikipedia.org/wiki/Parallel_coordinates http://stn.spotfire.com/spotfire_client_help/para/para_what_is_a_parallel_ coordinate_plot.htm https://eagereyes.org/techniques/parallel-coordinates http://exposedata.com/parallel/ http://www.b-eye-network.com/view/3355 http://www.parallelcoordinates.de/#toggleControls Modeling Algorithms Modeling Algorithms • Visualizing Geometry: • bundary cells • outlines, • wireframe (w/s in a VKT window) • Data Extraction: Dataset => Subset Extract portions of data from a dataset. • Geometry Extraction portion of a grid, set of cells subsampling: every nth data point is selected. • Threshholding: extracting based on data values. May change topology, e.g., uniform => unstructured. Probing (Resampling): Dataset => Another Dataset • Obtains dataset attributes by sampling the original dataset with a set of points (the probe). • Data values can be viewed in a particular fashion. Swept Volume and Surfaces: Visualize Motion A swept volume is the volume of space occupied by an object as it moves through space along a given trajectory. A polygonal is created from the original. – Path: ST – Steps: L – Boolean Operation Triangle Strip Generation Triangle strips are compact representations of triangle polygons. Greedy method: The longer the average strip length is the better. http://en.wikipedia.org/wiki/File:Triangle_Strip_Small.png Polygon Normal Generation Reflection: • I~f(N,C) i.e., C.N.I • Normal may not be given by the progammer. Facet Normal: Compute normal of a polygon from its vertexes. Ex. V1 V1 ´V2 N= | V1 ´V2 | Polygon Normal Generation: facet / polygonal normals Polygon Normal Generation Vertex Normals: Use the average of the facet normals in the use set. Polygon Normal Generation Vertex Normals: Shaded using vertex normal (average of facet normals), too smooth. Polygon Normal Generation Feature Angle ~800 <900 Take the facet out of the average computation if the connected facets have angle greater than the feature angle Decimation Polygon Reduction (Vertex Reduction) Threshold Distance: For lines: is the distance to the line without the vertex. Decimation For surface: is the distance to the surface without the vertex. Mesh Smoothing No reduction, no topology change. But the geometry changes to make the mesh smooth. Mesh Smoothing No reduction, no topology change. But the geometry changes to make the mesh smooth.