Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 46

Three Dimensional Object

Representation
Modeling of object or picture means describing
them to the computer so as to produce visual
display that simulate the real thing

For describing we need a set of


primitives /geometric forms

Simple Complex
• Points • Curved Segment
• Lines • Curved Surface
• Poly lines • Quadratic Surface
• Polygon
• Polyhedron

Highly realistic representation use color, shading & texture


Point Pt p in 2D p(x,y) and in 3D p(x,y,z)
Line In 2D it specified by end pt (x1,y1) to (x2,y2)
In 3D it specified by end pt (x1,y1,z1) to (x2,y2,z2)
Poly Line Chain of connected line segments from pt p0 to pn
Polygons A closed poly lines where initial pt & final pt
coincide. It is specified by vertex & edge
information
Planner polygon – When all vertex lie on same
plane
Polyhedron A closed polygonal net in which each polygon
(face) is planner.
It is solid object
Wireframe Model
Representation of polygonal net/ polygonal mesh
Here representation of any 3D object can be done by
vertex, edge and polygon information

In 3 ways we can represent


 Explicit vertex list
 Polygon Listing
 Edge Listing
D C
Problem E H
Representation of this object A B
1. Explicit vertex list F G
Here the information of the object will be stored in
the order in which they will be encountered by
travelling around the complete model
Let the travelling sequence is ---
A -> B -> C -> D ->A -> F -> E -> D -> C
->H ->E -> F -> G -> H->G ->B
D C
H
E
A B
F G
Disadvantage
 Inefficient for a complete polygonal net where shared
vertices are repeated several time.
( More space complexity)
 For displaying the polygonal net from this type of
stored information shared edges are drawn several times
(More time complexity)

Advantage

 It is useful for single polygon.


1. Polygon listing
Here each vertex is stored exactly once in vertex list
V= (v0 ..vn)
Here each polygon is stored exactly once in polygon list
by pointing or indexing to the vertex list
The vertex list is --- V={A,B,C,D,E,F,G,H}
The polygon list is -- P= {p1,p2,p3,p4,p5,p6}
P1 ={A,B,C,D}  {V(0),V(1),V(2),V(4)}
P2 = {C,D,E,H} 
D C P3 = {A,B,E,F} 
H
E P4 = {A,B,G,F} 
A B P3 = {A,B,E,F} 
G
F P6 ={E,F,G,H}  {V(4),V(5),V(6),V(7)}
Disadvantage
 Shared edges are drawn several times in displaying
through this method
(time complexity)
Advantage
 More efficient than explicit vertex list
1. Edge listing
Here each vertex is stored exactly once in vertex list
V= (p0 ..pn)
Each edge is stored exactly once in edge list by pointing to
the 2 vertex of vertex list for defining every edge.
Each polygon is stored exactly once in polygon list
by pointing or indexing to the edge list
Drawing will be done by considering the edge list
D C
H
E
A B
G
F
Disadvantage
 none
Advantage
 used to represent more general wireframe model

Advantage (of wire frame model)


 Wire frame model are used in engineering application
 As they are composed of straight lines
 Easy to construct
 Easy to clip & manipulate

Disadvantage (of wire frame model)


 For achieving the realistic model which are highly
curved object , here huge no of polygons are needed
Plane Equation
To produce a display of 3 dimensional object, we need the
information of spatial orientation of the individual surface
components of the object.

This information is obtained from vertex coordinate value


and equation that describes the polygon plane.
The equation of plane surface:-
Ax + By + Cz + D =0
where (x, y, z) is any point on the plane.
and A,B,C,D describes spatial property of the plane,
(whose value can be obtained by solving a set of
3 plane equations using the coordinate values
for 3 nonlinear points in the plane).
• We need to distinguish the side of the polygon surfaces
which enclose the object interior
 Inside face:- The side of the plane that faces the object
interior.
Outside face :- The side of the plane that faces the object
exterior or visible.
• The position of a spatial point (x,y,z) relative to plane
surface of an object can be identified using plane
equation.
Ax + By + Cz + D <0 the point (x,y,z) is inside the surface

Ax + By + Cz + D >0 the point (x,y,z) is outside the surface


Classification of Curves
• Analytical Curves: This type of curve can be represented by
a simple mathematical equation, such as, a circle or an ellipse.
They have a fixed form and cannot be modified to achieve a
shape that violates the mathematical equations
• Interpolated curves: An interpolated curve is drawn by
interpolating the given data points and has a fixed form,
dictated by the given data points. These curves have some
limited flexibility in shape creation, dictated by the data points.
• Approximated Curves: These curves provide the most
flexibility in drawing curves of very complex shapes. The model
of a curved automobile fender (a plastic cylinder, tyre)can be
easily created with the help of approximated curves and
surfaces.
Parametric and Non-parametric Equations of a Curve
• The mathematical representation of a curve can be
classified as either parametric or nonparametric
1 Nonparametric: -
 Explicit non-parametric eqtation :
y = mx + c
y = c1 + c 2 x + c 3 x 2 + c4 x 3
There is a unique single value of the dependent variable
for each value of the independent variable.
 Implicit non-parametric equation :
Ax + By + C = 0
(x – xc)2 + (y – yc)2 = r2
No distinction is made between the dependent and the
independent variables
2. Parametric: Parametric equations describe the
dependent and independent variables in terms of a
parameter.
Parametric curves can be defined in a constrained
period (0 ≤ t ≤ 1); since curves are usually bounded
in computer graphics, this characteristic is of
considerable importance
Line :- x = x1 + (x2 - x1) t where, 0 ≤ t ≤ 1
y = y1 + (y2 - y1) t
circle :- x = r cosθ, y = r sinθ where 0 ≤ θ ≤ 2π
Ellipse:- x = rx cosθ, y = ry sinθ
“Computers can’t draw curves.”

The more points/line


segments that are
used, the smoother
the curve.
Curve representation
Requirements
• Complete curve consists of several pieces of segments of
lower order which should join smoothly or should have
mathematical smoothness
• Local control should decide the point of joint of smaller
segments
– Local data changes have local effect
• All pieces should of low order (Third order or cubic mostly)
• Low computational effort
General curve shape may be generated
using method of

– Interpolation (also known as curve fitting)


• Curve will pass through control points
– Approximation
• Curve will pass near control points may interpolate the
start and end points.
Curve algorithm

Interpolation Approximation
Interpolation vs approximation
f(x) f(x)

x x
curve most pass through control points curve is influenced by control points

f(x) f(x)

x x
Interpolation Curves
• Curve is constrained to pass through
all control points
• Given points P0, P1, ... Pn, find lowest degree
polynomial which passes through the points

x(t) = an-1tn-1 + .... + a2t2 + a1t + a0


y(t) = bn-1tn-1 + .... + b2t2 + b1t + b0
Interpolating curve : piecewise linear

Example: Hermite Curve

• Curve defined by multiple segments (linear) which are


defined by polynomial functions (cubic functions).

• Segments joints known as KNOTS

• Requires too many data points for most shape

• Representation not flexible enough to editing


Approximation techniques

• Developed to permit greater design flexibility


in the generation of free form curves
• Common methods in modern CAD systems,
bezier, b-spline, NtRBS
• Employ control points (set of vertices that
approximate the curve)
Approximation techniques
• Curves do not pass directly through points
(except start and end)
• Intermediate points affect shape as if exerting
a “pull” on the curve.
• Allow user to set shape by “pulling” out curve
using control point location.
Example – bezier curve
Interpolation vs. Approximation Curves
• Interpolation Curve – over constrained →
lots of (undesirable?) oscillations

• Approximation Curve – more reasonable?


When modelling a curve f(x) by using segments
we represent the curve as sum of smaller
segments Øi(x) called blending functions.

Blending Functions used to derive the points on


curve can be:-
 Lagrange Polynomial
 Hermite Polynomial
Bernstein Polynomial
Spline Representation
What is -- Spline
Spline Curve
Making Curves
Spline weights are used to make curve without computer
Natural Cubic Spline

• Spline 1 A long narrow and relatively thin piece or


strip of wood, metal, etc.
2 A flexible strip of wood or rubber used by
draftsmen in laying out broad sweeping curves, as in
railroad work.
• Spline Curve is a composite curve formed with
polynomial section satisfying specified continuity
(smoothness) condition at the boundary.
Bezier Curve
For n+1 control points pi (0 <= i <= n) the following is the
approximated position vector using Bezier polynomial
function

Where B(t)  position vector of curve


Pi  control points
bi,n(t) Bezier blending function
(Bernstein polynomial)
Linear Curve (2 control points)

P0 P1

1-t t

B(t) = (1-t) P0 + t P1

The parameter ‘t’ defines


the path of curve B(t) from P0 to P1
Quadratic Bezier Curve (3 control points)

For the Quadratic Bezier curve B(t) from Q0 to Q1 t varies from 0 to 1.


• Q0 varies from p0 to p1
describes a linear Bezier curve.
• Q1 varies from p1 to p2
describes a linear Bezier curve.
• B(t) varies from Q0 to Q1
describes a Quadratic Bezier curve.
Quadratic: Degree 2

B(0) = P0, B(1) = P2 B(t) = ?

P0 P1 P2
1-t t 1-t t

Q0(t) Q1(t)

1-t t
B(t)

B(t) = (1-t)2 P0 + 2t (1-t) P1 + t2 P2


Cubic Curve (4 control points)
For the Cubic Bezier curve B(t)
from R0 to R1 t varies from 0 to 1.
• Q0 varies from p0 to p1
describes a linear Bezier curve.
• Q1 varies from p1 to p2
describes a linear Bezier curve.
• Q2 varies from p2 to p3
describes a linear Bezier curve.
• R0 varies from Q0 to Q1
describes a Quadratic Bezier curve.
• R1 varies from Q1 to Q2
describes a Quadratic Bezier curve.
• B(t) varies from R0 to R1
describes a Cubic Bezier curve.
Cubic: Degree 3
B(0) = P0, B(1) = P2 B(t) = ?

P0 P1 P2 P3
t t t
1-t 1-t 1-t
Q0(t) Q1(t) Q2(t)
1-t t 1-t t

R0(t) R1(t)
1-t t

B(t)

B(t) = (1-t)3 P0 +3t(1-t)2 P1 +3t2(1-t) P2 + t3 P3


For higher order curve
Problem1: The coordinates of 4 control points relative to a curve
are given by P0(2, 2, 0), P1(2, 3, 0), P2(3, 3, 0) and P3(3, 2, 0). Write
the equation of Bezier curve. Find the coordinate pixels of the
1 1 3
curve for u=0, u= 4 , u = 2 , u= 4 , u=1 and plot the Bezier curve.

B(u) = (1-u)3 P0 +3u(1-u)2 P1 +3u2(1-u) P2 + u3 P3

X(u) = (1-u)3 X0 +3u(1-u)2 X1 +3u2(1-u) X2 + u3 X3


Y(u) = (1-u)3 Y0 +3u(1-u)2 Y1 +3u2(1-u) Y2 + u3 Y3
Z(u) = (1-u)3 Z0 +3u(1-u)2 Z1 +3u2(1-u) Z2 + u3 Z3
X(u) = (1-u)3 2 +3u(1-u)2 2 +3u2(1-u) 3 + u3 3
= 2(1-u)3 +6u(1-u)2 + 9u2(1-u) + 3u3
Y(u) = (1-u)3 2 +3u(1-u)2 3 +3u2(1-u) 3 + u3 2
= 2(1-u)3 + 9u(1-u)2 +9u2(1-u) + 2u3
Z(u) = (1-u)3 0+3u(1-u)2 0 +3u2(1-u) 0 + u3 0 = 0
1 1 3
U=0 U =4 U =2 U =4 U=1
X=2 X = 2.156 X = 2.5 X = 2.84 X=3
Y=2 Y = 2.56 Y = 2.75 Y = 2.56 Y=2
Z=0 Z=0 Z=0 Z=0 Z=0
Y
P0(2, 2, 0), P1(2, 3, 0), P2(3, 3, 0) and P3(3, 2, 0)
3 p1 p2

2 p0 p3

X
1 2 3 4

Problem2: The coordinates of 4 control points relative to a curve


are given by P0(1, 2, 0), P1(3, 4, 0), P2(6, -6, 0) and P3(10, 8, 0).
Write the equation of Bezier curve. Find the coordinate pixels of
the curve for stepping value 0.2 and plot the Bezier curve.
Summary: (deCasteljau) Algorithm

P1 P1 P1 P2

P0 P0 P2 P0 P3
Linear Quadratic Cubic
Degree 1, Order 2 Degree 2, Order 3 Degree 3, Order 4
F(0) = P0, F(1) = P1 F(0) = P0, F(1) = P2 F(0) = P0, F(1) = P3
P0 P1 P2 P0 P1 P2 P3
P0 P1
1-u u 1-u u 1-u u
1-u u 1-u u
1-u u
1-u u 1-u u
F(u) = (1-u) P0 + u P1 1-u u
F(u) = (1-u)2 P0 + 2u(1-u) P1 + u2 P2 1-u u

F(u) = (1-u)3 P0 +3u(1-u)2 P1


+3u2(1-u) P2 + u3 P3
Summary of Explicit Form
Linear: F (u )  P0 (1  u )  Pu
1

Quadratic: F (u )  P0 (1  u ) 2  P1[2u (1  u )]  P2u 2


Cubic: F (u )  P0 (1  u )3  P1[3u (1  u ) 2 ]  P2 [3u 2 (1  u )]  P3u 3

Degree n: F (u )   Pk Bkn (u ) Bkn (u ) are Bernstein-Bezier polynomials


k

Explicit form for basis functions

n! nk k
B (u ) 
n
(1  u ) u
k !(n  k )!
k
Properties of Bezier curve
1. The Bézier curve generally follows the shape
of the control polygon, which consists of the
segments joining the control points
2. Bézier curves exhibit global control: moving a
control point alters the shape of the whole curve.
3. Interpolation. A Bézier curve always interpolates
the end control points.s
4. Tangency. The endpoint tangent vectors are
parallel to P1- P0 and Pn- Pn-1.
5. Convex hull property. The curve is contained in
the convex hull of its defining control points.

Use:- (Due to it’s property & easy implementation)

1. Available in CAD system


2. In general graphics package
3. In drawing & painting package

You might also like