CG 1 - Merged
CG 1 - Merged
CG 1 - Merged
2-4
(a, ) ( Y)
-6)
(2) 2-8)
b Y-'m
An=
LILIILlLLLLLLLLLLL
Nej
CAAt kumay W1mod
fm)
>4 Ay=-)
(-)
Nepativeclbpe
An=-+
torisut
Left mi>
utt
toright
þositive
sloþe(+)
Left
tovi
aht
Ay=|
Yk+=Y+n
Neics CAC kumaY Vimod
Repeat
M+increont n=
Colr); (n,y, xel piPut
met incre
ay) a(bs steh
else
CalAycalot
(M,)(,ts) þoir)s end too Read
ritbm Algo
84. Cale ls te, the biel þositions albng, a
between AI )om &(20 26) Diny strogat ime
H10, l) (n, 12:9) (2,136) (13 4y) y19
19:2)
(2, 2t)
Midpoint
Current Pixel
( k: Vik)
(X7+1, yk)
Fa,y) 0 Fx,y) = 0
(for any poimt above line)
F(x,y) >0
(for any point below line)
Midpoint Algorithm
Decision Criteria
O F(MP) >0
then Yi =
23
o
T
n2b-) Ay+ (=& bhere
b-24k+2
| 2n+)- oa-g
aioms
ic tlo these between oiHerm the
2
+bYk m(a+1) =
t m\)+b
md()MH,
ye) yonp
posit(M biatyels, the are ces choi CuY
mlAyonthm'
St M
LiAonha»
ne
But
PiNel
seleBe
Piel
(2, Ye) solhetey
, qt
qt
q=o
+Qy+ An b
SOAN- (ONVERTING A CIACLE
Acivde ih a symmetvical figuxe
my Cick-qenevo ting algorithm Can take advantage t
the civcle's Symmetryto blot eight þoints for ea Ch
Valu that the atgorithn calealtes
tigkt-ay Symmetvy iAvsed by redcing each Calcala tec)
þoint arou each4 s a
the þoimt (X,) on the circle, them we cam
Comm put seven other þbimtsmthe eicle: as' triviay
Eight ay Symmety a
Circle
- Therefore 9e meed
mee to Compute
Compyte omly 4s° oegree arc
to oe termjme the cì vcle Com þletely.
Simu Xi
Mit M;+! We hawe
1
2
di+2{x+ 44*i+4) +Yi +(-24;-().
-Y-(+1-2%)
2
-;-t
2:
A
Nueicalemblel
O calcula te the boind s to draw acirele hviy
Sol
3- 5
set þikel4,5)
d= -) 4+6 = 9
d= 944 I-s)+lo
..
get biqell2, 4)
d=34{2-4)
3H-8+0
+10
Y= 3 1
Sot pìxel(3)
s
o s 2,4 3,3
2- 3 -3
D,S l s ,4-3 3
50S S, 2 3.3
Y-xS, 0 s, |4 -z]3 ->
-3
-4-2 3-3
at t o)
Vsg miol pojt algorltrm
(2,8)
-6
(4)
2 (S6)
taid þeint circle
Drasing Algori thm
the mìa poimt circe
eight -ay symmet} o olraing
the cmclealgoritb also
to genevate itVes th*
Jt plots Ys
TO
fart
naw hs part a circle e take unit stebs in
he þoitive x aiyt etion md
to datermìme atch mate
mgke uesy dacisibn pranet
I close he tus þosc) ble 4 þo
tthe circle at ot eqth ste sitions
Pling þositon 41
hove to
-Theretore, ^atermìne whethe the pìxel at
þosition(+) a at positon+,
eloser 4o the crcde fa tis þurrpase
þarameter i ec:
)
ociaron
1
nid þeint circle
asing Algo7i thm
the mid point cicle
eght
-aSymmet} olroig
the ciTclealgoritm
Jt plota a to genevate it
fart sj the cicle e. from ó
To daw a be þart o t us':
A ircle be take Unit stebs in
he þosiive
olireetion cnd make Uue acis bn Pnramat
to determi ne atich
4he tuo ossi ble po
+o the circle bat ot eath she: sit0ns
-The tu presi ble þositsae
Sam plimN þsiion i . t;md)at
have to
-Theetore, e^atermine uhethe the pìxel at
þoeiton (M;+ 4) a at positonM;+, ) iA
closer to the chrcle- fa tùs þursase
þarameter iA we: oucison
()
+|
ee the tocast boundy,
chd erde
oothe outolea sifon
A þomld the dio,
Cirele totho ser clo iA 4;ine scom the Phael
on
((-)-y
-4tcivele(t
) , di
olapemolit
ioi+
di a(ni)+I-2
·in f(9 Cenbe
b sng h minor aA
th.k) Cyrnt angle
= eibse
Center
Trigonometrie
tton tt
odasci)
an ellibse
vaied from o to rf
T¦s a tbtd is aso imeieat
b
-atb=o
Pant
Pant
ast
iast Scan-Conve
bbose 4hect
SuÞbose tka
thattha We a to
Poii o,b), sa
stantm enteyif stebi On(Mi, i) be thu next
yteol ìxel bun S(j + -9 to
) w ctf Tonc S
Seuct e her T(+, Conme
Pixel thi verical i e barametey
mi bont o cacisiby
The the tolioLoj
"ALsee) to cutine blj)&)_tt
y;-) =
Pi= flM; +4, isinsioa 4he cuY ve mc! we chase
4k mìc) þermt
CuYve amd we chese
n the
Ast sice oY
ho mid pint
foy th mext steb.
fixei s . DecIsiDn Þgyamete
wtE the
Nti e Can
X; + we hane
Simu MiPia-fi= Bl(Mi))+l(i))
hane ti.,=
NoL we due u simi lay fomula t r part 2 tt tte c
SOPÞOk Pixel 4; 9) u ust been scom - Chw vev teol u pon entern
The mìd bot tu hori2on tal jme conn eei UOmd v io Ujed
Lo odee He oucision payametey
(j+*,Y:) =b(j+):-¢8
<o thi m bdint insida the cuYve onc vig chosen.
Sinu We hant
(39
)
th inital valy is cembuteal Usim tu originef elafimi t ai
mt Snt6
UNIT- |V
YSIm (+9)
RiYsima,
Y COA Ca+0)
SImu YL=
h
3I
Re - SinO
to0Ydinat
The
Scaling trans fermatiom SSx, Sy
SSa,s,(P)
where = S nl
Sy't
Ssa, sy
n the hemegenecus Co-oy di natus
Ss,st Sy
t.
Scali ngy Trama for mation
MiYoY Retleci0m about qn Axis
YL.oY
tyeated asamiYYOY, +h obiet has a mirrYimae
CY Yetlec tim:
’The reflectin p'cj an object Poimt Pis located 4he
\ame distam fyem h mirYDY aA p The m1YYoY
yeflecion tramsfeymativn Ma asout t h Lazis is give
where x= n md g'=-t
6Y
p!
Tyanslationy T = Ty.
T, oY trans la tioninti opbosite
oi recjon
Rotati om, =R oYrotatiom /n he opposite
ciyecibn
Scalin Ssy= SVssy
Miroy vetlecion,
CO-CYmate TYqms fcy mation We kytli tat
o'
Ro
Pveof: Px)
(d-9)
tsino
7- Ysim (a-0)
ycoAo - nsin
Ro
-sim
)
w
S and y
(2,1)
2 2
(U,-) (-,)
(a)
9
Jmvexse Co-ordi mate Trams formations!
translaticnim 1h obbos1Be
() TyanslatHon: = Ty OIYe cHen:
oþþosite Diyeeion
(H» Rota+iom; XA = R_Rotationim1ke
SoMe &%0mple:.
(ay inc the matrix that yebyesents yotate
an pbject by 30 about the origim
poimt P2-4)
CCS 30
(a)
- (b)
Com be focmel b'}
p'= Ro(P)
()= k() 2
im revexse- ovcley'
wite +te general form the matrì toY Yotaon
about a Point p(hi k)
Ro.p = COAO
(Q The matrì
trotat4om 6
Keys,p. = Rus Ty
nl2 -h/2 0
o
[a'o'e'= Rui[na) =
(7-) (25-)(-)
(G0() =()
(b) SLhP HeNU
PrP
(3)()=)
Sa,h P
(: B))=()
13
wite thu gemeyl form t ascaling matrid wit,
0ie
vespeet toa i edl Poimt P(hJ
b
'-bk t k
(
20-5
0 2-2
S2,2c o 22-2
2
S2,2 'C.= -2
Dd metho
2 0-S
0| 2
--3
2
C
Sjm
C C
m m4
/Jm+1
- bm
m+
b
ar
Retect. the diamomcl-sh el þoly gon ihose verieej
A ) B(0,), c( L,o) omd DCo,2.j about
(a The hori zenta ime y=l.
(b) the vey i cal ine =2 mal
wereprejent
mahi
homogne ous co- ormate
-2
-|
inet =L has t im ter cebt (o, 2) omol angle t
0
ML
methoc
- bn
m41.
m "yi+1
-|
MLV 0 10
0 -202 6 4 2
V=2.
Soltiby Htrs
0
- ho
.
iogle
abot ogin in ontielock oie ditchlo
Singo
Ro
singo
4ls o
J{ 4e Obyect move
Plx.)}
to a mew
Pos1tiom tten ne
tbjet obj' al ö uhose co -ovdinat Pointe p'( y J
Cam be obtaim el fyam e originl Points Pr.g.2) cb
thYough 1u abbieation at a qeom etric trmsfor mation
O Tyamslatiom
An objet iA cirbla cecl a givem
Distame cm Dixecio fxo YmitA
Disblacemet o tu Ggiml Positi o): The iYec i on cmc
tramslation iA given by avectoy
..
V.=.QI + bT+ Ck-..
Ne' c0-0ydimat s o tramslatec Pojt Cam be obtaine byt
equatiom
p'y2') = T[CX .2))
t b
Ty = 1
C b
Hemte from euntion )
hagmificahin
scale facterA S= Sy
=S)s<).1henscing ia
The þoi ntA after
Scaing L01th res
calculated by 4ta followi ng relatio1
þe ct to oYigin canbe
P ' } : SP9.2)
tatri fom i
2.
where S=
S
Rotatiom about the oigin;
Rota Hoy about origim in turo
have comsideyeal
To tati om. Qut in Qm ang le st
dimensioal geom etry e
4hree rotatio om ol a centre
the angle o Aimemsional we hote Comsidr
Yotaton om ol an
theve may be three aXA ot Yotatio theretore
1
Cases -
Rotation about
2. Rotai om
- axis
abot
3: Rota i om about
-aais.
Rotati y abowt -axiB
-
z'=[simlt)
Re.j =
= [sim (a+8))
coA-YSjma. sim9
2l Y oA
the tans tormation matrìa i
Sim o
Ro,j =
eta,b,)
V= Qi+bj+ck
Ca)
*o imblementing steb a
fron triangle opB
Sim9= b
+he vequveol rotationiA
Ro,i b
abt x -ais
b
No
imble menting stet b trom fig ) We see that arotatin
ougrees iA Yequired omod so from triangle 099
Sim (-&a)= - Sim Q2 Om o
Cos(-Q) CoA8B+
them
abot
y-ayis
Iv|
we caleulat the in vexse trams
vectoy k witb the vetoy V tomati on tnot gms
Ay
a
A = ~ab
-b'
2lv
ia
Patting togeth er all these stebs the Complet tramsformation
Re,L = Tp AyRekAyTP
Ro,t = A RoAv
J
AY
3 3
3
1 Shear'-At -H tranu frmition hat s lants the shabp 7 qn 0 bject
I Calbo! the sheav trans fov mgtion:
Ttso Cmmon Shearing trans foy na Hons aYe Useol 0ne shifts
Ce eymate v alw nnd hev sitt y. coo oli nste vauy Howele
|1 both the Cases
C0
omy one
notes amd they bre seY ves it valu
oYiginal object
Yiginal objeet
=x Omd '=+shy
shearing Relstive to bther Rateyenca Aime
-
e Cam ap Ksheara-sheY tramtor ma tions
to otheY etevea imes vels ive
Jn shear t rnsfor mtibn
Onch n 4-sheaY e can v.se
trouforme 4iby
tion msties refeventa lime he
fafe both Cu
Qu ai ven belas
(u)
shea with y yete vent sh, -shint
ine
A
PP he
Shearing tromtor mgion to Sjuare sith Alo o)
3(40) c{)l D(o) as
) given bela
shear þ07 meter vauu
valu o 0-s relstive tothe ine tr#
b)) sheaY Þarameter male or -l
relstive tathe kine Xnt =-)
)
þihelin
inde syslem( wcs) wcs is th rignt
Hamch artesian CobYdimat 8yslem ateh Coordi nas
drscri be 4h Picture 4hatIa to be dis blaye:
The bhysi cal Devico CooYolinati system:(PDG)!- pocsith
}- cooy
Co di nati
yemthat cevresbomds to tha cdeie or korkstation where
V- ins joy
Sare Swre
ngthing
On ce al erces qre broceeafe One c b oinelb
boumdar,
+he negt
+he outat tist ot rertites is c Ppel aganst
windL bom dart
Going thnagh absve tor Cases we can
thot there are tso Jeey eatjze
þroceses in his agoritbm
vertRa (in siou- Dtslole test anol
2 Qeter mì nìng the inteYLece n the Þolygon
ecge Oml he ci in plame
ciþin: þolyaom Atheton -omd heiler
aty separ bol.gon conved eaphproeessin Omd
caVe Con
seþara b} slve tuo
algoithm nt 90rn boly
PPry beCam
gcon boly ran geocl qmd- sother1 bulinygons
onCave Cfe ime extame
ow ble5m fro the -
ti shon
in dsextmeoy
ines ith
layel bemay balygo cibbed gons boly Cave COn
0case in bt
ectly, coTY 30ns buly covea cps
thm agori pbig olciygon odgeman sutheland
-H the -
Algoritln ppinA gon þoly adgemam lano- thtr Su
<ss)
1nt cipPolva on (dcpt wNin. dcPt wax, int n wr2 pIn. et2 pOut!
hrst ' holds pointer Lo first point prores ted against a clip
edge s holds most recent coint procesed against an edge
wePt2 hrstL||N EDGEJ : ( ). 0, 0, 0 )
s(N_FDGE:
Cn 0
Weiler-Atherton Polyg:nClipping
Here, the verlex-prucess1ng procedures for window boundaries are modihed su
that concave polygons, are displayed correctty. Ttis clipping proced ure 'was de
veloped as a method for identifying visible Surfaces. and so it can be applied
with arbitrary polygon-clipping regions.
The basic idea in this algorithm is that instead of always proceeding around
the polygon edges as vertices are processed, we sometimes want to follow the
WIndow boundaries. Which path we follow depends on the polygon-processing
direction (clockwise or counterclockwise) and whether the pair of polygen ver
tices currently being, processed represents an outs1de-to-inside pair or an inside
Window
Figure 6-24
Clipping the concave polygoa m(a)
with the Sutherland- Hodgernar
a)
elipper produces the twu cunneted
areas in (tb).
242
Sertion 6-8
Polvgon Clipping
umel,l,
resu
(stop)
(resume
(b)
Iiqurr 6-25
Chp
Clipping a concave polygon (a) with the
Weiler -Atherton
algorith generates the two separate polygon areas
in (6).
Figure 6-26
Clipping apolygon by determining
the intersection of two polygon
areas.
243
Poly gen nd cbping kinded shblo n in fia
"betew give ht it y vefices a t earh
cliki brunclhy
Vy
cipbif oindlo)
V
Ovgimed polygon verticer ae
t ter ciPig each boudgthe mes veri(es
are en ay
* A Suface
balygon
otchiq closed one amd boum b a
StYaght
TAe lime
ine segme nta i kmown aA
Þoly gom
liay that ensegment
in a ployg01 aa þ\ace
in Such a
co-ovoi natea o ome Segment iAis the
Stayti ng Co-oYoi nate o the
At least three ine segment mext segme nt
shoulol not be inegr
+ the Doly gon cam be
olivi ded i nto regulaY Þoly e
md ire gular poly gonA:
Regualar polygona au those Þolya0nA Whtie lergtb of all
efual no inter nallexternal angte betleen
Any turo Comneec edg an
came.
IrregualaY ÞolygoA a those Þoly gory otich have length
edge oli tterent omo the amgles bet ween my to
Conmected edei aru Bame
AmotheY classiHcaton t þol &0opne Covex on
Con cave bolj gona
() Con vex
Þol0mH the line CommecHng t
/mtevioY Þojnta 6, the Þlen
lie Com bleteljmsi oe the polt0n iA saio t be
Conveg
A
A toB
Concave þoly 0n
AN IN S) DE AND OUT SI DE TEST
n4 mer Metho
4. Eve - odd Method- * Jn
Jm tis vule we take qny
yetere
out sioe the þoly 90n by Com si oaYi ng A(M,) i
Rulu
odd count
Even Count
Y
belo i t , Jn ti et we aire the a're ct0n
imolirg
boj nt is imi evìor otheroise
egiol
1
helse in
exterior yglon
rqlon:
edgea"haing
mborg ,
oyrecom
veabety
Line
oi recliin mbe , .-) yes
beeivaytha
bjimling
S Aicat the Jnteio
even- d methoe yegiora Pl}o)
Basically lbe have t un ty e of res o
mork the
Boumoay- oletimed yegibn piycls that
otline +h* Yegion hav e. a unige.
heum
beym olary a
(oloY thal iA ot same aA the Coloy the
JnterioY PIgel Alg0th ns that as yse
2 3 y S6 705
2
JmteoRuqbn
cormplaed
Rely an 4 Conne ded o 8connted method o
oots bouror!loor
4- Corneted
hlow, abuk
pel n
pireli
betb.
*these cgorthma t also callcd Seed-4ll g n
4-Conme teo
piel þixel
the abþroach to fillirg a bound-ineo re9 13
to stat at a aint ixel) callaol a seed /nsrolo h
ns cnd þaunt th Qzta þrog ve ssively tojay)
boudar tli methol ia caltuot Bovindary-fill algar
Stork-Bosed -AbÞroaoh
bouaoy setedy rola bou
qory nd
fillmcl shecited
by Color fil poarh
a)t qp
bayedstacke- aoti the ConmeeBeo
fill
me
BaseArh' stack- (2)
preteyre
nolar) boumdlar-Hll(,
-, bey
bsu il, +
nolrg) bourdarg-I1(,
beymdar
1) f (, pixel get
boundary)
then
el( bìz Get GlOm ol .)< kel 14Get
bi
boumoart boumoarg-fill
0, , recuve! Pro
bsunda (,9),
1), Seorbixel :Put J
Agrihm'
boundng speified
by celorboundaryY
mol H, byciied Sþe oY
col 4)Precedure
with
RecUYEVe. metbo:
i dt fi0 N-Canne
cte
Algoitkm
Jmput seed Pixel (ny), il, bou ndary
PUsH Þiel (, )
tile (stack not emb
Set pìxel( M, 4 f)
bounclon) then
omd
(x-1,y)-ol Get bixel(M4}<> bovndor
i4(Qet þiaet
then
PucH Pijelt a-)
then
pusH PidelC, +)' bounda
i4 GetPjked (u.y-) illnd Get Plael(,-)
hen PuCH Pixel (n, -)
CUe Bo
through dny o the control Þoinb,
necessayit þassing contat Þtl gan, the resalin
the
it abþroximas the shabeabbyoximatol the set o control
to have
cUYve iB saidl
þeints
2
13
Sx
inter bolats
CuYve Will þass mear control þoimt na
the start om emd þoita
contoi pojmt
CUYve is influence by shabeis usually
CONTINUITYI Ang combleg
mot moolblel bya sing le CUrve.
but a Seveval pjeceA U CUYVe But these
shayþ Corm eYA that Can redt
Joimts Creates
representing t
tu fine Curves
oifitulty im
in
there aNe tuo tybes Contimuty
bd een' to adyacemt CUYve - pece
4-me ia the paYa metric Contmutt olenotey
2er0- 0Yoler
Cirst- ovoley
8, Onol
nt)
Lae c ContimuDUA becau theiy tan genta
ToinÞoit
Comtinuty eshectivey
CUBIC 3EZIERCUR E
my mbe)
Sblie cuYye cam be fitted tC qmy
H 3ezieY the tamg
ContYol þeint , koi th o ut meces sitati m
54
Shecifiction at qny ot the centrol boints'
Vector
charactevistic bolynomil abbroAImati
-A set 9 tunetionb) biemol
tuneHond,Callad ezier blemeing
to bioclucu a 3ez1eY curve
The Ctntol þ0it
Segmemt:
cuY ve Segmemt is obteymine
the cleree Ta Bezier
þoint· to be tittel wjth
Contro)
the unbey o
thut UT Ve Sgment
þot Po, Pi, P Pn
Cyven set I m+ e0ntre) that infit
a þqrametrie sezjeY CUYve Segme»t
P(t) = P; Bilt)
blemount tunction
Rhere Binlt) Cva the 3e2jer
funcn oefined
also Kneon as Bermstein Basis
Bimlt)
c(n,i) =
Henca trom
Plt)= Po Bu,n (t) +Bynt)4 . + Pa- B,(t) + By,|t)
4 Picn, 4) +*(1-t)+..
-he lagree the e
et d ezier cuYVe
CUTVe Sey mert '
Me fess 4ham the munbex Contro) Þoints Useo
-The Bezier cUYVe im 9emeral þasses through on
the firt Control poimt Po, Om he Last Comtro
L3'
L3:
Plty ()(M(B)
Here the bosis tunctibn mutr tej- Best), B,t),
the Be2ier Geonm etry maha (B) = Po
ualue 1.
Continuiy
&1= 2P- Pe
264)- lr)
Contimut t 3= Qo
p"(t=) = 8"(t=)
{a, b] l9°, S)
a 9, b=sO
As the Curve Segments Join Smootbly oe assome c'
Contimuty at the join point &y =Py
3( Py-P)= 3( G2- 91)
Bi,- t) +f
+5 ti- t
tid-ti
ohere titol- ti
oth eraie
- Pov a Cobic- B-slime the odagree ol-l =3 &e o=y
ber comt rol points(m+) vegtw'reo
atleast 4.
So þpose be hare to ur control Þointo Pe, P, P
Ke can obtam ftuy CobËc B;Sbli me blemol
FuncHbn By), B,4(), Ba4lt) mo B:,tt) He
btt) Po, B4 lt) +h B4t) + Pa Bay(t)+ P? Ba u(t
Umi ke the Be zie) basìs tunetio a the 3-shine
fumcton u mot ceimed ov ey the emtie
total pavameter vange tmin" tma
-it tht rangt (tma-tmin) 61 t ia
e
diviolacd into
3+4 y Sub-imterval +hem ech6the t4
CUbic . blem ding. fumcion sþa
- Sele ted
eight (n+d+1 9) þorameter yaluy (tj.o
Satstyimg he rela Hor tj<tj, MankA the e mod boin
thesubimtervay.
the set tj ie to t, t, tytytr tet+] i rejerreol
as a Knot ve ctoy we ca cho.se umifoxm 1mte ge
Kmbt vecter i ke Co, 1, 2,, y. S.64] ìth
Kot Valy. th ies the ranige evenly sPaces
þqYa metetqsf r
tmin = to= D. Upto tma ty 7
-USIn the Yeeurren ce relotion eg- we obtain
[. t-to
B o,lt) = B, 3 (t)+ te~t B,2(t)
to- to ty-ti
t-oBealt)+(t) ,31t)
( ) B4s(t)+E) 8,alt)
t- ty t- t
B, 4tt) -
ty-t t-t
B21lt)
Bialt) + S)8lt)
3
k-tlo..
t)=00 B2,) else 3st<4 |t)1
if B3,
else 26t<? ít t)=4 | B2,
0[t) Bo,) ele Bolt)=
weqet 6toifrmo Vanyg btHenca
Dtt)= Bii lk e
tist<tit! it
&slt)4(-t)
Berlt) (t-s) =
|t) 2Bs,
lt) 8s, t) 6-+(B4lt (t-4) 2(t) By,
(t) B3,(4-t) lt)+ B2,(t-2) &2,2(t)
(t) (2-t)
82, It)6(t)+ 2+)= Bi,
lt) (2-t) &i tt)+ Bo, t): (t) Bo,
s
otoitran vaying and bubtig Pimaly
B,alt) +t) (t) t)& =| lt) B43
B,lt) +|6t) 3(t) ) =lt) 633
32t) St) +(
Balt) t:2) ()= B.s
B2,3
e) () =)Bi
+lt) Beslt) get
eguaf 4otoitrom vanying omol ol=3 puting -Again
L)B34
evauat1
- HPRYih eqma ) m uma succersyveg
-0 an to (6) we qet s he cifC eapres:
tor the truy blemai on. fometHon &-in oi f erent
Sob )mter va t as
Bo,&(t) =
(4)
(e) +(3-t)+ )(4-t)(t-) (3t)+%)tt)4t)
3) (4-) far 3st<y
V) tt-y3
8i,4()>
() (+-) 3
fa S3t<
fe 4st<
V) (1t)a 6stey
Nte! +hÁ valtt t Biut) a a t t d t ) Con be obtimecl!
Bo,( , t ) B1(t)
2 6
Po, Bey tt)
i, G,lt) A, &eult}
t3 to t4
blemolinaumcionA have +he same shabe
that is al the
Each Successive bleoing tumctiom ib Sim P.
stütted o trq)Slated versjom ot the previ 046
a
fumcti0n:
that each of these blending fumc tion
A1s0 mote Cubic 8egments Nith inheent
LUTves Consist o to4r mter meoliat knot
Zentinuty c c comtimut) at the
tt(3-+}la-)l4)l8-t)
t(2-t)+ht(t-y(3-t) +%lt-) (4-t)
+; (t-)"9-t)
03 #(4-t)3
3
SPan the full ange o1 t: Jti6 initecl to a
Yeduce þarameter ange to-=3 to tm9
wich the Sum o all the fo4Y Over
equal to umit blemoung tumctOYA
evevywhere
ie
ZBlult) =1 for 3sts4
-hus the ejfeeive exbre ssjom for a
efinecl by four control þoint Po, cubic B-sbine
P, Pa, P3, n ol
Umiform Knot vector [o|234561) iA
Þlt) B0,4 (t) Po +By,4() Pi + B2,4l)+
=
B3,t) P3 whd
34ts4
(4)= 4-o+4t)l4-t)"+}(t)lt-y(4-)+%
(t-3) (s- t)??6 +(t-y(4-t) +7lt-ylt-3)l-t)
+*(t-3y(s-t)}fa +1tt}B bhere
3 <ts4
Po
it cqm be byoved that f0ra cuDIC (q=4)
B-SAline fited to m41 Control þoimts Po, Pi, Ps
Pn-2, Pn- Pn the stat nd emd þoimto anl
stant (o+4h+f)
Jn matri foym:
3
p
3 -6 3
-3
-[E++) ( ) ) 6
6 + = 2|
6
lend (a-)
dt |A=tend
dytt)
dt lttend dt teetend
foc)-[20 So)}
2
dt t=temd
dy (4)|
d t ttend
Hemu the sleþe t he cÚare at the empont 1A
c lt=tend dt tetenc
dt lt=tend
Uçed
be wi Hh clas
o object, Qre tHu
desci
They mtlud se quadvic sufous wic
<bhevea,comd-ol sgree esuations (quadratics)·
elli kseidy, tovi,
Jn crtesian
coovolmaty
Yaddus Ycentered the coor a Pavaboloide,and
sbhevical
hyberbo
sorfaca wi
dened as set o
ei nate biin
Poimt[, Y, ) that Saisty th equati
We Cam glso
olesevibe ke Sbherical Syrtaain þara netri for
Sin
Jt can
be gemeqted byyrotatt a circde
Comic about a sheitied qis'
the cartesian rebyesentaton fa Pointr over th Surta
can be writen in thefoom
t y Y+ ()Sjne
sing.
Super quadvica e foY mec
in cov Þorating adoi onal paYam eterA
Imto the quadyic euatoms to pYoi du incy eajeal tlexi bi
t adusH objet chabey
qdeitional
-the num ber Favameter vIecl i a egual to the olmensi m
the obeet 0ne PavameterA t cuYye omd tso Parame
()
we howe am
Superellpcord
ametre rebres en taton f t
th þar
Se zieY Suy
faces'.
BeziY Sur faea þatch is a
4x4 9vid j l6 Control þo1 nte ih
duicibe a
bavametric bitubic sufa qiyinga tompaet
malematet defitin 4vch surfrt orth,oet
Shreeach tht tmtrpotated point: heneotto
gene ra2aH on the 3ezier
reso conto) þoints Can be urve, in utich each
imen lbn. tnought as a se atr curre in
A Bezity Sur fa þatch i
STYIR GB, haich sheiies theobtimel by its 4x4 Be zier
Geometry
As im the
contro) þoints 4 tne surfau
the cae
cate Bezier tirres the Cormty þoimt Y Ge
sheity actued boimt
imts on the eclge g the imter
polsteed Surfa
Yol, firtt colymn,pomtqny
a fourth
þoimt ot bnfrt row, fourth
beimts sthich inoli rey Column)the qre imter neoate
the surfau seit tomgeut vector. to
-he ymd 2 lirectin s
the sYr ca are caleus teal
fa a 39 Surfau a toh
nctualy be seharat gee metr thee laill
('ne fa each oirection. mstries Gay omd noz
-it is þossi ble to 2
rebyeent a Beeier suxfau in ony tuo
P',j re
Be ity bess
CaBealytin Be 2ìerCve
3 3 -3
3 -6 3 0
-3 3
the co-cr
clinstes 71 earh bejnt on the
oirecty frem thu Bernstein bwls Poysurfac eym be
emials caleulste ol
34(1-y2
Bel4) = u(-4
4hen fe earh
Ris
BilJBj)
Bk.
yNna min
wjmolo
XWmim
The leng th o imiuge om tRa sareem must be
measYeol im ScYeem Co-oY oinat ( we have
Momane 4ke Scyeen cAbydimats Sohat thy ange
rny
het weeM
objet
Sþau
hm
Ascalig trongjomat
Lsill Convert objet Coori
nat ymits tonomalizeay
SCreen Co-or
Yomin
mitim. Trmr (oorinte v)ewpo
- indow
to
oìxely insCYreD actual Higt
orolinsk Co
ranste co dice Actual
Co-0Yoingtes cevice
maizes) te calls are Units mont otebe ovice
in the
ouvice: blay Particular
i
t feaus ble! byiae aÞro oyoimste
to s Co
TheJt
onveyt to pree erint the use Omdbìxele thon
Co-oyinstes
some othe bnts
in bicture the autine tohae e
oyoingos' Co
maizeTmstormahon
o NoY to
Hons!. ma
fTrcms
oyvTrcms 1mg vigw O
Xmae- Xvmin X mas- Xomi'n
Y-min Yu Ywmin
Yymin Ywmae Ymin
Stlvi hese erutoms fe t vieu þort þosion (v, Y)
Xy= Xvmin t Xy-
X%min)
khere sceding factors qre
Xumag - Xv min:
4he Vieksng
vie trms forms tton tch mab bictóre Co-orolinstes
fn the ycs to oibly
co-byaingtes im pb(S is perfor mea b}
the follo loing troms for
mstiom
ci) Nor mai zing
viewing Co-orelinste s
CnveY g moymalizec) vieksi ng looyoinsles t olrice
Co-yoinste s:
trmine Convent sorld Cemert
Normalizes Nvc rmal 2el
Peleling co byelirste
tsfor mgtion
viewirg co-oral' vieing,
o-oYns fe
viebing
Cobyoes
|to olivies
-
the þro ( oyre hat joumi fies the por
þicture that tions a
qre e the in sidu or out so
cþeafied a
- the regim
regiom sþare is veferred to au ciping.
wich qn
obiect is to be cli bhe
is Callad a ci}
windaw a clip bing aindo lo
) CUrve
Tert iit.
he egual sign malicates hat boint on the w
imdloo bomduy
TBRL
lest
Rignt
Batom
ToP.
One ckithig Mid oimt Sybaivision Alg0rithm
- the Suther (amd Co hen ubivision ine ci pping
algoritby
Tegures the calcula tiom 4he intersection the ine
Loit the Win da) edge +hese Calulati bns can be
Qvoidd by refetitively subdivi oliny the line at its
nid peint
Loindb
(Wx,. Wy,)
P,
(Wx, Wyz)
Fig. 5.15
Read two end points of the Iine say P, (x,, y) avd |, (, v,).
Read two corners (lett top nd rht-bottonn) of the window. r (W,. W
nd W, Wy,).
isigu the region codes lor two endpoints |, aid !, using lollewin; stepy
Initialize code with bits (0000
Set Bit 1 if (x < W,)
Bit 2 (x W)
Set Bit 3 - if (y Wy.)
Set Bit 4 -- (y Wy,)
4. Chek for visihbility of ine P, ,
ANDing of them
regioN codes for endpoints are not zero and the logical
b) If compleely invisible, so reject the Iine and
iS also hon-7ero then the line is
go to step 9.
4a) and
region codes tor twO endpoints do not satisfy the conditions in
c) H
4b)the ine is partially visible.
the
of the clipping, window by inspecting
5. Determine the intersecting edge
region codes of two endpoints.
find intersection
the end points are non-zero,
a) If region codes for both window with respect to
points ; and ß with boundary edges of clipping
point P, and point l,, respectively. intersection
one end point is non-zero then find
b} If region code for any respect
edge of the clipping window with
point I; or Pß with the boundary
to il
intersection points.
6. Divide the line segments considering outsides the
the line segment if any one end point of it appears
7. Reject
clipping window.
S. Draw the remaining line segments.
9. Stop.
Subdivision Line Clipping Algorithm
code for Sutherland and Cohen
vtubooks.com)
(Softcopy of this program is available at
#include<stdio.h>
#include<conio.h>
#inchude <stdib.h>
#include<dos.h>
#include<math.h>
#include<graphics.h>
end point of line */
/* Defining structure for
typedef struct co-ordinate
int x,y:
char codel4];
}PT:
void drawwindow();
cl);
void drawline (PT p1,PT p2,int
PT setcode(PT p):
int visibility (PT p1,PT p2):
PT resetendpt (PT p1,PT p2):
NumeYICr YOble ms
A
Clibbing bindoJ ib qiven by A(I0,10)
B(20, 10), c(20,2o) omd 0(10, 2o),ind the visible
Por tiom o a Ane P( S.s) A(s,25s) Jm sid the inde
c(2
Ans, wimddowlett edge Wx min lo
oindos Right edge 1xmas=20
oin oloWA toottom A
wimdlowA edgewymin4o
Top edges wymae 2o
( 1o, 10)
B(2c,1b
4St5
accepted
Tebey cut the ime(at Puty2 0
20-5 =()* (1-)
135 +5=38
4
Yejecded
Hena wisible Por HOn ume between
3
Griven wimdow A(10,20) (bo,20)
c(60,s) (20, So) Use - Cohen - Suther\ane
algriHm to find visible Por Hom oof the nex
Pl 30, 2s) 8lso, 4s) omd A (30, SS) Bl6S7S)
(9e:
Pb, o
Regiom Code for Pi
Sime Xomim <n< wma
So lett om dl Right bit wu
au Zerb
3 S
S36
Regiom
Bituise ANbing
sime bit oise AND0 ngi nom ero nm ber
ine is Combletely bes
& Use out coce bajesl ne ciping me thoc to cla
ine stating from (-13,5) omcl enoing at (14,)
ajinst ta oim dou haing it Lowey tt cemer at
(-8-4) nd þhey yight (oy ney at (12, 8)
cehen- Sutherlamd outcocu Algoyithm to
AlSe, o)
A Clibbing winde AGcD is lecotel aas fo'
A(16e,1o) B(060,10) c(I8e, y) D(lo,4 o) : tsg
4h vist
Suiherland -Cehem cippimg algoyithn tinel
ant! E(se,)
Povib c1 1th ine Segmen's EP,GH nc
1 140,0)
F(1,8t) G(U20, 2 0) , H
E 120, g, 30
- The mi þojmt
Suboivisibn hnd cohen-
assume that the citbing wiolow is aSutherlano Ajme cPing
yoqulay rectong le
TAece algorilhms qre mit aphlica ble fa non
cliping imdbu vectamguar
Cywmd eck have olevelo ped a
agor1tm tich is abblica ble to Aenevaized ine clpbing
any arbitYart Conen
vegibm:
Ahi algorith m Uses a þarg metrie
Smnt to id the inteySecHon þointseguston
4a ine
aine ith the
clprirg edyes.
the parametric
e9ustHom o aine semtnt from hto
þit) =
f,+{-f)
ohere t is a
t
avametr t=0 at R Ond t l t h
Consialer a Con vex cping yegion R, f is a bounalary Point
the Comver
Oibn R onol n is an înner moYMa ta
one
its"bo4ndaes. ay s hon in he fig bodo
Boundary Poi at
R- Convex regon
then oe Cam dic tinguih im wtich regiom a bornt e.b.
looing at the vala the alot þroduct nfpu)-] as
Shon jm figure below:
Pt)4) >0
icithing edge
nfpIt)-f](o
th en the vector pi) -{ ir þoì nte) abay from tne interiovyR
14 dlot þroduet is 2er0, ie
nþlt) -4)=0
then b[-+ ir b8jmted paralls to he plome com taining
t ond þer þenoicay to the nor mal
2 4
8
6:
P{8, 4)
P(-2,1)
6
Fig. 5.19
Soiution:The parametric representation of the line PP: is
P(¢) = P, + (P, - P)t = (-2 1]+ (10 3] t
= (10t - 2) i + (3t+ 1) j; 0sts 1
where i and j are the unit vectors in the x and y directions, respectively. The t
inner normals are given as
Left n, = i
Right nR =- i
Bottom
Top
Choosing f (2, 0) for the left edge gives
P(t) f = (10t - 4) i + (3t + 1) j and
n [P(t) -f] = 10t - 4= 0
t = 2/5
Substituting value of tin parametric equation we get,
P(2/5) = [-2 1] + [10 3] (2/5)
= -2 1) + [4 6/5]
= (2 2.2]
Duter Graphics 5-29 Windowing and Clipping
W, = P - as a weighting factor.
oB163)
Vs
Vb
b
Hgu abau shawy tle Hexagone
(S 275)
Computer Graphics 5-32 Windowing and Clip
y = y + tAy, 0sts 1
where Ax = Xy - X and
The point clipping conditions for Liang-Barsky approach in the parametric
can be given as,
Xwmin S XË t tAx S Xwmay and
Read two endpoints of the line say p, (x,, y) and p, (x, Y).
Read two corners (left-top and right-bottom) of the window, say (xwnin Ywnay
Xwmax ywmin)
-Riang-avs ky algoril hm caltda tes uru
valus Þaremele t: t, nol t hat oufine
CODING
hat þart 9 tho ine that ioy ithin the cli
Yectengle:
Private Sub Commandi_ ClhckO valw ati ooteryeal b} checlmg tne
Listl.Addltem "bca Yectanyle edge te yhch thi ine bceeds
Listl.Additem "bba" foom outciols te t4 insida(P<)
ListiAdditem "mca" th walu tis taken asa Largert velu
List1.Addltem "mba" Cmergst vari ous alus o inter sections wth
List1.Addtem "b.ed"
Listl.Addltem "ba"
End Sub
Proceedy fom th imsjodo te th out sie
the calcalate!. vale
Private Sub Command2 Click) is talen q yal fe t .
List1.Removeltem (0)
End Sub
t,7 ti,h ime is Com bletaly
CaPþigwinolo Cnot it Cam be
Private Sub Command3 Click)
rejecteol
End
Substitute! in the þara meti euationg
End Sub
to get th end beints the ci speel t.
Y= 30
-22S
Xwmo 21
d= 30 wma = 2
, = X- Xsmin -5,
= 0'3
P= -0y = -20 Ymi to-S= W3
|o+ o'3x 2 0 = C
Suther land - Hecd geman poly gon ciing'
te gon can be clibþocl b þroceesiny its boynao
asa lshole aganst each loimales eol ge
4his Can be achieved by þroeo sting al
boly gon
veries agoinst each cip ectagle
bouelg1
Begining sith the original set polygon vertices,
we Coalod firt clib verti ces,
he þohyg8n again1t the
Yectamglk boundar to produ ce a mew et e
verHces. seyutn
- the new set st
þassedl t a rìghtverices could 4hen de succe csively
cibber Ond a botom bomdary ctþer a tob bounday
shoan in fig bel.
beb boumdgry cpber, .a
as
6riginal þlygon
Right cibec
genevote
en step a me sets þolygarn Vextices is
and þass ed to the net inola boundars clber.
the suther lancl
- this is the fundamemtal jolea usef in
-Hodge an algoithm