emotional sphere physical sphere social sphere Intellectual sphere spiritual sphere.
Manifolds or why a cow is a sphere
-
Upload
linette-norton -
Category
Documents
-
view
230 -
download
2
description
Transcript of Manifolds or why a cow is a sphere
1
Manifoldsor why a cow is a sphere
Cindy Grimm
Media and Machines LabDepartment of Computer Science and Engineering
Washington University in St. Louis
2 Berkeley, 5/5/2005
Overview
• What is a manifold?• Constructive definition
• Building a circle manifold• Simple example showing concepts
• Using a manifold• Surface modeling
• Applications• Environment mapping• Facial animation• Image-based rendering
3 Berkeley, 5/5/2005
What is a manifold?History:•Mathematicians 1880’s
• How to analyze complex shapes using simple maps
•Cartographers• World atlas
Informal definition•Map world to pages
• Each page rectangular• Every part of world on at
least one page• Pages overlap
• May not agree exactly• Agree enough to
navigate
Overlap
The world
4 Berkeley, 5/5/2005
Traditional definition
A manifold M is an object that is locally Euclidean•For every p in M
• Neighborhood U around p• U maps to Rn • No folding, tearing
Technical note:•M may be a surface embedded in Rm
• n is dimension of surface• m >n
•M may be abstract (topological)
1D2D
Not manifold examples
5 Berkeley, 5/5/2005
A mesh is manifold if…
We can construct local maps around points:•Point is in face•Point is on edge
• There are exactly two faces adjacent to each edge
•Point is on vertex• The faces around a vertex v can be flattened
into the plane without folding or tearing• Vertices wi adjacent to v can be ordered
w0,…,wn-1 such that the triangles wi,v,w(i+1)mod n all exist
•Can do on abstract or embedded mesh
2D
P3D
P3D
2D
P
2D
3D
6 Berkeley, 5/5/2005
Traditional definition
Given: Manifold MConstruct: Atlas A•Chart
• Region Uc in M (open disk)• Region c in Rn (open disk)• Function c taking Uc to c
•Atlas is collection of charts• Every point in M in at least
one chart• Overlap regions• Transition functions:
ij = j o i-1 smooth
M
01
21
10
12
12
02
0
7 Berkeley, 5/5/2005
A circle manifold
How to represent a circle?•Problem:
• All we have are Euclidean operations• In R2, must project onto circle
•Solution:• Represent circle as repeating interval
[0,2)• Point +2k is same for all k integer
(1,0)
)sin,(cos)(1 S
122 yxThese are embeddings
This is not
0 2
8 Berkeley, 5/5/2005
/** A point on the circle, represented as an angle value from [0 to 2 pi). If the angle is * bigger (or smaller) it is shifted until it lies in the 0 to 2 pi range */class CirclePoint {protected: double m_dTheta;
public: double GetTheta() const { return m_dTheta; }
CirclePoint( const double in_dTheta ) : m_dTheta( in_dTheta ) {
while ( m_dTheta >= M_PI * 2.0 ) // Bring theta into the 0,2pi range m_dTheta -= 2.0 * M_PI; while ( m_dTheta < 0 ) m_dTheta += 2.0 * M_PI;
}
~CirclePoint() {}};
/// Definition for S^1, an embedding of the circleclass Circle {protected:public: Point2D operator()( const CirclePoint & in_circPt ) const { return Point2D( cos( in_circPt.GetTheta() ), sin( in_circPt.GetTheta() ) ); }
Circle() { } ~Circle() { }};
(1,0)
)sin,(cos)(1 S
9 Berkeley, 5/5/2005
Chart on a circleChart specification:•Left and right ends of Uc
• Counter-clockwise order to determine overlap region
•Co-domain c = (-1/2,1/2)•Simplest form for c
• Translate• Center in [0,2)
• Scale-1/2 1/2
LRtscc ))((
)/(1cc st
Uc-1/2 1/2
( )c ( )
L
R
10 Berkeley, 5/5/2005
Chart on a circleChart specification:•Alpha function
• Sort point first• Euclidean distance
is topological distance
•Alpha inverse• Point in [0,2)
ChartPoint Chart::Alpha( const CirclePoint &in_circpt ) const{ const double dTheta = in_circpt.GetTheta(); double dThetaShift = dTheta;
// Find the value for theta (+- 2 PI) that is closest to my chart center if ( fabs( dTheta - m_dThetaCenter ) <= M_PI ) { dThetaShift = dTheta; } else if ( fabs( (dTheta + 2.0 * M_PI) - m_dThetaCenter ) <= M_PI ) { dThetaShift = dTheta + 2.0 * M_PI; } else if ( fabs( (dTheta - 2.0 * M_PI) - m_dThetaCenter ) <= M_PI ) { dThetaShift = dTheta - 2.0 * M_PI; } else { assert( false ); }
const double dT = (dThetaShift - m_dThetaCenter) * m_dScale;
return ChartPoint( this, dT );}
CirclePoint Chart::AlphaInv( const double in_dT ) const{ const double dTheta = in_dT / m_dScale + m_dThetaCenter;
// Converts to 0,2pi range return CirclePoint( dTheta );}
c
( )
11 Berkeley, 5/5/2005
Making a chartconst Chart *Atlas::AddChart( const CirclePoint &in_circptLeft, const CirclePoint &in_circptRight ){ double dThetaMid = 0.0; double dScale = 1.0;
// Does not cross 0, 2pi boundary if ( in_circptLeft.GetTheta() < in_circptRight.GetTheta() ) { dThetaMid = 0.5 * ( in_circptLeft.GetTheta() + in_circptRight.GetTheta() ); dScale = 0.5 / (in_circptRight.GetTheta() - dThetaMid); } else { // Add 2pi to right end point dThetaMid = 0.5 * ( in_circptLeft.GetTheta() + in_circptRight.GetTheta() + 2.0*M_PI ); dScale = 0.5 / (in_circptRight.GetTheta() + 2.0 * M_PI - dThetaMid); }
if ( dThetaMid >= 2.0 * M_PI ) dThetaMid -= 2.0 * M_PI;
if ( fabs( dScale ) < 1e-16 ) return false;
const Chart *opChart = new Chart( m_aopCharts.size(), dThetaMid, dScale ); m_aopCharts.push_back( opChart );
return opChart;}
LR
L R
12 Berkeley, 5/5/2005
An example circle atlas
Four charts•Each covering ½ of circle•Only 4 points not covered by two charts•Check transition functions
• All translates• Overlaps ½ of chart
Chart 0
),0[,/)2/()(0
)2/()(10 tt
-1/2 1/2
Chart 1
-1/2 1/2
)()(11 tt
)2/3,2/[,/)()(1
Chart 2
-1/2 1/2
)2,[,/)2/3()(2
)2/3()(12 tt
Chart 3
-1/2 1/2
)2/,2/[,/)0()(3
)0()(13 tt
atlas.AddChart( 0.0, M_PI );atlas.AddChart( M_PI / 2.0, 3.0 * M_PI / 2.0 );atlas.AddChart( M_PI, 2.0 * M_PI );atlas.AddChart( 3.0 * M_PI / 2.0, 5.0 * M_PI / 2.0 );
Overlap regions
5.0)(1,0 ssChart 0 Chart 1 Chart 2 Chart 3 Chart 0
5.0)(0,1 tt
5.0)(2,1 ss
5.0)(1,2 tt
5.0)(2,3 ss
5.0)(3,2 tt
5.0)(3,0 ss
5.0)(0,3 tt
0 1
0 1
)0,2/1(1, iiu
)2/1,0(1, iiuTransition functions
02, iiu
)2/1,2/1(, iiu
1 ijij
13 Berkeley, 5/5/2005
Why do I care?
Applications:•Joint angle, closed curveAdvantages:•Can pretend everything is Euclidean
• Make chart that overlaps area of interest• Scaled to fit
• Encapsulates 2 shift once and for all• Use existing code as-is
•Derivatives all work (atlas is smooth)• Can move calculation to overlapping chart
• No seams• No boundary conditions
14 Berkeley, 5/5/2005
Closed curve
Create an embedding of the manifold•Embed each chart
• Standard R->R2 problem•Blend between embeddings
15 Berkeley, 5/5/2005
Joint angle example
Reinforcement learning:•Swing pendulum until balanced
• Can apply angular force at each time step•Goal
• Learn how to apply force from any position, velocity, to get to balanced state
• Manifold: Circle X R• Function on manifold: force to apply
• Learn function on each chart• Blend to get force
•Extend to two joints: Circle X circle X R X R
Pendulum
16 Berkeley, 5/5/2005
Writing functions on manifolds
Do it in pieces•Write embed function per chart
• Can use any Rn technique• Splines, RBFs, polynomials…• Doesn’t have to be homogenous!
•Write blend function per chart• k derivatives must go to zero by boundary• Normalize to get partition of unity
• Spline functions get this for free
17 Berkeley, 5/5/2005
Blend functions
Define proto-blend function•Defined on chart•Support equals chart
• Ck – use B-Spline basis function• Cinf – use rational combination of
exponentials•Promote to function on manifold by setting to zero•Normalized blend function
• Divide by sum• Sum not zero by atlas covering
property• Only influenced by overlapping
charts
Accc
ccc
pB
pBpB))((ˆ
))((ˆ)(
cB
-1/2 1/2
1
Normalized blend function
-1/2 1/2
cB̂
Proto blend function
ccc UppB ,0))((ˆ
18 Berkeley, 5/5/2005
Final embedding function
Embedding is weighted sum•Generalization of splines•Define using transition functions
• Derivatives• Embed point in chart c
Continuity is minimum continuity of constituent parts
Ac
ccc pEpBpE ))(()()(
Accccccc pEpBpE ))(())(())(( 11
19 Berkeley, 5/5/2005
2D manifolds
•Sphere• Point as x2 + y2 + z2 = 1• Latitude-longitude mappings
• Each chart ½ sphere (approx)• Nice 6 chart partition
² Bounded by great arcs
• Polar projection• Charts anywhere• Center plus radius
20 Berkeley, 5/5/2005
2D manifolds
Torus•Nine charts
• Each 2/3 of torus•Torus as tiled plane
• Specify 4 corners• Ordering matters The nine charts
relative to .The plane tiled with copies of
(0,0)
(22)
1
(0,0)
(22)
21 Berkeley, 5/5/2005
2D manifolds
Torus•Overlaps
• May be more than one disjoint region
Chart i
Chart j
22 Berkeley, 5/5/2005
2D manifoldsN-holed torus•Hyperbolic disk tiled with 4n-sided polygon
• Linear fractional transforms• Well-defined inverse
dczbazz
dcba
1
acbd
23 Berkeley, 5/5/2005
Hyperbolic disk
Unit disk with hyperbolic geometry• Sum of triangle angles < 180• Angle is defined by tangents
Lines are circle arcs• Circles meet disk perpendicularly
24 Berkeley, 5/5/2005
N-holed torus
Why hyperbolic geometry?•4n-sided polygon
• Each paired edge creates loop• One loop through hole• One loop around
•Tiling• Corners that meet at 2/(4n)
angles
2
01
365
7 4
1a1b
1c
a
1d
b
d
c 0
1
65
4
3
2
7
25 Berkeley, 5/5/2005
N-holed atlas
One chart for each element of polygon•Face•Edge
• Two maps to center polygon•Vertex
• 4n maps to center polygon
02 1
4 37
5 6
)21,
21(
)21,
21( )
21,
21(
)21,
21(
26 Berkeley, 5/5/2005
N-holed arbitrary charts
LFT specifies center and radius•Data structures to keep track of which copies are overlapped
27 Berkeley, 5/5/2005
Surface modeling applications
Parameterization•Use correct topology
• No seams• Well-defined overlaps
• Mip-mapping, texture transfer, fluid-flow, procedural textures
Spherical cow
28 Berkeley, 5/5/2005
Surface modeling applications
Surface reconstruction•Choice of embedding function
• Spline, RBF, etc.•Decide number of charts
• Fit each chart individually• No boundary constraints
Original mesh
Mesh in 1-1 correspondence
with manifold
Base
Ear
Tail
Spline
RBF
29 Berkeley, 5/5/2005
Surface modeling applications
Consistent parameterizations•Selected points on both meshes•Parameterize both so points match
• Fit surface
Fitted surfaces
Source meshes(David Laidlaw,
Brown University)
LeftRight
(reflected)
30 Berkeley, 5/5/2005
Surface modeling
Making new models•Start with manifold of correct topology•User creates sketch (mesh)
• Embed mesh in topology• Creates atlas
• Use mesh geometry to create chart embeddings
31 Berkeley, 5/5/2005
Surface modeling
Editing models•Draw on surface to indicate locations for new charts
• Inverse function (embedding to manifold) well-defined
•Caveat: How do we ensure new charts “over-ride” old ones?
• Surface pasting or hierarchical editing
32 Berkeley, 5/5/2005
Adding charts
Adding new charts•Option 1) Crank up blend function•Option 2) “Zero-out” blend functions in higher level
• Define masking function for each level
)))((1()(ˆ)( ppBpB ccjcij
ic
ic
33 Berkeley, 5/5/2005
Other applications
Environment mapping•Parameterization of the sphereAnimation•Configuration space is a manifoldImage-based rendering•Rotation and “push-broom” camera capture
• Goal is to find single image (manifold)• Lining up images == finding transition functions
34 Berkeley, 5/5/2005
Conclusion
Manifolds:•Provide a natural way to partition complex surfaces
• Simple functions on Rn
• Maintain analytic properties• “Moving” analysis (no seams!)
•Separate topology from geometry• Adjacency relationships• Consistent parameterizations
•Encapsulate non-Euclidean operations• Closest point, geodesics, movement in domain