vector visualizationsolar.gmu.edu/teaching/2013_cds301_spring/notes/ch6_vector/ch6_… · •vector...
TRANSCRIPT
CDS 301
Spring, 2013
Vector Visualization Chap. 6
March 7, 2013 – March 26, 2013
Jie Zhang Copyright ©
Outline
6.1. Divergence and Vorticity
6.2. Vector Glyphs
6.3. Vector Color Coding
6.4. Displacement Plots (skip)
6.5. Stream Objects
6.6. Texture-Based Vector Visualization
6.7. Simplified Representation of Vector Fields
(skip)
CH 6.1 Divergence and
Vorticity
Vector Function
) D-2:case(simpler
D)-3in (usually
22
33
RRf:
RRf:
Vector versus Scalar
),,(
),,(
),,(
V
V
V
),,(
ˆˆˆ
:Vector
z
y
x
zyxf
zyxf
zyxf
V
or
VVVV
or
kVjViVV
V
z
y
x
zyx
zyx
),,(
s :Scalar
zyxfs
s
Example in 2-D
x
y
),(
),(
V
V
:Vector
y
x
yxf
yxfV
V
V
y
x
yxs
es
yxfs
yx
:exp
),(
s :Scalar
)( 22
Gradient of a Scalar
)(
)(
)(
22
22
22
2
2
2D:Exp
),,(
vectora isscalar a ofGradient
yx
y
yx
x
yx
yey
sV
xex
sV
es
z
s
y
s
x
ssV
Gradient of a Scalar
1
1
2D:Exp
y
sV
x
sV
yxs
y
x
Divergence of a Vector
3D)in volumeand 2Din (area
Γby enclosed area theis|Γ|
3D)in surface closed and
2Din curve (closed
cehypersurfa closed is Γ
dsnVV )(||
1lim
0
Divergence of a Vector
•Divergence computes the flux that the vector field
transports through the imaginary boundary Γ, as Γ0
•Divergence of a vector is a scalar
•A positive divergence point is called source, because it
indicates that mass would spread from the point (in fluid
flow)
•A negative divergence point is called sink, because it
indicates that mass would get sucked into the point (in fluid
flow)
•A zero divergence denotes that mass is transported
without compression or expansion.
Divergence of a Vector
x
V
x
V
x
V zyx
V
source :divergence Positive
211V
y)(x,V
:Exp
Free Divergence
000V
x)(y,V
:Exp
sink :divergence Negative
211V
(-x,-y)V
:Exp
Divergence of a Vector
(March 07, 2013 Stops Here)
March 19, 2013
Review: Divergence of a Vector
x
V
x
V
x
V zyx
V
source :divergence Positive
211V
y)(x,V
:Exp
Free Divergence
000V
x)(y,V
:Exp
sink :divergence Negative
211V
(-x,-y)V
:Exp
Vorticity of a Vector
3D)in volumeand 2Din (area
by enclosed area theis|Γ|
3D)in surface and 2Din (curve
cehypersurfa closed is
)(||
1lim
0sdVV
Vorticity of a Vector
•Vorticity computes the rotation flux around a point
•Vorticity of a vector is a vector
•The magnitude of vorticity expresses the speed of angular
rotation
•The direction of vorticity indicates direction perpendicular
to the plane of rotation
•Vorticity signals the presence of vortices in vector field
Vorticity of a Vector
y
V
x
V
x
V
z
V
z
V
y
V
xy
zx
yz
V
000)V(
0)V(
0)V(
0) y,(x,VFor
0
0V
ocityplanar vel 2Dfor :Exp
y
x
z
z
z
Vorticity of a Vector
y
V
x
V
x
V
z
V
z
V
y
V
xy
zx
yz
V
211)V(
0)V(
0)V(
x,0)(-y,VFor
0
0V
ocityplanar vel 2Dfor :Exp
y
x
z
z
z
Vorticity of a Vector
Stream line:
vector direction
Color: vorticity
CH 6.2 Vector Glyph
Vector Glyph
))(,( xVkxxl
x
V
•Vector glyph mapping technique associates a vector glyph
(or icon) with the sampling points of the vector dataset
•The magnitude and direction of the vector attribute is
indicated by the various properties of the glyph: direction,
orientation, size and color
Vector Glyph
Line glyph,
or hedgehog glyph:
Orientation,
Length
and Color
Sub-sampled by
a factor of 8
(32 X 32)
Original (256 X 256)
Velocity Field of a 2D Magnetohydrodynamic Simulation
Vector Glyph
Velocity Field of a 2D Magnetohydrodynamic Simulation
Line glyph,
or hedgehog glyph
Sub-sampled by
a factor of 4
(64 X 64)
Original (256 X 256)
Vector Glyph Sub-sampled by
a factor of 2
(128 X 128)
Original (256 X 256)
Problem with a dense
Representation using
glyph:
(1) clutter
(2) miss-representation
Vector Glyph
Random
Sub-sampling
Is better
Vector Glyph: 3D Simulation box: 128 X 85 X 42; or 456,960 data point
100,000 glyphs
Problem: visual occlusion
Vector Glyph: 3D Simulation box: 128 X 85 X 42; or 456,960 data point
10,000 glyphs: less occlusion
Vector Glyph: 3D Simulation box: 128 X 85 X 42; or 456,960 data point
100,000 glyphs, 0.15 transparency: less occlusion
Vector Glyph: 3D Simulation box: 128 X 85 X 42; or 456,960 data point
3D velocity isosurface
Vector Glyph
•Glyph method is simple to implement, and intuitive to
interpretation
•High-resolution vector datasets must be sub-sampled in
order to avoid overlapping of neighboring glyphs.
•Glyph method is a sparse visualization: does not
represent all points
•Occlusion
•Subsampling artifacts: difficult to interpolate
•Alternative: color mapping method is a dense visualization
Matlab: Vector We will use Matlab to implement the vector visualization.
For one well-illustrated example, refer to “wind.m”
Matlab: Vector
Question
Use Matlab to visualize the 2-D vector function F, which is
defined as
Fx(x,y) = x
Fy(x,y) = y
“quiver” plot
%example
[x,y]=meshgrid(-2:0.2:2)
u = x % fx, or x-component of the vector
v = y % fy, or y-component of the vector
quiver(x,y,u,v)
“divergence” plot
%example
[x,y]=meshgrid(-2:0.2:2)
u = x % fx, or x-component of the vector
v = y % fy, or y-component of the vector
quiver(x,y,u,v)
%calculate and display the divergence
div=divergence(x,y,u,v)
hold on
imagesc([-2.0,2.0],[-2.0,2.0],div)
alpha(0.5)
“gradient” and “curl”
[FX, FY, FZ] = gradient(F)
[curlx, curly, curlz, cav] = curl (X, Y, Z, U, V, W)
(March 19, 2013 Stops Here)
March 21, 2013
(1) Gradient, Divergence and Vorticity
(2) Vector Glyph
Review
Review
%Author: Jie Zhang
%Date: March 20, 2013
%Purpose: CDS301 class CH6: Visualize the gradient, divergence and
%vorticity
%Scalar function: a double peak 2-D Gaussian function
%Vector function: the gradient of the Gaussian function
%Divergence function: divergence of the gradient
%Vorticity: the curl of the vector function
%clear the variables and figure space
clear
clf reset
%define the domain
%x: [-2.0, 2.0], and y: [-2.0,2.0]
[x,y]=meshgrid([-2.0:0.2:2.0],[-2.0:0.2:2.0]);
%define the Gaussian function
z=x.*exp(-x.^2-y.^2);
%surf(x,y,z) %get the idea of the data
“Gaussian_gradient_divergence.m”
Review
%display the image
hf_1=figure(1)
%hi_1=imagesc([-2.0,2.0],[-2.0,2.0],z)
hi_1=surface(x,y,z)
%get(hi_1) %find the handle values
set(hi_1,'EdgeAlpha',0) %remove the wireframe lines, or edge lines
set(hi_1,'FaceColor','interp') %smooth color from the surface
colorbar %colorbar indicates the values
%calculate the gradient
[gx,gy]=gradient(z,0.2,0.2) %note that spaceing between points is 0.1
hf_2=figure(2)
%surf(x,y,gy)
quiver(x,y,gx,gy)
“Gaussian_gradient_divergence.m” (continued)
Review
%calcuate the divergence
div=divergence(x,y,gx,gy)
hf_3=figure(3)
surf(x,y,div)
%calculate the vorticity
[curlz,cav]=curl(x,y,gx,gy)
hf_4=figure(4)
surf(x,y,curlz)
“Gaussian_gradient_divergence.m” (continued)
CH 6.3 Vector Color Coding
Vector Color Coding
•Similar to scalar color mapping, vector color coding is to
associate a color with every point in the data domain
•Typically, use HSV system (color wheel)
•Hue is used to encode the direction of the vector, e.g.,
angle arrangement in the color wheel
•Value of the color vector is used to encode the
magnitude of the vector
•Saturation is set to one (e.g., no white color)
2-D Velocity
Field of the
MHD
simulation:
Orientation:
color
Magnitude:
brightness
Vector Color Coding
2-D Velocity
Field of the
MHD
simulation:
Orientation
only; no
magnitude
Vector Color Coding
Vector Color Coding
•Dense visualization
•Lacks of intuitive interpretation
• take time to be trained to interpret the image
CH 6.4 Stream Objects
Stream Objects
•Vector glyph plots show the straight trajectories over a
short time (fixed velocity) of trace particles released in the
vector fields
•Shows the direction of the flow at a given point
•Stream objects show the curved trajectories for longer
time intervals (varying velocity with time) of trace particles
released in the vector field.
•Follow the flow and trace out the flow
Streamlines
•Streamline is a curved path over a given time interval of a
trace particle passing through a given start location or
seed point
point seed the,)0(
)()
T]} [0, ),({
0
0
pp
where
dtpV(τp
pS
t
Streamlines
•All lines are traced up to the same time T
•Seed points (gray ball) are uniformly sampled
•Color is used to reinforce the vector magnitude
Streamlines: Issues •Require numerical integration, which accumulates errors
as the integration time increases
tVpp
where
tipVdtpV(τp
iii
t
it
11
/
00
)()()
nintegratioEuler
•Euler integration: fast but less accurate
•Runge-Kutta integration: slower but more accurate
•Need to find optimal value of time step Δt
•Choose number and location of seed points
•Trace to maximum time or maximum length
•Trace upstream or downstream
•Saved as a polyline on an unstructured grid
Stream tubes
Tracing
downstream:
the seed points
are on a regular
grid
•Add a circular cross section along the streamline curves,
making the lines thicker
Stream tubes
Tracing
upstream: the
arrow heads
are on a regular
grid
Stream Objects in 3-D
Input:
128 X 85 X 42
Undersampling:
10 X 10 X 10
Opacity 1
Maximum
Length
Stream Objects in 3-D
Input:
128 X 85 X 42
Undersampling:
3 X 3 X 3
Opacity 1
Maximum
Length
Stream Objects in 3-D
Input:
128 X 85 X 42
Undersampling:
3 X 3 X 3
Opacity 0.3
Maximum Time
Stream Objects in 3-D
Stream tubes
Seed area at
the flow inlet
Stream Ribbons
Two
thick
Ribbons
Vorticity
is color
coded
Vector
Glyth
Stream Ribbons
•A stream ribbon is created by launching two stream lines
from two seed points close to each other. The surface
created by the lines of minimal length with endpoints on
the two streamlines is called a stream ribbon
Stream Surface
•Given a seed curve Γ, a stream surface SΓ is a surface
that contains Γ and its streamlines
•Everywhere tangent to the vector field
•Flow can not cross the surface
•Stream tube is a particular case of a stream surface: the
seed curve is a small closed curve
•Stream ribbon is also a particular case of a stream
surface: the seed curve is a short line
(March 21, 2013 Stops Here)
March 26, 2013
Vector
Color
Coding
Review
Stream
Tubes
Review
CH 6.6 Texture-Based Vector
Visualization
Texture-Based Vector Vis.
•Discrete or sparse visualizations can not convey
information about every point of a given dataset domain
•Similar to color plots, texture-based vector visualization is
a dense representation
•The vector field (direction and magnitude) is encoded by
texture parameters, such as luminance, color, graininess,
and pattern structure
Vector
magnitude:
Color
direction:
Graininess
Texture-Based Vector Vis.
LIC principle: Line
Integrated
Convolution
Principle
Texture-Based Vector Vis.
function blurring of width :
function blurringor weighting:
Ppoint seed of streamline :
texturenoise :
)(
)(
)()),(()(
2
L
k(s)
S(p,s)
N
esk
dssk
dsskspSNpT
s
L
L
L
L
Texture-Based Vector Vis.
•LIC is a process of blurring or filtering the texture (noise)
image along the streamlines
•Due to blurring, the pixels along a streamline are getting
smoothed; the graininess of texture is gone
•However, between neighboring streamlines, the
graininess of texture is preserved, showing contrast.
End
of Chap. 6
Note: skip 6.7