Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
IDC-CG 1
Solid Modeling
Chapter 11-12 in FVD, Chapter 10 in Hearn & Baker
IDC-CG 2
3D Object Representation
• Solid Modeling attempts to develop methods and algorithms to model and represent real objects by computers.
• Since there are many different kinds of objects (trees, flowers,clouds, rocks, buildings, water, fire,...), modeling techniques are diverse.
IDC-CG 3
Object Representation• The need to represent objects
arises in two cases:– Modeling of existing objects.
• Approximate modeling.
– Sculpting an object "from scratch".• modeling is precise.• interactive sculpting capabilities.
• Three types of objects in 3D:– 1D curves.– 2D surfaces.– 3D objects.
IDC-CG 4
General Techniques for Modeling
• Primitive Based: A composition of “simple” components.– Not precise.– Efficient and Simple.
• Free Form: Global representation, curved manifolds.– Precise.– Complicated.
• Statistical Form: Modeling of statistical phenomena, such as: fog, trees, rocks.
IDC-CG 5
Lecture Plan • 1D Curves in 3D
– Primitive based: line segments.– Free form:
• Implicit, Explicit, Parametric (polynomials, splines)
• 2D Surfaces in 3D– Primitive Based: Polygon mesh.– Free Form: As above
• 3D volumes in 3D– Volume Rep.
• Sweep volumes• Spatial Occupancy (voxels, Octree, BSP)• Constructive Solid Geometry
– Boundary Rep.• Polyhedra• Free form: as above
IDC-CG 6
Curve Representation
IDC-CG 7
Curves: Primitive Based
• Line segments: A curve is approximated by a collection of connected line segments.
IDC-CG 8
• Implicit form: f1(x,y,z)=0 & f2(x,y,z)=0
– Not efficient for drawing
• Parametric: x(u), y(u), z(u) – A mapping from [0,1]®R3
u ® [x(u),y(u),y(u)] ; uÎ[0,1]
– Common for drawing.
Curves: Free Form
IDC-CG 9
Example: A Circle of radius R
• Implicit: x2+y2+z2-R2=0 & z=0
• Parametric: x(u)=Rcos(q)y(u)=Rsin(q)z(u)=0
• How do we deal with transformations?
q
x
y
z
IDC-CG 10
Approximation/Interpolation by Parametric Curves
• Given a set of control points Pi known to be on the curve, find a parametric curve that interpolates/approximates the points.
P0
P1
P2
P3
P4
P0
P1
P2
P3
P4
Interpolating Curve
Approximating Curve
IDC-CG 11
Parametric Polynomials• For interpolating n points we need a
polynomial of degree n-1.
• Polynomial interpolation has several disadvantages:– Basis functions with wide supports,
coefficients are geometrically meaningless, global effects.
– Polynomial degree is high ®unwanted wiggles are introduced.
– Polynomial degree is low ®too little flexibility.
p0
p1
p2
p3
p4
!+++= 2321)( uauaaux
IDC-CG 12
The solution:Spline Representation
• Piecewise, low degree, polynomial curves, with continuous joints.
• Advantages:– Rich representation.– Geometrically meaning coefficients.– Local effects (local supported B.F.)– Interactive sculpting capabilities.
(Will be covered at later lessons)
p0
p1
p2
p3
p4c1(u)
c2(u) c3(u) c4(u)
IDC-CG 13
Surface (2D) Representation
IDC-CG 14
Primitive Based: Polygon Mesh• A polygonal mesh is a collection of
polygons that defines a 2D surface.• Polygon entities:
– Vertex • shared by at least two edges
– Edge • Connects two vertices.• Can be shared by two polygons
– Face• Defined by a polygon.• Has two sides: inside and outside
– Normal• Attached to each vertex (!)
IDC-CG 15
• Curved surfaces can be approximated by polygonal meshes:
IDC-CG 16
Properties of Meshes
• Connectivity: A mesh is connectedif there is an path of edges between any two vertices.
• Simplicity: A mesh is simple if the mesh is connected and has no holes in it.
• Planarity: A mesh is planar if every face of it is a planar polygon.
IDC-CG 17
Representing Polygon Meshes
v1
v2
v4
v3
v5
• Explicit (vertex list):F1=(V1 V2 V3)F2=(V2 V5 V4 V3)
• Pointers to a vertex listV=(V1 V2 V3 V4 V5)
F1=(1 2 3)F2=(2 5 4 3)
• Pointers to an edge listV=(V1 V2 V3 V4 V5)
E1=(1 2 F1)E2=(3 1 F1)E3=(2 3 F1 F2)E4=(4 3 F2)E5=(5 4 F2)E6=(2 5 F2)
F1=(1 3 2)F2=(3 6 5 4)
E1
E2
E3
E4
E5
E6
F1F2
IDC-CG 18
Properties:• Explicit:
– Space effective for single polygons– Not very informative– Redundant (issues: efficiency, correctness)
• Pointers to a vertex list:– Saves spaces for shared vertices– Easy to modify a single vertex– Difficult to find neighboring polygons– Multiple drawing of shared edges
• Pointers to an edge list– Solves multiple drawing and clipping
problem– Still hard to find all edges sharing a vertex
IDC-CG 19
Freeform Surface Representation
• Explicit form: z=f(x,y)– f(x,y) must be a function.– Not a rotation invariant representation.– Difficult to represent vertical tangents.
• Implicit form: f(x,y,z)=0– Difficult to connect two surfaces in a
smooth manner.– Not efficient for drawing.
– Useful for testing object inside/outside.
• Parametric: x(u,v), y(u,v), z(u,v)– A mapping from [0,1]2®R3.– Very common in modeling.
IDC-CG 20
• Example: Sphere of radius R
• Explicit: z=sqrt(R2-x2-y2) z=-sqrt(R2-x2-y2)
• Implicit: x2+y2+z2-R2=0
• Parametric: (x,y,z)=(R cosq cosf,R sinq cosf, R sinf)
qÎ[0 2p] , f Î[-p/2 p/2 ]
fq
IDC-CG 21
Approximated/Interpolated Parametric Surfaces
• Given a set of control points Pi known to be on the surface, find a parametric surface that interpolates/approximates the points.
IDC-CG 22
( )( )( ) ( ) ( )uvSuSvvuS
vuuCDuuSuBAuuS
21
2
1
)1(,]1,0[,)1(
)1(
+-=Î+-=
+-=
Bilinear Interpolation
u
v
A B
CD
0 1
1
• An interpolating parametric surface s(u,v), passing through 4 points.
• The surface is linear for a fixed u or v.• Can be performed for x(u,v), y(u,v), or
z(u,v).
S1
S2
IDC-CG 23
Bilinear example
z=15 z=7
z=2 z=3
u
v
1
1.5
2
1
1.5
20
5
10
15
z
u v
0
10
IDC-CG 24
Parametric Surface Splines
( )åå=i j
ij vucvuc ,),(
• In Bilinear interpolation the “seams” between patches are non differentiable.
• Solution: A Spline surface. Piecewise low-degree polynomial surface patches with continuous seams.
IDC-CG 25
3D VolumeRepresentation
IDC-CG 26
• Boundary Rep.– Polyhedra– Free form.
• Volume Rep.• Sweep volumes• Spatial Occupancy(voxels,
Octree, BSP)• Constructive Solid Geometry
3D VolumeRepresentation
IDC-CG 27
Boundary Representation
• A closed 2D surface defines a 3D object.
• At each point on the boundary there is "in" side and "out" side.
• B-reps can be defined in two ways:– Primitive based. A collection of
primitives forming the boundary.– Freeform based (splines, parametric
surface, implicit forms).
IDC-CG 28
Primitive Based: Polyhedra• A polyhedron is a solid bounded by a set
of polygons.• A polyhedron is constructed from:
– Vertices V– Edges E– Faces F
• Each edge must connect two vertices and be shared by exactly two faces.
• At least three edges must meet at each vertex
IDC-CG 29
• A simple polyhedron is one that can be deformed into a sphere (contains no holes).
• A simple polyhedron must satisfies Euler's formula:
V=8E=12F=6
V=5E=8F=5
V-E+F=2
V=6E=12F=8
IDC-CG 30
Free Form Boundary Representation
• To define a volume, its boundary should be closed.
• With parametric spline we define a closed surface by cyclic-connecting the surface points.
IDC-CG 31
IDC-CG 32
Sweep VolumesSweep Volume = 1. 2D Cross section area2. Sweeping rule
Translational Sweep = 2D area swept along a linear trajectory normal to the 2D plane.
Tapered Sweep = scale area while sweeping.
Volume Representation
IDC-CG 33
Slanted Sweep = trajectory is not normal to the 2D plane.
Rotational Sweep = 2D area is rotated about an axis.
General Sweep = any object along any trajectory with any transformation along the sweep.
IDC-CG 34
Translational and rotational sweep volumes.
IDC-CG 35
Spatial Occupancy Enumeration
• Space is described as a regular array of cells (usually cubes). Each cell is called a Voxel.
• A 3D object is represented as filled voxels.
• An object = a list of filled voxels.
IDC-CG 36
• Pros: – Easy to verify if a point (a voxel)
is inside or outside an object.– Boolean operations are easy to
apply.• Cons:
– Memory costs are high.– Resolution is limited to size and
shape of voxel.
IDC-CG 37
Quadtrees
• A Quadtree is a data structure enabling efficient storage of coherent 2D data.
• The idea behind it is to represent large uniform (full or empty) regions by one cell, using a recursive subdivision method.
IDC-CG 38
Quad Tree representation
Image
1 2
3 4 1 2 3 4
1 23 4
IDC-CG 39
IDC-CG 40
Octrees
• An Octree is essentially the same idea as Quadtree, however, each node in an Octree has eight children rather than four.
• This makes Octrees good candidates for representing 3D objects.
1 23 4
6
7 8
1 2 3 4 5 6 7 8
IDC-CG 41
E
E
P
P
F
Binary Operations On Quad/Oct Trees
Notation: P FInternal Node(Partially full)
Full Leaf Node
Empty Leaf Node
E
Union: P P Recurse Union on descendentsÈ
P È = F
EP È =
F
Intersection: P P Recurse Intersect on descendentsÇ
P Ç =
EP Ç =
EF
Complement: P Recurse Complement on descendents
=
E =
C
C
CF
P
F
Difference: P P Recurse Difference on descendents-
P - =
EP - =
IDC-CG 42
F
P
EP P
FE E E F EE E
P
P
F E
F EE
P F E
FF
F
A B
A È B A Ç B
IDC-CG 43
An example where a quad-tree representation is not efficient.
IDC-CG 44
a j
b
f
cd
g
kh
ie g
j
k outoutin
h
iinoutin
out
f
in out
ec
d out
outin
b
a
BSP - Binary Space Partition Tree
• Each internal node represents a plane in 3D space.
• Each node has 2 children pointers one for each side of the plane.
• A leaf node represents a homogeneous portion of space - either “in” or “out”.
• Easy to determine if a point is inside or outside an object (recurse down the BSP tree).
• Questions: – How many parameters we have to store at each
node?– How can we determine whether a point (x,y) is
inside/outside an object?
IDC-CG 45
Constructive Solid Geometry
• Combine simple primitives using Boolean Operations and represent as a binary tree.
• To generate the object the tree is processed in a depth-first pass.
• Cons: many different CSG can represent an object (not unique).
A
B
A
B
A-B A ÈB
IDC-CG 46
- -
È
An object defined by a binary CSG tree
IDC-CG 47
World Coord.
Body Coord.
Cockpit Rear Wheels
Front Wheels
Left
Wheel
Right
Wheel
Left
Wheel
Right
Wheel
Trans(P0)Rot(q,n)
Trans(*)Rot(steer)
Trans(*)
Trans(*)
Trans(*)Trans(*)Trans(*)Trans(*)
Hierarchical Modeling Transformation
Representation in
World Coord.
yw
zw
xw
world
Front-Wheel System
x
y
z
p0
IDC-CG 48
push;Translate(p0);Rotate(q,n)DrawTractor(steer)pop;
DrawTractor(steer)DrawBody;
push;Translate(-1,0,0);DrawCockpit; pop;
push;Translate(-1.5,-1,0);DrawRearWheels; pop;
push;Translate(0,-1,0);Rotate(steer,0,1,0);DrawFrontWheels; pop;
DrawBodypush;scale(2,1,1);DrawCube; pop;
DrawFrontWheelspush;Translate(0,0,0.5);Scale(0.5,0.5,0.5);DrawWheel;pop; push;Translate(0,0,-0.5);Scale(0.5,0.5,0.5);DrawWheel; pop;
yw
zw
xw
world
Front-Wheel System
x
y
z
p0
IDC-CG 49
THE END
IDC-CG 50
• Given V1,V2,V3, the plane normal is: S=(V1-V2)x(V3-V2) and N=S/|S|.
• If P is any point on the plane and VT=(x,y,z), then V is in the plane if:
(V-P) • N=V•N-P•N=0
• If a polygon is defined with more than 3 vertices:– Plane approximation.– Triangular subdivision.
Finding the Normal Vectors
V1
V2
V3
N=[A,B,C]
D
IDC-CG 51
[ ] 0
1
0 =
úúúú
û
ù
êêêê
ë
é
=+++zyx
DCBAorDCzByAx
• N=[A,B,C] is the plane normal (|N|=1).• D= -P•N• |D| is the plane distance from the origin.• If N points "outside”:
» Ax+By+Cz+D<0 , the point (x,y,z) is in the inside part.
» Ax+By+Cz+D>0 , the point (x,y,z) is in the outside part.
V1
V2
V3
N=[A,B,C]
D
The Plane Equation