New Graphical Modelskucg.korea.ac.kr/.../CNCE340/tutor/02GraphicalModels.pdf · 2002. 1. 16. ·...

Preview:

Citation preview

Graphics

Graphics Lab @ Korea Universitykucg.korea.ac.kr

Graphical Models

고려대학교 컴퓨터 그래픽스 연구실

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

Overview

3D Geometric PrimitivesPointLinePlanePolygonSphere

3D Object RepresentationsRaw DataSurfacesSolidsOpenGL Primitives

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

3D Geometric Primitives

PointLinePlanePolygonSphereEtc.

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

3D Point

Specifies a LocationRepresented by three coordinatesInfinitely small

typedef struct{

Coordinate x;

Coordinate y;

Coordinate z;

} Point;

(x, y, z)

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

3D Vector

Specifies a Direction and a MagnitudeRepresented by three coordinatesMagnitude ||v||=sqrt(dxdx + dydy +dzdz)Has no location

Dot product of two 3D vectorV1 V2 = dx1dx2 + dy1dy2 + dz1dz2V1 V2 = ||V1||||V2|| cos( )

typedef struct{Coordinate x;Coordinate y;Coordinate z;

} Vector;

⋅⋅ θ

(dx1, dy1, dz1)

(dx2, dy2, dz2)

θ

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

3D Line

Line segment with both endpoints at infinityParametric Representation

P=P1+tV, ( )∞<<∞− ttypedef struct{

Point P1;Vector V;

} Line;P1

V

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

3D Ray

Line segment with one endpoint at infinityParametric Representation

P=P1+tV, ( )∞<<= t0typedef struct{

Point P1;Vector V;

} Ray;P1

V

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

3D Line Segment

Specifies a linear combination of two pointsParametric Representation

P=P1 + t(P2 - P1), ( )10 ≤≤ t

typedef struct{Point P1;Point P2;

} Segment;

P1

P2

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

3D Plane

Specifies a linear combination of three pointsImplicit Representation

P N + d = 0, orax + by + cz + d = 0

typedef struct{Vector N;Distance d;

} Plane;

⋅N=(a, b, c)

P3

P2

P1

Origin

d

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

3D Polygon

Area “inside” a sequence of coplanar pointsTriangleQuadrilateralConvexStar-shapedConcaveSelf-Intersecting Hole

typedef struct{Point *Points;int npoints;

} Polygon; Points are in counter-clockwise order

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

3D Sphere

All points at distance “r” from a center (cx, cy, cz) Implicit Representation

(x-cx)2 + (y-cy)2 + (z-cz) 2 = r 2

Parametric Representationx= r sin( ) cos( )y= r sin( ) sin( )z= r cos( )

φ θφ

φθ

r(cx, cy, cz)

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

3D Object Representations

Raw DataPoint CloudRange ImagePolygon Soup

SurfacesMesh, Subdivision, Parametric, Implicit

SolidsVoxel, BSP tree, CSG, Sweep

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

Point Cloud

Unstructured Set of 3D Point SamplesAcquired from 3D scanners, computer vision, etc

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

Range Image

Set of 3D Points Mapping to Pixels of Depth Image

Acquired from range scanner

Range Image Tessellation Range Surface

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

Polygon Soup

Unstructured Set of PolygonsCreated with interactive modeling systems

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

3D Object Representations

Raw DataPoint cloud, Range image, Polygon soup

SurfacesMeshSubdivisionParametricImplicit

SolidsVoxel, BSP tree, CSG, Sweep

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

Mesh

Connected Set of Polygons (Usually Triangles)May not be closed

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

Subdivision Surfaces

Coarse Mesh & Subdivision RuleDefine smooth surface as limit of sequence of refinements

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

Parametric Surfaces

Tensor Product Spline PatchesCareful constraints to maintain continuity

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

Implicit Surface

Points satisfying: F(x,y,z) = 0

Polygonal Model Implicit Model

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

3D Object Representations

Raw DataPoint cloud, Range image, Polygon soup

SurfacesMesh, Subdivision, Parametric, Implicit

SolidsVoxelBSP treeCSGSweep

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

Voxels

Uniform Grid of Volumetric SamplesAcquired from CAT, MRI, etc.

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

BSP Tree

Binary Space Partition with Solid Cells LabeledConstructed from polygonal representations

a

bcd

ef

g

Object

a

bcd

ef

g

Binary Spatial Partition

1

2

3

45

6

7

12

a

3

bc

4

d

56

e

7

f

BSP Tree

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

CSG

Hierarchy of Boolean Set Operations (Union, Difference, Intersect) Applied to Simple Shapes

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

Sweep

Solid Swept by Curve Along Trajectory

Constructing a Torus Using Rotational Sweep

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

OpenGL Primitives

Taxonomy of 2D Object RepresentationsGL_POINTS

glBegin(GL_POINTS);glVertex3f(v1x, v1y, v1z);glVertex3f(v2x, v2y, v2z); glVertex3f(v3x, v3y, v3z);glVertex3f(v4x, v4y, v4z);

glEnd();

v1 v2

v3v4

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

OpenGL Primitives

Taxonomy of 2D Object RepresentationsGL_LINES

glBegin(GL_LINES);glVertex3f(v1x, v1y, v1z);glVertex3f(v2x, v2y, v2z); glVertex3f(v3x, v3y, v3z);glVertex3f(v4x, v4y, v4z);

glEnd();

v1 v2

v3v4

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

OpenGL Primitives

Taxonomy of 2D Object RepresentationsGL_LINE_STRIP

glBegin(GL_LINE_STRIP);glVertex3f(v1x, v1y, v1z);glVertex3f(v2x, v2y, v2z); glVertex3f(v3x, v3y, v3z);glVertex3f(v4x, v4y, v4z);

glEnd();

v1 v2

v3v4

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

OpenGL Primitives

Taxonomy of 2D Object RepresentationsGL_LINE_LOOP

glBegin(GL_LINE_LOOP);glVertex3f(v1x, v1y, v1z);glVertex3f(v2x, v2y, v2z); glVertex3f(v3x, v3y, v3z);glVertex3f(v4x, v4y, v4z);

glEnd();

v1 v2

v3v4

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

OpenGL Primitives

Taxonomy of 2D Object RepresentationsGL_TRIANGLES

glBegin(GL_TRIANGLES);glVertex3f(v1x, v1y, v1z);glVertex3f(v2x, v2y, v2z); glVertex3f(v3x, v3y, v3z);glVertex3f(v4x, v4y, v4z);

glEnd();

v1 v2

v3v4

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

OpenGL Primitives

Taxonomy of 2D Object RepresentationsGL_QUADS

glBegin(GL_QUADS);glVertex3f(v1x, v1y, v1z);glVertex3f(v2x, v2y, v2z); glVertex3f(v3x, v3y, v3z);glVertex3f(v4x, v4y, v4z);

glEnd();

v1 v2

v3v4

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

OpenGL Primitives

Taxonomy of 2D Object RepresentationsGL_POLYGON

glBegin(GL_POLYGON);glVertex3f(v1x, v1y, v1z);glVertex3f(v2x, v2y, v2z); glVertex3f(v3x, v3y, v3z);glVertex3f(v4x, v4y, v4z);glVertex3f(v5x, v5y, v5z);

glEnd();

v1

v2

v3 v4

v6

v5

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

OpenGL Primitives

Taxonomy of 2D Object RepresentationsGL_TRIANGLE_STRIP

glBegin(GL_TRIANGLE_STRIP);glVertex3f(v1x, v1y, v1z);glVertex3f(v2x, v2y, v2z); glVertex3f(v3x, v3y, v3z);glVertex3f(v4x, v4y, v4z);glVertex3f(v5x, v5y, v5z);

glEnd();

v1

v2

v3

v4

v5

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

OpenGL Primitives

Taxonomy of 2D Object RepresentationsGL_TRIANGLE_FAN

glBegin(GL_TRIANGLE_FAN);glVertex3f(v1x, v1y, v1z);glVertex3f(v2x, v2y, v2z); glVertex3f(v3x, v3y, v3z);glVertex3f(v4x, v4y, v4z);glVertex3f(v5x, v5y, v5z);

glEnd();v1

v2

v3

v4v5

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

OpenGL Primitives

Taxonomy of 2D Object RepresentationsGL_QUAD_STRIP

glBegin(GL_QUAD_STRIP);glVertex3f(v1x, v1y, v1z);glVertex3f(v2x, v2y, v2z); glVertex3f(v3x, v3y, v3z);glVertex3f(v4x, v4y, v4z);glVertex3f(v5x, v5y, v5z);glVertex3f(v6x, v6y, v6z);

glEnd();

v1

v2

v3

v4

v5

v6

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

OpenGL Primitives

Taxonomy of 2D Object Representations2D Example

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

OpenGL Primitives

Taxonomy of 3D Object Representationsvoid glutSolidCube(GLdouble size)

void glutWireCube(GLdouble size)

void glutSolidTetrahedron()

void glutWireTetrahedron()

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

OpenGL Primitives

Taxonomy of 3D Object Representationsvoid glutSolidSphere(GLdouble radius, GLint slices, GLint stacks)

void glutWireSphere (GLdouble radius, GLint slices, GLint stacks)

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

OpenGL Primitives

Taxonomy of 3D Object Representationsvoid glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius,GLint nsides, GLint rings)

void glutWireTorus(GLdouble innerRadius, GLdouble outerRadius,GLint nsides, GLint rings)

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

OpenGL Primitives

Taxonomy of 3D Object Representationsvoid glutSolidCone(GLdouble base, GLdouble height,GLint slices, GLint stacks)

void glutWireCone(GLdouble base, GLdouble height,GLint slices, GLint stacks)

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

OpenGL Primitives

Taxonomy of 3D Object Representationsvoid glutSolidcosahedron()

void glutWirecosahedron()

void glutSolidTeapot(GLdouble size)

void glutWireTeapot(GLdouble size)

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

OpenGL Primitives

Taxonomy of 3D Object Representations3D Example

KUCG

Graphics Lab @ Korea Universitykucg.korea.ac.kr

Summary

Taxonomy of 3D Object Representations

Voxel

Discrete Continuous

Combinational Functional

MeshSubdivision

BSP Tree BezierB-Spline

Algebraic

Topological Set Membership Parametric Implicit

Recommended