0% found this document useful (0 votes)
4 views

cg_ass1

The document discusses various computer graphics algorithms, including Cohen-Sutherland line clipping and the scanline algorithm for filling polygons. It also covers properties of B-spline curves and transformations such as rotation, scaling, and shearing. Additionally, it provides examples and mathematical formulations related to these concepts.

Uploaded by

saykulkarni69
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

cg_ass1

The document discusses various computer graphics algorithms, including Cohen-Sutherland line clipping and the scanline algorithm for filling polygons. It also covers properties of B-spline curves and transformations such as rotation, scaling, and shearing. Additionally, it provides examples and mathematical formulations related to these concepts.

Uploaded by

saykulkarni69
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

CG Assignment 1

Name-Sayali Kulka|ni
RollNo - 59 - SE Comps A

Explain Cohen Seutheriand Liné Clhpping Agooithm.


Use to clip two Iines pl and p2 P3_and p¢
where Pr (40,1t) p2 (as,4s), P3 (30,20) P4(o
uoindouwA (s0,10), B(&o,10), czo 40)

Linel: P(40, )
r P S-45)

looo
Pe.
D{ le

Point End Coe


ANDing Result
e e e Pz
partially
visible
4s-Is
2
S -4o =23-S
clsssiie

Pags

m(zmig- ) t
.=66(5o- 40)+s
m( max -X) ty
G(3o- 4o) +!sy2 49-2

40 -s0) t 40

Lime 2 P2(t0,60)
P+(too, o)

Point End Co cle ANDing Resctt


P3 partoly
P4 Visrble

Stope lo-G6 w

m(max -21)

=
(JmaxJ)
72
Data

Explain with Example Scanlne f Algoithm


Used to fi11 polygons.
Mqorithm:
Redd m (numbex ot ve otices o4 Polygom)
Read eooTdinates of all vetfces in anra
x Cn] ond y Cn?

3 Eind Ymin and Ymax


4 Stoe the initial
2 end and po ints
inerêmt
drom Scanline to Sanline each edqe
in the
the tray edqes

Lo
5 Sort the Rows ot Arays
descending Ordes Des cenaing oyoleY o 2
amd As Cending ovder

Set

the Active edges and obton


Acive edge
C>y2
cdgeis active
else
s edge is not active
4he mfundamentals oT all active edaes
& Compute X
Yvalues Initially x-inteset
edges.
for Curent
is qnd for SUcee Sgive y values Con be
whee Qnd
given as

?2

mtesects vetex, then apply etex


test to 'eheckwheHher to Consídey
intersect 6 dwo intersoets. Stone dll
in the 2-interse et [ 1 aray

lo Sot

I Extract pairS
paivs ofo nters ects fom the Sorted

|2.
Pair pairs of Vaes to ne daiy outine
to ra
corTespondig line seqmeuts
Set
14
Repeat steps to 13 ntil y > ymin
Stop
Date,

ot 8-spine cusve amd Bener Caltve


Q3 Give properties
B- spline CUne:
the Surtace is allowed
i) Local eonto| ove
by S-pline Curve
Sum of the B-spline basis fun t'ons foo
2) T
The
parameter valut is 1
3) Eoch ba sis fumctton is þosiive or 2ero for all
pmameter value.
A Fach basis femctien has preeis ely Onemarmum
Value eXcept for k-)
5) The maxium 0rder eurve is equal to
the Vertes thot detine tue polygn
6) The vaation diminis kinq popety is exhibited
by tne
Afne transo matan. applred 4o hne eemve
Beiney Cuve:
Bezey Curve ad uoays passes throug h first and
last ntol points
Theee degee ot the
polynomial detining the
urve Segmeut is |2ss than the
e Aining pogon poirts.
unve
generay follocs the skape a
dedining
The
poy gon
o fhe tageut vectoY at the d
toints is the vectoy detenined by
Ainst and last Segmeut bt
5) The ve lies entiey within the lo nyex hul
Aoned by the first fou conbol points
Paga

A Trianqle is de tined by 3 vezticej


Alo,2,D
Q4
BC 2,340) cCL,2,) Eind tre finad coordinat
aftey it i's
joining the teted
ao tote
points ,2,2)
22)
by 45
od -ei,L;).
houndaa ine

9-45° A (x:0,=2,2=|)

y
- Sin4 Bos4s

By 3olving we
get

B 2, y-3, 2-0)

tos 45 Sìn4s 2.
3
Sin 45 COS4 S

z-|:40|
olr), y2, z 1)
tos 4 Sin 4S
2
-sin 4s CoS 4 S

Q'=]:3762 y'-2 2 -032S

tey
New points after Rotatton dre.

(0850, 2, os2s)
8(1050, 8,-|01)
( 346 2 ,2,-6325)

Q5 how Sheqs Trans fo matin be


in terms o expessed
Rototion and Scaling
The -sheaY operatin
| Pertomm toUmteY -Clockwise
angle o about the 0tati'om, by an
elated to the
origin The angte
shear da eto h by the
follo toi'ng operatn :
tan (e) =h.

2 Petom a scalig tans fomatto


-axS SCcde faetor along tthe
S-x where,
Sx= th?
Paga

Sin
Rotati n Matix
COS

cal'g Matzix < Sz

The y-shear operation :


Perfomn COun tey - clockwise otati n by

ang le about the oigin The angle


Yelated to the shear factor v' by the followinq
eqatiM

Petom
2

7axis oith a
tansfomatioy alory te
A
Seale fattoy of Sy

Rotaton

Scaling Mabix =
Data
Pane

that tansoation mataix for a


eHecion to
efreatiog
about a Iine y=X is euiveleut to
folloused be CoUn te - cloctwise otetion
X- axisfollose

Re flecHon

R(a) = Cos Sind Counte Clock


Sind wi Se Rotation
3

Thiy is equivaleut to Reflecti cm in


XaxiS
4 R(70)y

in is quiraleut to
Refleetton in Yaxis.

You might also like