24
Solid Modeling; Constructive Solid geometry (CSG) Various methods: Regularized Boolean Set operations Sweep Representation Octrees CSG B-reps Primitive Instancing Fractal Dimension

Solid Modeling; Constructive Solid geometry (CSG) • Regularized

  • Upload
    others

  • View
    10

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Solid Modeling; Constructive Solid geometry (CSG) • Regularized

Solid Modeling; Constructive Solid geometry (CSG)

Various methods:

• Regularized Boolean Set operations

• Sweep Representation

• Octrees

• CSG

• B-reps

• Primitive Instancing

• Fractal Dimension

Page 2: Solid Modeling; Constructive Solid geometry (CSG) • Regularized

Solid Representation

A B

E F

CD

GH

B

C

F

G

A

D

E

H

I

J

Vertices:A (0, 0, 0)B (1, 0, 0)C (1, 1, 0)D (0, 1, 0)E (0, 0, 1)F (1, 0, 1)G (1, 1, 1)H (0, 1, 1)

Lines:ABBCCDDAEFFGGHHEAEBFCGDH

AdditionalVertices:I (1, 0, -1)J (1, 1, -1)

AdditionalLines:

BIIJJC

Page 3: Solid Modeling; Constructive Solid geometry (CSG) • Regularized

Solid is bound by surfaces. So need to also define the polygons of vertices, which form the solid. It must also be a valid representation.

Regularized Boolean Set Operations

Operators (op):Union:Intersection:Difference: -

I

UBoolean intersections of, say cubes, may produce solids, planes, lines, points and null object. Two examples:

BAIA

A - BB

Page 4: Solid Modeling; Constructive Solid geometry (CSG) • Regularized

Hanging points, lines are eliminated by regularizing:

A op* B = closure ( interior (A op B))

Interior ClosureObject

Page 5: Solid Modeling; Constructive Solid geometry (CSG) • Regularized

Sweep Representation

Page 6: Solid Modeling; Constructive Solid geometry (CSG) • Regularized

Some more examples of sweep representation.

An arbitrary pathfor the sweep

Page 7: Solid Modeling; Constructive Solid geometry (CSG) • Regularized

B-reps (Boundary Representations)

Object is defined in terms of its surface boundaries, vertices, edges and faces. Curved surfaces are always approximated with polygons – piecewise linear/planar.

Very commonly used, in practice.

Use planar, polygonal boundaries, but may also use convex polygons or triangles.

Polyhedron is a solid that is bounded by a set of polygons whose edges are each a member of an even number of polygons. Additional constraints will be discussed later on.

A simple polyhedron can always be deformed into a sphere. Polyhedron has no holes (not a torus).

Euler’s formula:Let V be the number of vertices, E the number of edges, and F the number

of faces of a simple polyhedron. Then

V – E + F = 2

Page 8: Solid Modeling; Constructive Solid geometry (CSG) • Regularized

Verify Euler’s formula with these examples:

V = 8

E =

F =

12

6

6129

5

8

56

128

Also applicable for curved edges and non-planar faces

Actual:

Page 9: Solid Modeling; Constructive Solid geometry (CSG) • Regularized

B

C

F

G

A

D

E

H

I

JWhat about this structure ?

Need additional constraints to guarantee a solid object:

V = 10;

E = 15;

F = 7.

Formula still holds good, but this is not a bound volume.

• Each edge must contain two vertices

• Must be shared exactly by two faces

• At least three edges must meet to form a vertex

• Faces must not interpenetrate

Page 10: Solid Modeling; Constructive Solid geometry (CSG) • Regularized

Solids with boundarieswith 2-manifolds

Solids with boundariesbut not 2-manifolds

Page 11: Solid Modeling; Constructive Solid geometry (CSG) • Regularized

Generalized Euler’s formula for objects with 2-manifolds, and faces which may have holes:

V – E + F – H = 2(C - G)

where, H - No. of HOLES in the face;

G - No. of holes that pass through the object;

C - No. of separate COMPONENTS (or parts) of the object.

If C = 1, G is called as GENUS. If C > 1, G is the sum of the GENERA of its components.

V = 24

E = 36

F = 15

H = 3

C = G = 1

Page 12: Solid Modeling; Constructive Solid geometry (CSG) • Regularized

V1

V3V2

V4

V5

E1

E2

E3

E4E5

E6

S1

S2

Vertex Table

V1: X1, Y1, Z1V2: X2, Y2, Z2V3: X3, Y3, Z3V4: X4, Y4, Z4V5: X5, Y5, Z5V6: X6, Y6, Z6

Edge Table

E1: V1, V2E2: V2, V3E3: V3, V1E4: V3, V4E5: V4, V5E6: V5, V1

Polygon Surface Table

S1: E1, E2, E3S2: E3, E4, E5, E6 Complete (expanded) Edge Table

E1: V1, V2, S1E2: V2, V3 , S1E3: V3, V1 , S1 , S2E4: V3, V4 , S2E5: V4, V5 , S2E6: V5, V1 , S2

Page 13: Solid Modeling; Constructive Solid geometry (CSG) • Regularized

1 ,

1

))((

))((

))((

1

1

1

==

+=

+−=

+−=

+−=

=

=

=

jniIf

ijwhere

YYXXc

XXZZb

ZZYYa

jij

n

ii

jij

n

ii

jij

n

ii

)()()())(())(())((

213132321

131332322121

YYXYYXYYXYYXXYYXXYYXXc

−+−+−=

Remember equations for plane normal, N ?

Assume a triangle (or takeany three vertices of a polygon):

+−++−++−=

Similarly:

)()()(

)()()(

213232321

213232321

XXZXXZXXZband

ZZYZZYZZYa

−+−+−=

−+−+−=

These expressions can bewritten in matrix form as:

33

22

11

111

ZYZYZY

a =

33

22

11

111

ZXZXZX

b =111

33

22

11

YXYXYX

a =

Page 14: Solid Modeling; Constructive Solid geometry (CSG) • Regularized

These are the solutions of the set of equations:

3,2,1 ;1)/()/()/( =−=++ kZDCYDBXDA kkk

where,

)()()( 122133113223321 ZYZYXZYZYXZYZYXD −−−−−−=

Significance of D ? D can also be obtained as, D = -N.P

Page 15: Solid Modeling; Constructive Solid geometry (CSG) • Regularized

Octrees

Let us visualize 2D Quadtree representation of an image or view.

0 1 2 3

0 1 2 3

0 1 2 3

0 1

23

0 1 2 3

For an image with n*n pixels, the maximum number of levels is log(n).

Page 16: Solid Modeling; Constructive Solid geometry (CSG) • Regularized

Octrees

0

1

2

3

4

5

7

6

0 1 2 3 4 5 6 7

Individual elements are calledVolume elements orVOXELS

Page 17: Solid Modeling; Constructive Solid geometry (CSG) • Regularized

0 1

2

3

4

5

7

6

1

2

3

154

4

7 3 30 0

0 1 2 3 4 5 6 7

0 1 2 3 4 5 6 7

Page 18: Solid Modeling; Constructive Solid geometry (CSG) • Regularized

CSG – Constructive Solid Geometry

Page 19: Solid Modeling; Constructive Solid geometry (CSG) • Regularized
Page 20: Solid Modeling; Constructive Solid geometry (CSG) • Regularized
Page 21: Solid Modeling; Constructive Solid geometry (CSG) • Regularized

CSGObject

OP1 OP2

OP3OBJ-1 OBJ-2 OBJ-3

OBJ-4 OBJ-5

Page 22: Solid Modeling; Constructive Solid geometry (CSG) • Regularized

Criteria for comparing different solid modeling techniques:

• Accuracy – Octrees and polygonal B-reps produce an approximation of objects. CSG with non-polyhedral primitives and B-reps that allow curved surfaces are good for high-quality graphics.

• Domain – Sweeps have limited domain. Octrees and B-reps provide a wide class of objects.

• Uniqueness – Octrees guarantee the uniqueness of a representation.

• Validity – B-reps are the most difficult to validate. One must find a way to ensure that vertex, edge and face data structures are valid (faces and edges may intersect). BSP trees and CSG are better.

• Closure (after Boolean operations) – Primitive instancing and sweeps are worse. B-reps can be used, but additional checking is necessary.

• Efficiency – Octress are better for hardware based solid modeling systems for a faster response with coarse pictures (results). Most algorithms are based on CSG and B-reps which are widely used for generating complex pictures.

Page 23: Solid Modeling; Constructive Solid geometry (CSG) • Regularized
Page 24: Solid Modeling; Constructive Solid geometry (CSG) • Regularized