Вы находитесь на странице: 1из 34

2.

2 GRAPHICS
AND MULTIMEDIA
THREE
DIMENSIONAL
CONCEPTS 2.3

Parallelprojectionis a methodfor generating . Depthcueingis appliedby choosing


a view ofa solid maximumandminimum
objecjis to projectpointsthe objectsurfacealongparailer intensity(or color) valuesanda rangeofdistancesoverwhich
rines
ontothedisplayplane. the intensitiesareto varv.
In parallelprojection,paralel linesin theworld
coordinatescene
project into parallellines on thetwo dimensional ' A simplestwayto identifythevisibleline
displayplane. isto highlightthevisible
This techniqueis usedin engineeringandarchitecturar linesor to displaythemin a differentcolor.
drawings
to representanobjectwith a setofviews that maintain ' Anothermethodis to dispraythenon visible rinesasdashed
relative
proportionsof theobject. lines"
' The appearance --
ofthe solid objectcanbe reconstructedfrom SurfaceRendering.
themajorviews.
' surfaceRenderingmethodis usedto generatea degreeofrealism
PerspectiveProj ection
in a displayedscene.
@nerating a view ofa threedimensionalscene Realismis attainedin displaysby settingthesurfaceintensityof
is to proj ectpoints to the displayplanealongconverging objectsaccordingto the lightingconditionsin the sceneand
paths.
. This makesobjects farther surfacecharacteristics.
from the viewing position to be
displayedsmailerthanobjectsofthe samesizethatare Lighting conditionsincludethe intensityandpositionsof light
near€rto
theviewingposition. sourcesandthebackgroundillumination.
' In a perspectiveprojection,parallellinesin a
scenethatarenot Surfacecharacteristics
includedegreeoftransparency
andhow
parallelto thedispraypraneareprojected
into convergingrines. roughor smooththe surfacesareto be.
. Scenesdisplayedusingperspective
projectionsappearmore Exploded and Cutaway Views
realistic,sincqthisis the waythat oureyesand
a camerarens ' Explodedandcutawayviewsof objectscanbe usedto show
f6rmimages.
the intemalstructureandrelationshipofthe objectsparts.
. Depth Cueins ' An altemativeto explodinganobjectinto its componentpartsis
' Depthinformationis importrant
to identifytheviewing direction, the cut awayview which removespartofthe visiblesurfaces to
which is the front andwhich is the backof displayedlbject. showintemalstructure.
h is a method Three-dimensionaland StereoscopicViews
displaysis to the i ' In Stereoscopic
views,threedimensionJiFewscanbeobtained
tlrstancefromtheviewingposition.
U y -
2.4 GRAPHICS
AND MULTIMEDIA CONCEPTS
DIMENSIONAL
THREE 2.5

. Thevibrationsofthe mirror aresynchronizedwith thedisplayof Wherepointsandvectorsarespecifiedwith 3 componentsand


the sceneonthe CRT. matriceshave4 rowsand4 columns.
transformation
. As themirror vibrates,thefocallengthvariessothateachpoint 2:2 Three DimensionalObject Representations
in thesceneis projectedto a positioncorresponding
to its depth. . Representation schemesfor solidobjectsaredividedjnto two
. Stereoscopic devicespresenttwoviewsofa scene;oneforthe asfollows:
categories
left eyeandtheotherfor theright eye.
(B-reps)
I . BoundaryRepresentation
. Thetwo viewsaregenerated by selectingvieying positionsthat
It describes@s a setof surfaces
to the two eyepositionsof a singleviewer.
corresponds
thatseperatetheobjectinteriorfromtheenvironment.
. Thesetwo viewscanbedisplayedon altematerefreshcyclesof
2,
a rastdrmonitor, and viewedthroughglassesthat alternately
darkenfirst onelensthenthe otherin svnchronizationwith the It describes by partitioningthespatialreglon
interiorproperties,
monitorrefreshcycles. containingan object into a set of small, non overlapping,
contiguous solids.
2.1.2 ThreeDimensionalGraphicsPackages
Eg: OctreeRePresentation
. The 3D packagemust includemethtds for mappingscene
descriptions
ontoa flatviewingsurface. 2.2.1 PolveonSurfaces
-
Thereshouldbe someconsideration . Polygonsurfacesareboundaryrepresentations
for a 3D graphics
on how surfacesof solid
objectsareto bemodeled,howvisiblesurfaces canbeidentified, objectthatenclosetheobjectinterior'
how transformations ofobjectsareperformedin space,andhow PolygonTables
to describetheadditionalspatialproperties.
Thepolygonsurfaceis specifiedwith a setofvertexcoordinates
World coordinatedescriptionsareextendedto 3D, andusers attributeparameters.
andassociated
are providedwith output and input routinesaccessedwith
For eachpolygoninput,the dataareplacedinto tablesthat are
specifications
suchas
processing.
to beusedin the subsequent
polyline3(n,WcPoints)
Polygondatatablescanbeorganizedintotrvogroups:Ceomedc-
. fillarea3(n,WcPoints) tablesandattributetables.
text3(WcPoint,string) GeometricTables
getlocator3(WcPoint) Containvertex coordinatesand parametersto identifu the
(translateVector,
franslate3 matrixTranslate) spatialorientationofthe polygonsurfaces'
2.6
GRAPHICS
AND MULTIMEDIA
THREED]MENSIONALCONCEPTS
2.7
Attribute tables
-.-,---# ' Listingthegeometricdatain threetablesprovides
uontamathibuteinformationforan object a convenient
suchasparameters
qpecifyingthedegreeoftransparency referenceto the individual components(vertices,
ofthe objectandits surface edgesand
reflectivity andtexturecharacteristics. polygons)of eachobject.
' A convenientorganization . The objectcanbedisplayed
for storinggeometricdatais to create efiiciently by usingdatafrom the
threelists: edgetableto drawthecomponentlines.
l.&Yssex.kbte ' Extra information
can be addedto the datatabresfor faster
coordinatevaluesfor eachvertexin the informationexhaction.Forinstance,edgetable
objectarestoredin canbeexpanded
thistable. to includeforwardpointsinto theporygontable
sothat common
2'E@r. edgesbetweenpolygons can be identified
more rapidly.
It containspointersbackinto thevdrtex (figure2.3).
tableto identi$,the
verticesfor eachpolygonedge.
Er V,, V,, S,
3. ThePolygonThble
---
It containspointersback into the edgetabre E2 s,
%,%,
to identify the
edgesfor eachpolygon. E3%, vl, sl, s2
This is shownin figure2.2.
E %, Vo,S,
Vertexttable Edgetable Folygonsurface table E5 V4, V'52
vr X , , Y , , 2 , E I v,,% S, : E,,8,,E,
% XtY,,Z, E2 %,V, S, :E' E4, E' E6 E V,, V,, S,
V" x , Y , Z , E3 V,, V, Figure2.3
v4 x4,Y4'24
V, : X,oY,,2,
E %,v. This is usefulfor therenderingproceduresthat
Er: Vo,V, mustvary surface
shadingsmoothlyacrosstheedgesfrom onepolygon
Eu:V' V, to thenext.
similarly,the vertextablecanbe expandedso
thatverticesare
cross-referenced to corresponding
edges.
Additional geometic informationthat is stored
in thedatatabres
includesthe slopefor eachedgeandthe coordinate
extendsfor
eachpolygon.As vertio# arernput,we cancalculate
edgeslopes
andwe canscanthe coordinatevaluesto identify
th, Jnirnu_
andmaximumx,y andzvaluesfor individuatpoiygons.
Figure2.2
2.8 GRAPHICS
AND MULTIMEDIA
CONCEPTS
DIMENSIONAL
THREE 2.9
' Themoreinformationincludedin thedatatableswill beeasierto
Where(x,y,z) is anypoint on theplane,andthecoefftcientsA,
checkfor errors.
B, C andD areconstantsdescribingthespatialpropertiesofthe
. Someofthe teststhat couldbeperformedby graphics plane.
a package
are
Wecanobtainthe valuesofA, B, C andD by solvin$a setof
'"[ . thateveryvertexis listedasanendpointfor atleasttwo threeplaneequationsusingthecoordinatevaluesforthreenon
edges.
2,)hatevery edgeis part ofatleastonepolygon. colinearpointsin theplane.

Ythat everypolygoni s closed. For that, we can selectthree successivepolygon vertices,


(x,y,z\,(x2,Ys,4)and(\, Y3,zr) andsolvethefollowingsetof
phateachpolygon hasatleastonesharededge.
simultaneous linearplaneequationsfor theratiosA/D, B/D and
--V. {natifthe edgetablecontainspointersto polygons,everyedge C/D.
referenced by apolygonpointerhasa reciprocalpointerbackto (A/D) xu+ (B/D) yk+ (C/D) zu= -1, :1,2,3 ...(2)
thepolygon. =-- -: -.---=- --------;-----'-7
Ihe solutrontor thls set of equattonscan be obtainedis
PlaneEquations
form, usingCramer'sruleas
determinant
@ay ofa 3D object,we mustprocessthe input
datarepresentationforthe objectthrough severalprocedures l v , z, ,
i..1,
t ' *
suchas A - I Yz 22 I z"l
,
of the modeling and world coordi
l Y : 2 3 1 t-rl
2/transformation
descriptions
to viewingcoordinates.
devicecoordinates; Y t l IyYt3
;Zt(""to
t . /
Y z l x2 Yz zz ...(3)
/ identificationof visiblesurfaces
Y t l x3 Y: z3
: of surface-rendering
procedures
l"application
For theseprocesses, Expandingthedeterminants, we canwrite thecalculationsfor
we needinformationaboutthe spatial
orientationofthe individualsurfacecomponentsofthe object. theplanecoefficientsinthe form:
This informationis obtainedfrom the vertexcoordinatevalue A = y r ( z z- z r )+ y r ( 2 , - z , ) + y r ( r , - t r )
andtheequationsthat describethepolygonplanes.
B = z r ( x ,- x r ) + t r ( * r - x , ) + 2 , ( * r - * r )
Theequationforaplanesurfaceis c = X r ( y ,- y r ) + * , ( y , - y , ) + * r ( h - v r )
A * * B r * c , + D= o . . . (I ) D - - x, (y rz, - y rzr)- x, (y rz, - y rzr)- *, (! rz, - y rzr)
2.10 GRAPHICS
AND MULTIMEDIA THREE
DIMENSIONAL
CONCEPTS 2.11

As vertex values and other information are enteredinto the . Another similar function in the quadrilateral mesh,which
polygondatastnrcture,valuesforA, B, C andD arecomputed generates a meshof (n-l) by (m-l) quadrilaterals,
giventhe
for eachpolygonandstoredwith the otherpolygondata. coordinatesfor an n by m arrayof vertices.Figure2.5 shows
Planeequationsareusedalsoto identifuthepositionof spatial 20 verticesforminga meshof l2 quadrilaterals..
pointsrelativeto the planesurfacesofan object. For anypoint 2.2.2 Curued Lines and Surfaces
(x,y,z) hot on aplanewith parametersA,B, C, D, wehave . Displaysofthree dimensionalcurvedlinesandsurfacecanbe
Ax+By*Cz+D+0 generatedfrom an input setofmathematicalfunctionsdefining
Wecan identiff the point aseitherinsideor outsidethe plane the objectsor from a setofuser speiified datapointS.
surfaceaccordingto thesign(negativeor positive)ofAx + By + . Whenfunctionsarespecified,apackagecanprojectthedefining
Cz+D:
equations
for a curveto thedisplayplaneandplotpixelpositions
ifA* + B, * C" + D < 0, the point (x, y, z) is insidethe surface alongthepathofthe projectedfunction
ifA + B, * i, + D > 0, thepoint (x,y,z) is outsidethe surface. . Forsurhces,a functionaldescriptionin decorated
to producea
Theseinequalitytestsarevalidinarighthandedcartesian
system, polygon-meshapproxiationto the surfacs.
providedtheplaneparametersA,B, C andD werecalculated
2.2.3 Quadric Surfaces
usingverticesselected
in a counterclockwiseorderwhenviewing
thesurfacein anoutside-to-insidedirection. . Thequadricsurfacesaredescribedwithseconddegreeequations
Polygon Meshes (quadratics).
. A singleplanesurfacecanbe specifiedwith a functionsuchas . They include spheres,ellipsoids,tori, paraboloids,and
fillArea. But when objectsurfacesareto be tiled, it is more hyperboloids.
convenientto specifythe surfacefacetswith a meshfunction Sphere
. Onetypeofpolygon meshis thetriangle strip.
. In carteriancoordinates,
a sphericalsurfacewith radiusr centered
. This functionproducesn-2 connectedtriangles(figure2.4),given
on the coordinatesorigin is definedasthe setofpoints (x, y, z)
the coordinatosfor n vertices. thatsatisfytheequation. '.;

x'ry'+* = f
. The sphericalsurfacecanberepresented in parametricform by
usinglatitudeandlongtitudeangles(figure2.6).

Figure2.4 Figure2.5
2.12 AND MULTIMEDIA
GRAPHICS THREE
DIMENSIONAL
CONCEPTS 2.13

The cartesianrepresentationfor pointsoverthe surfaceofan


ellipsoidcenteredontheoriginis

r ' r 2 / \ 2 r ' r 2

l r l * l r l .( .[, /1 -] r
,\r./
[rrl

The parametricrepresentation for the ellipsoidin termsofthe


latituteangle$ andthe longtitudeangle0 is

x = rcoso
cosl,
Figure2.6'

-/,
, ,.l
< + < y"l
X = r * c o s g c -o%
s o= ,O s % 1\
- - t I y = r y c o s $ s i n Q ,- n 1 Q < n
- t
I:_l:asij!q0,
.- r
-n 1 d 3 n | |\
(a) z = r,sinO

-.To l) Torus
. The parameterrepresentationin equation (a) provides a . Torusis a doughnutshapedobject(figure2.8).
symmetricrangefor the angularparameter0 and$. . It can be generatedby rotatinga circle or other conic abouta
Ellipsoid specifiedaxis.
. Ellipsoid surfaceis anextensionofa sphericalsurfacewherethe
radiusin threemutuallyperpendiculardirectionscanhavedifferent
values(figure2.7).

riitJ itri l

Figure2.7
2.14 THREE
DIMENSIONAL
CONCEPTS 2.1s
GMPHICSAND MULTIMEDIA

' Thecartesianrepresentation Interpolation and Approximation Splines


forpoints overthesurfaceofa torus
canbewritten in the forrn . c".ve Canbe spe
Fline

t
L'- ;till' .[;)' ='
calledcontrol points which indicatesthegeneralshapeofthe

' Tllilontrol points are fitted with piecewise continuous


parametericpolynomialfi.mctionsin oneofthe two ways.
wherer in anygivenoffsetvalue.
l. when polynomial sectionsarefitted sothat the curvepasses
Parametricrepresentation for a torusaresimilarto thosefor an througheachcontrolpoint (figure2.9),theresultingcurveis said
ellipse,exiept-thatangle$ extendsover360o. to interpolatethe setofcontrol points.
Usinglatitudeandlongitudeangles$ and0, we candescribethe
torussurfaceasthe setofpoints that satisS.
Q
n < 0 < n
- n 1 0 < r
,ffr
' A splineis a flexible stripusedto producea smoothcurvethrough Figure2.9
a designatedsetofpoints. 2. Whenthe polynomialsarefitted to the generalcontrol point_
' Severalsmallweightsaredisftibutedarongthelengthofthe strip pathwithout necessarily passingthroughanycontrolpoint,the
to hold it in positionon thedraftingtableasthecurveis draryn. resultingcurveis saidto lpproximate thesetofcontol points
' The spline curve refersto any sectionscurve formed with
(ny2.10).''
(fisr$2.10).
polynomialsectionssatisfyingspecifiedcontinuityconditionsat a.

.r,:&,. the boundaryofthe pieces.


A spline surface canbedescribedwith tvro setsoforthogonal
splinecurves.
ffi7 '\:=_-
Figure2.l0
o-/tt

Interpolationcurvesareusedto digitizedrawingsor to speciS


Splineare usedin graphicsapplicationsto designcurveand
animationpaths.
surfaceshapes,to digitizedrawingsfor computerstorage,and
to speci$ animationpathsfor the objectsor the camerain the Approximationcurvesare.used
asdesignJoolstostnrctureobject
scene. surfaces.
2.16 GRAPHICS
AND MULTIMEDIA THREEDIMENSIONAL
CONCEPTS 2.17
Theconvexpolygonboundarythatenclosesa setofcontrol First order parametric cintinuity referredto asc r continuity,
pointr
is calledtheconvexhull.
meansthat the first parametricderivativesofthe coordinate
Theshapeoftheconvexhuil isto imaginea rubber functionsin equation(B) for two successivecurvesectionsare
bandstre&hec
aroundthepositionsofthe controrpointssothat equalattheirjoiningpoint.
eachcqntror
point is either on the perimeterof the Seconorder parametric continuity, or C2continuitymeans
hull or inside it
(figure2.1l). that boththe first and secondparametricderivatiesofthe two
D
A" curvesectionsareequalat theirintersection.
' Higherorderparameticcontinuityconditionsaredefinedsiinilarlv.
.''lP'
Spline Specifications
P3 ,.e) Therearethreemethodsto specifya splinerepresentation:
l. we canstatethesetofboundalyconditionsthatareimposedon
-.'.o thespline;(or) bgEs{-'
' 1

2. Wecanstatethematrixthatcharacterizes
thespline;(or)14gJ4il
3. we canstatethe setof blendingfunctions thatdeterminehow
Figure2.11
specifiedgeometrjcconstraintson the curvearecombinedto
Parametric Continuity Conditions
calculatepositionsalongthecurvepath
Fora smoothhansitionfrom onesectionofa piecewise ' To illustratethesethreeequivalent
parametric specifications,supposewe
curveto thenext,variouscgtlnuj&ongllions
arsneededal havethefol lowingparametriccubicpolynomialrepresentation
theconnectionpoints.
for thex coordinatealongthepathof a splinesection.
Ifeach sectionof a splinein de"icribedwith a set : a-ut-[. u-Fc, u+d*, 0< u <l
ofparametric $EI ...(c)
coordinatefunctionsofthe form
Boundaryconditionsof this curve is set on th" end point
x : x(u),y : y(u),z = z(u),u, SuSu, ...(b) coordinatex (0) andx ( I ) andtheparametrii first derivativesat
?(d^ theendpointsxr (0) andxt (r).
We set naramefric continuity by matching :rDt Thesefour boundaryconditions
the parametric
derivativesofadjoiningcurvesectionsattheircommon .'\td) are suffrcienttodeterminethevaluesofthe fourcoefficientsa .
boundarv. ar..a'
'tuSq.s't.andd"
L ^ ^--rr
ndd.
={

, .q nrder p^rametric continuitJ,,describedas


C0continuifu. ' From the boundaryconditions,we
meansthat the curvesmeet. (i.e) the valuesofx, y can obtainthe matrix that
andz evaluatej
at u, for the first curye sectionare equal,respectively, characterizesthis splinecurveby first rewritingequation(c) as
to the the matrixproduct.
valueofx, y andzevaluated at u, for thenextcurvesection.

b>
.,
,
I
t

2.18 GRAPHICS
AND MUTTIMEDIA hnrr onnrNsroNALcoNcEPTs 2:9
( !

x(u) = [u' u' u'. 'rfl:1 ,)


i

1
f, Wtreregkarethe constraintparameters,suchascontrol point
coordinateandslopeofthe curveatthecontrolpointsandBFu(u)
arethepolynomialblendingfunctions.

L;:J
I
...(d)
).2.5 BezierCurvesand Surfaces

= U.C
BezierCurves Igtl" \
| . A Beziercurvecanbefitted to anynumberofcontrol points.
WherqU is therow matrixofpowerofparameterU andC is the I

coefficientcolumnmaftix. iI . Thenumberof controlpointsto beapproximaedandtheirrelative

Usihgequation(d) we canwritetheboundarycontinuousin matix i Oornion thedegree


determine oftheBezierPolynomial.
form andsolveforthe coefficientmatrixC as . Thegeneral withtheblendingfunc,r"r..!M
Beziercurveisspecified
|
C : Mrpttn"'Mu"o. "'(e) )
|' controlpointpositions:
Supposewearegivenn*1
WhereM
P(u) :(\, yu,4), withkvaryingfrom 0to n.
geometricconstraintvalues Onthe spline-and M.^,.--in the
. Thesecoordinatepointscanbeblendedto producetheposition
{.x4noslgr |
thepolynomialcoefficientsandprovidesa characterization
for II vectorP(u),whichdescribesthepathofan approximatelyBezier
trspttnecurve .! polynomialfunctionbetweenPomd P".
I
Matrim\contains controlpointcoordinatevaluesandother ,
I
n

g"om"hii",/*haints. P(u)= ltu eezu,,(u), 0 < u <1 ...(I )


k=0
Wecansubstitutethe matrix representation
for C into equation I
(D)toobtain. i I The Bezier blending function BEZk.,(u) are the Bernsterin
x (' u' )= U . M . . . M Polvnomial.
sDltne qeom ...(0
the matrix,M***, charactenzating a splinerepresentation,
called BEZk,,(u)= ({n,t;uu(r -u)'-- ) ...4)
the basis matrix, is useful for transformingfrom one spline
representationto another. WheretheC (n,k) arethebinomial
coefficients:
Finally we can expand equation(f) to obtain a polynomial
representation
for coordinatex in termsofthe geometicconstraint c- \(.n. ,.-k- ,) ,= 'n! , ...(3)
k!(n_k)!
parameters
J
Equivalently,we candefineBezierblendingfunctionswith the
x(u)= Ie*.s&(") calculation
recursive
K=0

j
THREEDIMENSIONALCONCEI.'iS 2.21
2.20 GMPHICSAND MULTIMEDIA
Figure2.12demonstratesthe appearance of someBeziercurves
BEZk,^(u)= (t-u)nEZu,"_,
(u)*uBEZu_,,"_,
(u), for variousselectionof controlpointsin thex y plane(z : 0).
n>k>1 ...(4) . Beziercurvesareusedin paintinganddrawingpackages
aswell
:
With BEZhu u*,and BEZo,u 11 u)k : - asCAD systems,sincetheyareeasytoimplementandtheyare
. Vectorequation( I ) represents
a setofthreeparametricequations powerfulin curvedesign.
for the individualcurvecoordinates: Properties of Bezier Curves
. A very usefulpropertyofa Beziercurveis that it alwayspasses
x (u) = i xuBEZu,,
(u) throughthe first and last control points. i.e., the boundiry
k=0 conditionsatthetwo endsofthe curveare
+. P(0) : Po
y(u) = )vuBEZu,(u)
k=0
"-.(s) P(1) : P.
..3.
z(u) = )zuBEZn,.(u) Valuesofthe parametricfirst derivativesof a Beziercurveatthe
k=0
endpointscanbecalculitedfrom controlpoint coordinates as

As a rule,a Beziercurveis a polynomialofdegreeonelessthan P'(0) = -nPo+nPr


thenumberofcontbl pointsusedthreepointsgenerateaparabola P'(l) = -nP,-, +nP,
four pointsa cubiccurveandsoforth.
Thus,the slopeat the beginningof the curveis alongthe line
P.
h, P.
,' joining thefirsttwo controlpoints,andtheslopeattheendofthe
)P,
' ," I curveis alongthelinejoiningthelasttwoendpoints.
's1 ,f^fr1'
t r
Similarly,theparametricsecondderivativesofa Beziercurveat
the endpointsarecalculatedas
P2 t,'
p!'
(c) p " ( o )= n ( n- r ) [ ( p ,- p , ) - ( p ,- p . ) ]

P'(l) = n(n-t)[(n.., -p,-,)-(p'-'-p")]


AnotherimportantpropertyofBeziercurveis that it lieswithin
theconvexhull ofthe controlpoints.This is from theproperties
l f
pl ofBezierblendingfuiictions.Theyareall positiveandtheirsum
(d) (e) is alwaysl.

Figure2.12
2.22
GRAPHICS
AND MULTIMEDIA
THREEDIMENSIOI.IAT
CONCEPTS 2.23
. n

lvnzu.,(u)= r
k=0

' Any curveposition in simprythe weighted


sumofthe contror-
pointpositions.
. The convexhull
property for a Bezier curve ensures
that the
polynomialgmoothryfoilowsthe
controrpointswithouterratic
oscillations.
Bezier Surfaces Figure2.13
. Two setsoforthogonal Beziersurfaceshavethe samepropertiesasBeziercurvesand
Beziercurvescanbe usedto designan
they provide u cinnenient method for interactivedesign
objectsu.rface
by speciftingby an inputmeshofcontrol points.
applications.
' Theparameteric vectorfunctionforthe Beziersurfaceis formed For eachsurfacepatch,we canselecta meshofcontrol points in
astheCastesianproductofBezierblendingfunctions: the xy 'ground' plane;thenwe chooseelevationsabovethe
groundplanefor thez-coordinatevaluesofthe controlpoints.
P(u,v) = i i Pj,kBEzj,-
'"' (v)eezu,,(u) Patchescan then be pieced togetherusing the boundary
irixE
constraints.
Wlh P,,uspecifyingthelocationofthe (m + l) 2.2.6 B-SplinesCurves and Surfaces
by (n + l) control
points. B-Splineshavetwo advantagesover Bezier splines:
. Figure2. l3 illustrates I . Thedegreeofa B-splinepolynomialcanbesetindependently
two Beziersurfaceplots.
- The controlpointsare of thenumberof contol points.
connectedby dashedline.
2. B-splinesallow localcontrolovertheshapeofa splinecurve
- The solid linesshowcurves
ofconstantsu andv. or surface.
- Eachcurveofconstant B-SplinesCurves
u isprottedby varyingv overtheintervar
from 0 to l, with u fixedat oneofthe varuesin this ' Thegeneralexpressionfor thecalculationofcoordinatepositions
unit intervai.
- CurvesofconstantV areploffed alonga B-splinescurvein a blendingfunctionformulationas
similarly.

P(u) = Itu " u . u ( u ) ; u r .( u S u . * , 2 < d < n + l


K=0
2.24
GRAPHICS
AND MULTIMEDIA THREE
DIMENSIONAL
CONCEPTS
2.25
the Puare an input set of n*l
{ere
^ spline control points. The B- B-splinecurveshavethefollowingproperties:
blendingfunctionsB.0 arepolynomials
of degreed_I, 1' The polynomiarcurvehasdegreed- r and
whereparameterd can bectrosen - cd-2
continuity over
to beany intege,uur'.' in rrr.
rangefrom 2 upto the number therangeofu.
ofcontrol points,n*l .
' Blendingfunctions 2. Forn+l controlpoints,thecurveis described
for B-splinecurvesareformulated with 4+ I blending
asfollows: functions.
B u , , ( u=) { l ' i f . u u< u ( u r * , 3' EachblendingfunctionB.o is definedover
d subintervals
ofthe
[0, otherwise totalrangeofu, startingat knot valuertr.
4. Therangeofparameteru is dividedinto n+d
B.o(u) = ur*a-u subintervars
bv the
'- B , . . . (u) n+d+l valuesspecifiedin theknC vector.
* *f,+c-r
B u , o-k
-,(u)a u;;5**''o-,
where eachbrendingfunction 5. With knotvalueslabeledas
is definedoverd subintervars {uo,ur, ....., uo*6},
theresultingB_
thetotal rangeofu. of splinecurveis definedonly in the intervarfrom
knot valueuo-,
' ' The uptoknot valueu,*,.
serectedsetof subintervarendpoints
u is referredto asa 6. Eachsectionofthe sprinecurve(between
knotvector. two successive
knot
values)is influencedby d controlpoints.
t?
I t 7' Any onecontrol point canaffectthe shape
\l I of at mostd curve .
I
sections.
' B-splinecurverieswithin
theconvexhuil ofat mostd+l control
points,sothatB-sprinesaretightryboundto
theinputpositions.
l l . Foranyvalueof u in
theintervalfrom knot value
-- uo_,
-d-rto
-- un*,,
-n+rthe
l l
1l
'sumoverall
tl basisfunctionsis l.
a I
(a)
(b) .\
Figure2.l4 (u) = I
) Bu,o
k=0
Figure2'r4 showsthe rocarcontror
characteristics
ofB-sprines. 2.3 Three DimensionalGeometric and
In additionto rocarcontror,B-sprine Modeliirg
arows to varythenurnber Tranformations
ofcontrol points usedto design
a curvewitt out changingthe Geometictansformationsandobjectmodetingin
dgree ofthe polynomial.Anf threedimensions
numberofcontrol pointscan areextendedfiom twodimensionarmethodsby
addedormodified to manipulate be incrudingconsiderations
curveshapes forthe z-coordinate.
2.26 THREE
DIMENSIONAT
CONCEPTS
GRA?HICSAND MULTIMEDIA 2.27

2.3.1 Translation . Inverseofthe translationmatrixin equation(l) canbeobtained


by negatingthetranslationdistancest*,t, andt . /
In a threedimensionar homogeneous coordinaterepresentation,
a point or anobjectis transrated This producesa translationin the oppositedirectionandthe
from positionp = (x, y, z) to position
P' = (x',y,,2,) withthematri* productofa translationmatrix and its inverseproducesthe idenlity
op"*tion.
matrix.
2.3.2 Rotation

(or)
[][;til|'
P' = T.p
...(
r)
' To generatea rotationtransformationfor

'
an obiectanaxis of
rotationmustbedesignedto rotatetheobject*itn. a-o*iof
angularrotationis alsobe specified.
Positiverotationanglesproducecounterclockwiserotations
Parameterst abouta coordinateaxis.
,h."";;;;;;;";;#,1#li,';'*':uj:-":f;:'::TJ::ffi
l: Co-ordinate Axes Rotatlons
(Figrire2.t5).
The 2D z axisrotationequationsareeasilyer<tended
to 3D.
. The matrix reDresenfrfinn
presentationin
i- o^,,*
equation (l) in equivalentto the xt x cos0- y sin0,
threeequations.
v' xsin0+ycos0 ...(2)
1'_ X*t^,
z' z
Y'= y*tr,
Parameters 0 specifiesthe rotationangle. In homogeneous
7t _ z*trt
coordinateform, the3D z axisrotationequationsareexpressed
as
y axts
-sin0 0 0l
[*'l fcos0 lxl
lv'l J s i n Oc o s 00 o l l u l
l ' ' l =ol o r ' l l ; l
L'] [o o or]LrJ
Whichwe canwrite morecompactlyas
p'= Rr(O).p
...(4)
Figure2.l5
2.28
GRAPHICS
AND MULTIMEDIA
Figure2.15 illustratesrotation THREE
DIMENSIONAL
CONCEPTS 2.29
ofan objectaboutthez axis.
Rotationofan objectaroundthex-axisis demonstrated
in fizure2.17.

Figure2.l6
Figure2.17
Transformationequations
for rotation about the other Cyclicallypermutingcoordinates in equation(6) givethe
coordinateaxescan be obtained two
with a cycricpermutation transformation
equation
foray axisrotation.
coordinateparameters of the
x, y and, in "quutio;A)
replacements ;;:;"r. ,n, z'= zcosO-xsin0l
' x'= zsinO+xcos0f
x-+y*)z_+x
y,=y "'(e)
...(s) -J
Thematrii representation
for y-axisrotationis
:::Tl:T_-T::rmutations(5)inEquationlz;,wgettr,liluution,
foran x-axisrotation:
[r'l I cosO 0 sinO ol [*l
l ' ' l = [o 0r c oo s ool l' ll' lr l ...( 10)
Y , =ycos0-zsin0l
z ' = ysin0+r"ore
i ...(6) lr'l l-sine
x )
L'J I o
x t =
o o r.llr.l
Whichcanbbwrittenin the
homogeneous (or) P' = R, (0).P
coordinateform
An exampleofy axisrotationis shownin figure2.1g.
f*'l fr o 0 ol f.l
ly'l lo coso 0
-sin oll'l
l ' ' l = l or i n ecos0 oll.l ot
LrJ lo o 0 ' JL ' J
(or) P' = R.(o).p
...(8)

Figure2.l8
2.30 GRAPHICS
AND MULTIMEDIA 2.31
THREE CONCEPTS
DIMENSIONAL

' An inverserotationmatrix is formedby repracingthe rotation 3 . Translatethe objectsothat the rotationaxis is movedbackto its
angle0 by-€. originalposition.
' Negativevaluosfor rotationangresgeneraterotations
in a Whenanobiectis to berotatedaboutanaxisthatis notparallel
clockwisedirection,sotheidentitymatrixisproducedwhen t )rnenfthe cnordinate axes, we need fo perFnrm srime additio,nal
any
rotationmatrixis multipliedby its inverse. langfpnations.
' sinceonlythesinefunction
is affectedby thechangein signof In suchcase,we needrotationsto aligntheaxiswith a selected
- therotationangre,the
inversematrix canarsobe obtainedby coordinateaxis and to bring the axis back to its original
interchangingrowsand corumns.(i.e.)we cancarcurate orientation.
the
inverseof any rotationmatrix R by evaruatingits transpose
fortherotationaxisandtherotafionangle,
Giventhespecifications
(R'r : ftr;.
we canaccomplishtherequiredrotationin five steps:
gene.A fnreeOtme
l . ___ theobject
Translate
' A rotationmatrix for any
axis that doesnot concidewith a coordinateorigin.
coordinateaxis can be setup as a compositetransformation
involvingcombinations.of translationsandthecoordinate
axes
rotations.
a
5. Performthe specifiedrotationaboutthat coordinateaxis.
backtoitsoriginal
4 . Apply inverserotationsto bringtherotationa><is
-zr. Seftingupthetpnsformationsequence thatmovestheselected orientation.
rotationaxisontooneofthe eoordinate
axes.
5 . Apply theinversetranslationto bringtherotationaxisbackto is
4. Thensetuptherotationmatrixaboutthatcoordinateaxis
forthe originalposition.
ed rotation angle.
./lpecifi 2.3.3Scalin_e
'3. obtaining the inverse
transformationsequence that retumsthe . Themaftixexpression ofa position
forthescalingtansformation
rotationaxisto its originalposition.
=
P (x,y,z) relativeto thecoordinateorigincanbewrittenas
' In thespecialcasewhere -]
anobjectis to berotatedaboutanaxis
til
that is parallelto oneofthe coordinateaxes,we canattain
desiredrotationwith thefoilowingtransformation sequence :
the
[.'l li :,::l
l;:l=L:: ;"llf;l
\''j
I . Translatethe objectsothatthe rotationaxiscoincides
paralleI coordinateaxis.
with the
L'j L;j
...(11)
Ir
2. Performthe ipecifiedrotaticjnaboutthataxis.
2.32 GRAPHICS
AND MULTIMEDI, THREE CONCEPTS
DIMENSIONAL 2.33

(or) P' = S.P ...(r2) 3. Translatethefixedpoint backtoitsoriginalposition.


Wherescalingparameters
sx,suands,areassignedanyposition oftransformationis showninfigure2.2}.
This sequence
values.

4*,
Explicit expressionsfor thecoordinatetransformations
for scaling (xr,yr,zr)
relativeto theorigin are 'a-a

X
xt *'r.l (a) (b)
y' v . sl , . . .l(3 )
z' x'srJ

Ifthe transformation (c) (d)


parameters
arru! eqlel, relative-dimensioUq
i @ d . - s Figure2.20
Theoriginshapeofthe objectispreserved
with a uniformscaling . Thematrixrepresentationfor anarbitaryfixedpointscalingcan
(s*: s, s). (Figure2.19)showstheresultof scalinganobject be expressedas the concatenationof the translate-scale-
uniformlywith eachscalingparametersetto 2. translatetransformationsare
T (xn yp zr) . S (s*,su,s,) . T (-xp -y na) :

tL s x 0 0 (t-s*)xrl
h^^'Plv
- Q
.' 0^-i
ls o t r o (r-.,)v,I
Figure2.lg
0 0 s z (t-1.),,1 ...(14)
0 0 0
Scalingwith respectto a selectedfixedposition (xnynz)can be
represented Inversescalingmatrix m formed by replacingthe scaling
with thefollowingtransformation r"qu.n.",
parameters
s*,s, ands"with theirreciprocals.
l . Translatethe fixed point to the origin.
, - t
ftn,
Theinversematrixgeneratesanoppositescalingtransfo
r
2 . Scaletheobjectrelativeto thecoordinateorigin usingequation ,

eproduces
(ll). the identitv matrix.
2.34
GRAPHICS
AND MUTTIMEDTA THREE
DIMENSIONAL
CONCEPTS 2.35
2.3.4 Other Transformations
Reflections
'-F---.GqraF

a
@
qrtserwithrespect
tbu r",".,"#on
- - . - . x -
o Shearingtransfori'natibnsare
' usedto modify object shapes.'
Reflectionrerativeto a given
axisareequivarent
to r g00rotations ' They arealsousedin three
abouttheaxis. dimensionarviewing for obtaining
generalprojectionstransformations.
. Whenthe
reflectionplanein a coordi Thefollowingtransformation
producesa z-axisshear.
v,)thenthetransrormation
canr; ; ff:HfJ;ff:};
handed
andrighrhandedsystems. H:
. An example ir 0a ol
ofa reflectionthatconverts
coordinatespecifications SH, = lo
lb ol
handed'v't"t
tourrt-r,-dedsvstem ol
ffn::Ht rrrr,o*nin l0 l0

' Thistransformation
Lo 0 0 rl
changesthesignofz coordinates,
. x andyboordinatevalues,u""n*j"0. reaves
the . Parameters
a andb canbe assignedanyreal values.
' Thematrixrepresentation 'Qhis transformationmatrix
for thisreflectionofpoints is usedto arterx andy coordinate
thexyplaneis rerativeto valuesby an amountthatis proportionalto the z value,and
thez
coordinatewill bechanged _
f r o o ol
* = ;l ;. "
7
' Boundariesofplanesthat
areperpendicularto the z axisare
0l shifted by an amountproportionalto z figure 2.22 shows
0l effectof shearing
the
matrixon a unitcubefor thevaruesa = b - r.
1 0 0 0 IJ

Reflection
relative{o the
XY plane
X:>
(a)
Figure2.2l
Figure2.22
2.36
GRAPHICS
AND MULTIMEDIA THREE
DIMENSIONAL
CONCEPTS 2.37
2.3.5 CompositeTransformations
. Compositetransformationcanbeconsftuctedwith thefollowing
functions:
composeMatrix3 \/
ilr thetransformation
sequence.
buildTransformationManix3/ /
This concatenationis carriedout from right
to left, wherethe composeTransformationMuur*d
right mostmatrix is the first transformation
to be appriedto an . The order of the transformation sequence
objectandtheleft mostmatrix is thelasttransformation. for the
buildrnansformationMatrD<3 & composeTransformation Matrix3
$sequenceofbasig, ratien, functions,is thesameasin 2 dimensions:
{
l) scale. 2) roete and 3) tqpslate
. OnceJt.unrfor-ation matrix is specified,the matrix
canbe
2.3.6 Three DimensionalTransformation
Functions appliedto specifiedirointswith
Someofthe basic3D transformationfunctionsare: transformPoint3(inPoint,matrix,outpoint)
translate(translateVector,
matrixTranslate) ' Thefiansformations for hierarchicalconsftuctions
canbesetusing
rotateX(thetaX,xMatrixRotate) structureswith thefunction
sefl.ocalTransformation
3 (matrix,type)
rotateY(thetal yMatrixRoA!e),
whereparametermatrix specifiesthe elementsof a 4 by 4
rotateZ(thetaZ,zMatrixRotate).
transformationmatrix,andparametertype canbeassignedone
scale3(scaleVector,
matrixScale), ofthe valuesof: preconcatenate,
postconcatenate,
or replace..
' Eachofthesefunctionsproducesa4by 4transformation 2.3.7 Modeling and CoordinateTransformations
matrix
thatcanbe usedto transformcoordinatepositions .
expressed
as Jn mo.deling,o!&gll4ry_dgpqbed in a local (modeline)
homogeneous columnvectors. coordinatereferenceframe,ttrentheobiectsar ed
' Parametertransratevecior is a pointerio the rist i@
oftransration
distancestn,t, andt.. . Forinstance,
lables,chairsandgtherfumiture,eachdefinedin a
Parameterscalevectorspecifiesthethreescalingparameters R into the descriptionofa
s*o t
s, and s".
@m coordinates.
Thentheroommight
Rotateandscalematricestransformobjectswith respect be transfor*.d lntoffii"onstructed
to the in world
coordinateorigin. coordinate.
2,38 GRAPHICS
AND MULTIMEDIA / THREE
DIMENSIONAL
CCJNCEPTS 2.39
Threedimensionalobjectsand scenesareconstructedusing
structureoperations. Whichtranformsunit vectorsu* , uy and u, ontothex, y and
;
l
z:rxesrespeciively.
object descriptionis transformedfrom moderingcoordinateto I
world coordinateorto anothersystemin thehierarchy. ) ' The completecoordinate-transformation
sequence
is given by
)
the compositematrix R.T.
)f
I This matrix conectly transformscoordinatedescriptionsfrom
j
I
I onecartesiansystemto anotherevenifone systemis left-handed
' I andtheotheris right handed.
Transformationmatix hasto besetupto bringthetwo coordinate i
systemsintoalignmenf )

- First'aJranslationis setup to )
bring thenew coordinateorigin I
I

to thepositionofthe othercoordinateorigin. {I
I
- Thena sequenceotatartiansare I

madeto thecorresponding
coordinateaxes. \

- Ifdifferent gules areusedin the


l
two coordinatesystems,a ) Figure2.23
scalingtransformationmayalsobenecessary
forthe differencesin coordinateintervals.
to compensate {.z.o
In threedimensionalgraphicsapplications,
. Ifa secondcoordinatesystemis r
definedwith origin(xo,yo,zo)
- we canview anobjectfrom any
andunit axisvecton asshownnfigure2.23, relativeto anexistin! gpatialposition,from the
cartesianreferencefiame,thenfirst conshucttlretranslationmatrii 84, @e orAqnihe back.
T (-xo, -yo,--zo),thenwe can usethe unit axis vectorsto form -
dve could generatea view ofwhat we couldseeifwe were
the coordinaterotationmatrix itanding in the middleof a groupof objectsor insidea
singleobject,suchasa building)
f u., u*2 u-, 0l 2.4.1 YiewingPipeline
R _|
,,' ul, uI, o
';' u'.2u,, o l'
In the view ofa threedimensionalscene,to takea snapshotwe
| i needtoypthe following steps.
L0 0 0 lJ -/
..Y Positioningthecamera at a particularpointin Jpuc".
2.40 GRAPHICS
AND MULTIMEDIA DIMENSIONAL
CONCEPTS

(i.e.)pointingthecameraand
rotatingit aroundthe line of right to setup the directionfor the Specifiyingtheview plane
ryfire.
y'wn." .""n tlr" .l.,,'tq the sceneis croppedto the sizeofthe
'window'
ofthe camera,and light from thevisiblesurfacesis
I"
projectedinto the camerafi lm.
In such a way figure 2.24 showsthe three dimensional
IL,,
Po=(xo,yo,zo)
transformationpipeline,from modelingcoordinatesto final device
coordinate.
Figure2.25
The view for a sceneis chosenby establishingthe viewing
coordinatesystem,alsocalledtheview reference coordinate
system(figure2.25).
Projection Workstation
transformation transformation A gggp* or projectionplaneis set-upperpendicularto the
viewineZ
- c = axis.

ProcessingSteps Worldcoordinate
positionsin thescenearetansformedto viewing
- coordinates,
thenvjgwins coordinatesaren1g_iglteclrto
theview
l. Oncet\e scenehasbeenmodeled,world coordinatepositions
plane.
areconvertedto viewing coordinates.
Th. ylewrefeIgllcelqillljs a world coordinateposition,which
2. The{ip:ryingcoordinare
systemisusedin graphicspackages
asa
is the originofthe viewingcoordinatesystem.It is chosento be
ref,erence
for speciSingthe observerviewing positionandthe
closeto or on thesurfaceof someobjectin a scene.
positionofthe projectionplane.
J. Projectionoperationsare performedto convertthe viewing Thenwe selectthepositivedirectionfor theviewingZ axis,and
c-oodinde Oescript the orientationofthe view planeby specifyingtheview plane
n
the proiection normal vector, N. Here the world coordinateposition
f,lane,which will thenbe mappedto theoutput
device. establishesthedirectionforN relativeeithertotheworld origin
or to theviewingcoordinateorigin.
4. Objectsoutsidethe viewing limits are clippedfrom further
consideration, andtheremainingobjectsareprocessed Thenwe selecttheup directionfor theview by speci$inga vector
thrbugh
visible surfaceidentificationandsurfacerenderingprocedures V calledtheview-upvector. Thisvectoris usedto establishthe
to
producethe displaywithin the deviceviewport, positivedirectionforthe y.,axis.
2.42 GRAPHICS THREE
DIMENSIONAL
CONCEPTS
AND MULTIMEDIA 2.43

fhansformation for world to viewing coor{inate * v=nxu=(v,,vr,vr)


' Beforeobjectdescriptions This methodautomaticallyadjuststhe directionfor v, sothatv is
canbeprojectedto the view prane,
theymustbetransferredto viewingcoordinate. perpendicularto
n.
Thistransformation
sequenceis Thecompositerotationmatrixforthe viewingtransformation
is
^-
-)lTranslate the viervreferencepointto lhe oriein ofth u2 u3 0l
fu,
vz v3ol
R=lu'
, andzu*9r*t theworld nz n30l
x*. y.-andz* ave ln,
' L0 0 0 ll
Ifthe view referencepoint is specfiedat worrdposition
(xo,yo,
zo),this point is transrated
to theworrdorigin with the -uoi" Which transformsu into theworld x axis.v ontothe v axis.
tansformation. andnontothez* axis.
. Thecompleteworld-to-viewingtansformationmanix is obtained
fr o o -*,.l asthematrixproduct.
r=lo I o -Y'l
Mr..u" : R' T
l0 0 t -zol
lo o o r.j This transformationis appliedto coordinatedescriptionsof
objectsin the sceneto transferthemto the viewing reference
. The rotation sequence frame.
can requireup to 3 coordinateaxis
rotations,dependingon the directionchosenforN.
,2.4.3 Projections
Anothermethodfor generatingtherotationtansformation
matrix Onceworld coordinatedescriptions
ofthe objectsareconverted
is to calculateunit uvn vectorsandform thecomposite
rotation to viewingcooidinates,
we canprojectt[e 3 dimensionalobjects
matrixdirectty--'
intothetwo dimensionalviewplane.
Given vectorsN andV, theseunit vectorsarecalculated
as Therearetwo typesofprojection-
N 1. Parallel projection - Here the coordinatepositionsare
n - , _ = (nr,nrrnr)
lNl @ planealongparallellines.
VxN 2..Perspectiveprojection ; Here, object positionsare
l v x NI transformedto theviewplanealonglinesthatconvergeto a
point calledthe projection referenccpoint.
2.44 THREE
DIMENSIONAL
CONCEPTS 2.45
GRAPHICS
AND MUTTIMEDIA

Theorthographicprojectionthatdisplaysmorethanonefaceof
@. Parallelprojectionsis specifiedwith a projecti6n vectorthat
anobject is calledgronomelri$ orthograph
ic projections.
Themostcommonlyusedaxonometricprojectionisj!$omesrc
definesthedirectionfor theprojectionlines.
projection.
lt canbe generatedby aligningtheprojectionplanesothat it
intersectseachcoordinateaxi3in wli'ichtheobjectis definedas
the samedistancefrom the origin. (Figure2.28). '
(x,y,z)
a

jection

Figure2.26
Orthographic projection
iectionsare usedto producethe front, side
andtop viewsofan object. (figwe2,27)
. Front,sideandrearorthogfaphicprojectionsofan objectare Figure2.28
calledelevations: Transformation parallelprojection
equationsfor anorthographic
a Atop orthographic
projectioniscalleda planview. arestraightforward. . t
a Thisprojectiongivesthemeasurementillenffi andangles lf the viewplaneis placedat positionz* alongthez, axisthen
accuratelv. any point (x, y, z) in viewing coordrftes is transfbrmedto

Wherethe original z coordiantevalue is kept for the'depth


informationneededin depth cueing and visible surface
procedures.
determination
Oblique Projection
. An obliqueprojectionin obtainedby projectingpointsalong
parallellinesthatarenot perpendicular
to theprojectionplane.
Figure2.27
I

2.46
GRAPHICS
AND MUTTIMEDIA THREE
DIMENSIONAL
CONCEPTS 2.47
a
In figure2.29, uand are
$ two angles. WhereL, is the inverseoftan o, which is alsothe valueof L
a
Point (x, y, z) is projectedto whenZ: l.
position(xr, y/ on the view
plane.
. The obliqueprojectionequation(l) canbewrittenas

,',*?.-_-_-_
--n
9.
Thetransformationmatrix for producinganyparallelprojection
ontothex"y"planeis

Ir 0I L,cos$ ol
:l
Figure2.29
L, sin$
.
Theobliqueprojectionline from (x,y,z)to
(xo,y/ makesan
Mp.rll"l = lo 0 l
*nn thelineon theprojection
planethatjoins(xo,y/ and
l0 0 0 1J
il*;" L0
' line oflengthL in at anangle An othographicprojectionis obtainedwhenL, :0 (whichoccurs
Ihlt Qwith thehorizontaldirection {' -
in theprojectionplane. ataprojectionangleoofgOo)
. . Obliqueprojetionsaregenerated
with nonzerovaluesfor L,.
coordinatesareexpressed
in termsofx, y, L and
;::Otection
PerspectiveProj gfions
-
X o: X *Lcos . To obtainperspectiveprojectionofa 3D object,we transform
. . .( l )
Yo=Y+Lsin0 pointsalongprojection
linesthatmeetattheprojectionreference
LengthL dependson the point.
anglecrandthe z coordinate
pointto beprojected: of the . Ifthe projectionreferencepoint is setat positionz*alongthe z,
axisandtheview planeis placedatz. asin fi gure2.39,we can
tana=Z write equationsdescribingcoordinatepositionsalong this
L prerspectif.projectioulinein parametricform as
Thus €
-/'
x' = X-Xu

, = - = ZZ L ,
L d=
J
r-u
J JU
-/

tan c, I
//
,1 ..'
2.48 GRAPHICS (04/'
AND MULTIMEbh
THREE
DIMENSIONAL
CONCEPTS --Z--.'-' 2.49
Parameteru takesvaluesfrom 0 to l, andcoordinate
position
( X' , Y', z') represents
anypointalongtheprojectionline.
l 0 0 0
Whenu : 0, thepoint is at p: (x, y, z).

i;:l0 0 = % ,'-('%,)
a
0 l
a
At the otherendofthe line, u: I andtheprojection
f,.l
0 0
reference lvl
point coordinates(0, 0,
7 ).
Onthevieuplanez' - .. andz,can besolved
u at this positionalongtheprojectionline:
forparameter Lrl0 0 -%, '%,l ' l LIJ

P=(x,y,z) ln thisrepresentation,
thehomogeneous
factoris d
o- -ozwol&
--L*7
7 - - 7 / Y
h=-PrP ewtlX
de -I
tI
andtheprojectioncoordinateson theview pranearecalcurated
View plane from thehomogeneous coordinatesas
xp:Vh
Figure2.30
Yo: Yft
Substitutingthis
valueofu intotheequations
for x, and y,, we wherethe originarz coordinatevarueretainsin projection
obtaintheperspective
transformation
equations. coordinatesfor depthprocessing.
r zr"o-2,
- \ / or
, \
*o = *l 2.4,4 Three DimensionalViewing Functions
=
I *[ I
\zr*-z
) \.r*-. ) l. with parameters specifiedin worrdcoordinates,
erementsofthe

=r[#)
,,=,(ffiJ ...(2)
matrix for transformingworrd coordinatedescriptionsto the
viewingreferenceframearecalculatedusingthefunction.
evaluateMewOrientationMatrix3
(xo,yo,zo,xN, yN, zN, xy yV
where z.nis the distanceof the viewplanefrom '
!o:.n- the zV,enor,viewMatrix)
proJectlonrefbrencepoint.
- This fi.rnctioncreatestheviewMatrix
from inputcoordinates
Usinga 3D homogeneous coordinaterepresentationwe canwrite definingtheviewingsyskm.
theperspective-projection
transformation(2) in matrix form as - Parameters
Xo,yo,
zospecifythesignofthe viewingsystem.
2.50
GRAPHICS
AND MULTIMEDIA THREE
DIMENSIONAL
CONCEFTS 2.51
.= Worldcoordinate
vector(xN, yN, zN) definesthenormal - posibnsabng ihevbo lngz,axis
to for&refrontandbackplanes
theviewplaneandthe directionofthe
positivez..viewine ofthe view volumearegivenwith parametersz front andz
axis.
back.
- Theworldcoordinate
(xV,yy,zy)gives theelements - The errorparameterrefurnsan
ofthe integererror codeindicatine
viewupvector.
erroneousinputdata.
- An integererror
codeis generatedin parametererror 2.5 Color Models
if input
valuesarenot specifiedcorrectly.
color Model is a methodfor explainingthepropertiesor behavior
2' Themllrix nroj matrix for transforming
viewingcoordinates to ofcolor within someparticularcontext.
normarizedprojectioncoordinatesis
createdwith thefunction,
2.5.1 Propertiesof Light
evaluateVewMappingMatrix3
Qcwmin,xwmax,ywmin,lAtranax, ' - Lrght ls a narrowfrequency
xvmax, yvmin, yvmax, nmin,^rnu*, p.o;Typ", bandwithin the electromagnetic
5vmin,
xprojRef yprojRee zprojRef zview, system.
zback,rrrlnt, "oor,
projMatrix) ' other frequencybandswithin this spectrumare calledradio
- Window limits waves,micro waves,infraredwavesandx_rays.Figure2.31
on the view plane are given in viewing
coordinateswith parametersxwmin, showsthe frequencyrangesfor someof the electromagnetic
xwmax,ywmin and
ywma)( bands.
- Lirnits ofthe 3D
viewportwithin theunit cubeare
setwith t-
normalizedcoordinatesnrmin, xvmax,yvmin,yvmax,zvmin e E g b
andzvmax. E EZ Sl s ^ E
. E t . t o ' ; g
- ParameterprojType
is usedto choosethe projection
type |t
= F c € E sf
<-,->?9._r
eitherparallelor perspective. t ,t r l l l l l l F|<H<---}
r e q u e n c y
- Coordinateposition tH-"rti'
(xprojRefiyprojReezprojReD
setsthe
projectionreferencepoint. Thispoint Figure2.3l
is usedasthecenterof
projectionifprojType is setto perspective,
otherwise,this Eachfrequencyvaluewithin thevisible bandcorresponds
to a
pointandthecenterofthe vieuplane
windowdefinetheparallel distinctcolor.
projection vector.
At the fow frequencyend is a red color (4.3 x lOaHz) andthe
- Thepositionofthe
viewpranearongtheviewingz, axis highestfrequencyis a violet color (7.5 x I 0r4tIz).
is set
with parameterzview.
z- g*:vd+o;'J'fry
C,hvena6*

2.52 AND MULTIMEDIA


GRAPHICS
CONCEPTS
DIMENSIONAL
THR,EE . 2.53
Spectralcolors rangefrom the redsthrough orangeandyellow - Purity describeshow washedout or how 'pure' the color of
-.---
at the low frequencyendto greens,bluesandviolet at thehigh the lightappears.
end.
- PastelsandPalecolorsaredescribedas lesspure.
Sincelight is an electromagneticwave,the variouscolorsare
. The term chromaticity is usedto refercollectivelyto thetwo
describedin termsofeitherthe frequencyforthe wavelengthl"
ofthe wave.
Two differentcolor light sourceswith suitablychosenintensities
The wavelengthandfrequencyof the monochromaticwaveare
canbe usedto producea rangeofother colors.
inverselyproportionalto eachother,with the proportionality
constantsasthe speedof light C. Ifthe 2 color sourcescombineto producewhite light, they are
calledcomplementarycolors. Eg. Redandcyan,greenand
C : l f
magenta,andblue andyellow.
A lightsourcesuchasthesunoralightbulbemitsall frequencies
describecombinationsof light in
withinthe visiblerangeto producewhite light. Whenwhite light
is incidentuponan object,somefrequenciesarereflectedand
of colors.calledthecolorsamut.
some are absorbedby the object. The combination of
frequenciespresentin the reflectedlight determineswhat we . The 2 or 3 colorsusedto produceo,thercolorsin a color model
perceiveasthe color ofthe object. arecalledprimary colors.
arepredominantin thereflectedlighgtheobject
Iflow frequencies 2.5.2 StandardPrimaries
is describedas red. In this case,the perceivedlight [as the XYZ Color Modet
dominant frequency at the red end of the spectrum. Th.e
thecolorof The set of primaries is generallyreferredto as the W or
(W color modelwhereX, Y andZ representvectorsin a
thelidtt.
3D, additivecolor space.
Any color Cl" is expressedas

. Intensityiratheradiantenellgremittedper limit time,perunit solid


(Txl = XX+YY+zz "'(l)
\_--l
angle,andper unit projectedareaofthe source. Where X, Y and Z designatesthe amountsof the standard
primariesneededto matchCl".
It is convenientto normalizetheamountin equation(1) against
luminanceCX+ Y + Z). Normalizedamountsarecalculatedas
2.54
GRAPHICSAND MUTTTMEDIA
e9
THREE
DTMENSIONAL
CONCEPTS
2.55
v -_ - . x V = -
v- -
X+y +Z' - X+y+Z.,
o- Thesevisualpigmentshavea peaksensitivity
at wavelengths
of
about630nm (red),530 nm (green)and450
withx*y+z : I nm (btue).
Any color can be represented,with By comparingintensitiesin a rightsource,we perceive '
just thecolor
the x andy amounts. ofthe light.
3:f::"t1* {u"a,fare calted
ihecrrromaticity
vatues
Decause theydependonlyonhrieandpu.ifr This is thebasisfor displayingcororoutput
on a videomonitor
If we specifu colors only with usingthe 3 colorprimaries,red,greenandblue
x and y, we cannotobtain the referredto asthe
amountsX, yand Z. So,acomplete RGB color model. It is representedinfigure 2.32.
descriptionofa color in
givenwith the3 values
4l1nay

X:IY z = zy
v ' v
wherez:l_x_y
2.5.3 Intuitive Color Concepts
Colorpaintingscanbecreated
bymixing colorpigmentswith
white andblackpigmentsto form
thevariousshades,tints and
tones.
startingwith thepigmentfor a 'pure Figure2.32
coror',thecoloris addedto

$#* black pigmgnt to producedifferent


pigmentproducesdarkershades.=
qb3|*, The more black The sign representsblack, and the vertex
(1, l, l) in white.
with coordinates

Differenttints ofthe colorareobtained Vertices'ofthecubeon the axesrepresentthe primary


w,v' to theoriginalcolor,makingit
by addinga whitepigment
lighterasmorewhite is added. therernainingverticesrepresent
the'complementary
colors,
cororfor each

\il,,,
Tonesofthe colorareproduced ofthe primarycolors.
by addingbothblacka"O*ii,"
pigments.
TheRGB colorschemeis anadditfuemoder.(i.e.)
Intensitiesof
RGB Color Model theprimarycolorsareaddedto produceother
colors.
Basedon the tristimulus theory Eachcolorpointwithin ttreboundsofthe cube
ofvision, our eyesperceive canberepresented
colorthroughtlrestimurationofthree asthetriple (R, q B) wherevaluesfor R, G and
visu,ar
pigmentsin thecones B areassigned
ofthe retina in the rangefrom 0 to l.
GRAPHICS
AND MUTTIMEDIA THREE
DIMENSIONAL
CONCEPTS 2.57
. The color Cl,
is expressedin RGB componentas . An NTSC Mdeo Signalcanbeconverted
to anRGB signalusing
CI" =.RR+GG+BB an NTSC decoder,which seperates
the video signalinto yle
' '
Themagentavertexis obtained components,
thenconvertstoRGB values,asfollows:
by addingredandbrueto produce
thetriple.( l, 0, I ), andwhite
at (1, l, l) in the sumofthe red,
yl
greenandbluevertices.
, [*l = fr ooo-0.272
0.e56o 620
l f
-0.647 t
' shadesofgray o r.oo0
arerepresentedalongthe main I | | |l I
cubefrom the origin (black) to
the white vertex.
diagonarofthe
LB.j Ll.ooo_l.lo8 t.705
J Lal
2.5.5 yleColorModel 2.5.6CMY Color Model \J\!1f49,
' TheNationarTerevisionSystem
committee(t{rSC) corormodel
a
A color modeldefinedwith theprimarycolorscyan,magenta,
for formingthecompositevideo andyellow (CMY) in usefulfor describingcolor outputto hard
signalin theyle model.
^ UV copydevices.
Y4 t tfr. oR corormoder,ruminance
,.r (brightness)informationin
n(hueand It it "
@i.e) cyancanbeformedby adding
VrZi:ffi;iiJ
v ' A combination
greenandblue light. Whenwhite light is reflectedfrom cyan_
coloredink, thereflectedlightmusthaveno redcomponenti.e.,
ofred, greenandbrueintensities
arechosenfor red light is absorbedor substracted
theyparameterto yield the standard.luminosity by the ink.
culve.
' since ypontains Magentaink subtactsthe greencomponentfromincident light
theruminanceinformation,brack
andwhiteTV andyellow subtractsthe bluecomponent.It is representedin
monitorsuseonlytheysignal.

w
0,J6
ParameterI containsorange_cyan
hue informationthatprovides
theflash-toneshadingandoccupies
a bandwidthof 1.5Mr{,.
Parametere carries green-magenta
hue information in a
figure2.33.
M

V bandwidthofabout 0.6L/frIt.
An RGB signalcanbeconverted
to a TV signalusinganNTSC
Black
Gray
encoderwhich convertsRGB scale
valuesto yle values,asfollows.

frl
r = lo.zes
I I io.seo
0.587 o.t44l
4..27s -0.32t[Rl
I lo I
,#
Lai lo.zrz-0.528 o.3r
I J LBj Figure2.33

*f*ry
2.58
GRAPHICS
AND MULTIMEDTA THREE CONCEPTS
DIMENSIONAL 2.59
' In cMY moder,point (1, l, r) represents
brack,because
arl 2.5.7 HsvColorModel
componentsofthe incidentlight aresubtracted.
. TheHSV'modelusescolordescriptions
thathavea moreinteritive
. Theorigin represents
whitelight. appealto a user.'
. Equalamountsofeach
ofthe primarycolorsproducegraysalong . Colorparametersinthis modelarehue(H), saturation(S),and
themain diagonalofthe cube.
value(V).
. A combination
of cyanandmagentaink produces . The 3D representation
ofthe HSV modelis derivedftom the
blue light
becausethe red andgreencomponents
ofthe incidentrightrre RGB cube.Theoutlineofthe cubehasthe hexagonshape.
absorbed.
. The boundaryof.flreheiagon representsthevarioushues,andit
' Theprintingprocessoften usedwiththecMymodel generates is usedasthetop of the HSV hexcone(figure 2.34).
a colorpoint with a collectionof4 ink
dots;onedot iJusedfor
eachofthe primarycolors(cyan,magenta
andyellow) andone
dot in black.
. The conversion
from an RGB representationto
a CMy
representation
is expressed
as

lfl||til
wherethe white is represented
columnvector.
in theRGB systemastheunit

Similarrythe conversionof cMy


to RGB representation
is
expressedas Figure2.34
In thehexcone,saturationis measuredalonga horizontalaxis,
f*i = ['l fcl andvalueisalonga verticalaxisthroughthecenterofthehexcone.
l c I I 'l _ l v r J Hue is represented asan angleabouttheverticalaxis,ranging
LeJL'JLyl from 0o at red through 360". Verticesofthe hexagonare
whereblackis represented seperated by 60" intervals.
in thecMy systemastheunit corumn
vector.
2.60 GRAPHICS THREE
DIMENSIONAT
CONCEPTS 2.61
AND MUTTIMED

Yellow is at 60", green at 120" and cyan opposite Huespecifies


anangleabouttheverticalaxisthatlocatesachosen
red
H: 180o.Complementary colorsare l g0" apart. hue.

SaturationS variesfrom 0 to I . The maximumpurity In this modelH = 0" corresponds


to Blue.
at S =
at S: 0.25,thehueis saidto beonequarterpure, The remainingcolorsarespecifiedaround"the
at S:0, r perimeterofttre
havethe grayscale. coneinthesameorderasintheHsVmodel.

I
ValueV variesfrom 0 at the apexto I at the top. a Magentais at 60",Red in at l2}",and cyanin at H = 1g0".

a
- The apexrepresentsblack.

Atthe top ofthe hexcone,colorshavetheit maximum


WhenV: I and S = I we havethe ,pure,hues.
intensir
a The verticalaxis is calledlightness(L). At L: 0, we_have
black,andwhiteis at L: l. Grayscalein alongtheL axis,and
the"purehues"on theL:0.5 plane.
--1
a SaturationparameterS specifiesrelativepurity of a color. S
a
White is thepoint at V = I andS _-0.
variesfrom 0 to I andpurehuesarethosefor which S = I and
2.5.8 IILS CotorModet L:0.5.
O
HLS model is basedon intuitive color parameters - As S decreases,
the huesaresaidto be lesspure.
usedI
Tektnonix. - At S:0, it is saidto begrayscale.
It hasthedoubleconerepresentation shownin figure2.35. Tl
3 colorparameters in thismodelarecalledline (H), lightress(,
andsaturation(S).
L(Lightness)
L=1 ?
ffiite)
parameters
suchasposition,orientation,andfocallength.
2.6.1 DesignofAnimation Sequences *
An animationsequence
in desgined
with thefollowingsteps:
. - 4
{sjotyboard layout
Gray scale '. Objectdefinitions
./
4 Key-framespecifications
angle)
x) -l
S(Saturation) ationof in-betweenframes.
ly'Gener
Figure2.35
2.62 GRAPHICS'AND
MULTIMEDIA THREEDIMENSIONAL
CONCEPTS 2.63
Story-board - Film requires24 framesper second,andgraphicsterminals
arerefr6shedat the rateof 30 to 60 framesper-second.
on.
- filng ;nte"""t- fortt e m.t;
sic eventsthat , sotbgrea{gfroln 1jg
areto takeplace.
^-^i^a-l---r
=_-
S s .
- Depending on the t$.e nfanimatinn to he produced,
- Dependingon the speedofthe motion,somekeyframescan
the storv
boardcouldconsi"tora selo,frought beduplicated.
"kotck a.,rilio-il*
basicideasfor themotion. - Fora I min film sequence
with no duplication,llp frames
?--'---- _
ObjectDefinition areneeded.
-, An objectdefinition given . Otherrequiredtasksare
J , '
is for eachparticipantin the action.
- O can be definedin terms of basicshapes
.bjects suchas
polygonsor splines. F44ing
- Theassociatedmovementsofeach
Productionandsynchronization
ofa soundtrack.
'
shape.
2.62 GeneralComputerAnimation Functions
Key frame
<-
s nceare,
- A keyframeis detaired '
drawingofthesceneata certaintime
-A<Abject manipulationandrendering
J intheanimationsequente
- -Xeumeramotion
y:\in eachkeyframe,e".h objectis positioned
acordingto -/
J
< thetime forthat frame. r{ Generutionof in-betrveens
: :- somekeyfiamesarechosenat Animationpackages suchaswavefront, p@
extremepositionsin theaction;
othersarespacedsothatthetime intervar mr aesigninetheanimationandpr@es ,
u/ betrveenkeyframe
lsnottoomuch. Animation packagesfacilitateto storeandmanagethe object
In-befweens database.
In betweensare the intermediateframes ObjectshapesandSsocielgdgrameler arestered€ndrpdalald
betweenthe key
frames. inthe datahac..
Thenumberofinbetrveen neededis determinedbythemedia Motion canbegeneratedaccordingto specifiedconstaintsusing
to beusedto displaytheanimation. 2D and3D transformations.
2.64 GRAPHICS
AND MULTIAAEDIA
THREE
DIMENSIONAL
CONCEPTS 2.65
' sEudardiuctionscanbeappliedto identifrvisible
surfaces
and 2.6.4 ComputerAnimation Languages
. Cameramovementflrnctionssuchas . Animation functionsincludea glaphicsedi.tor,
Zgomin&peenq€andtilting algyFragre
- --\- generator,un in-b"!*.*_gg5lgtor, and standardgraphics
areusedformotion3lglggigg
. Given the specificationfo&.kyframes,
the irylg1tweensgan -routmes.
be automaticallygenerated. Thegraphicseditorallowsto designandmodify objectshapes,
2.6.3 RasterAnimations usingsplinesurfaces,
constructivesolidgeometrymethods,or
' on rastersystems,realtimeanimation otherrepresentation
schemes.
in limited applicationscan
be generatedusingraster operations. Seenedescription
i
' sequenceof rasteroperationscan
be executedto producereal
time animationofeither?D or 3D objects. cary.lglggjgrs-
' we cananimateobjectsarong2D ' Action specificationinvolvesthelayoytofmotionpathsforthe
motionpathsusingthecoror-
table transformations. o@aniicarneia.

a'@Sf$ms are specializedanimationlanguages


B41hsetthe successive
blocksofpixel valuesto corortabre designedsimply to generatethe inbetweensfrom the user
entries.
)edfiedkeyframes.
Setthepixelsat the first positionofthe objectto .on, values, .r' P"*-"t".i""d .y.t"ms allow
and set the pixels at the other object positionsto the

# backgroundcolor.
The animationis accomplishedby changingthecorortable
vahfessothattheobjectis 'on' at successive
positionsalong
the animationpath as the precedingposition is setto the
..
parameterscontrol suchobjectcharacteristics
fgEds, motion
=-- limitations

2,' Scripting systemsallow objectspecifications


sequences
asdegreesof
andallowableshapechanses.
andanimation
to bedefinedwith a userinputscript. Fromthescrip!
backgroundintensity(figure 2.36). a Iibraryof variousobjectsanilffiii6$Ei'& constructed.
2.6.5 Keyframe Systems
'
E N -..+E M Eac-Fof in-betweens
aregenerated
fromthespecification
of
two keyframes.
'' Forcomplexscenes,we canseperate theframesinto individual
components or objectscalledcels,an acronyrnfrom cartoon
Figure2.36 animation.
,

2.66 GRAPHICS
AND MULTIMEDI THREE
DIMENSIONAL
CONCEPTS 2.67

Morphing . For example,if Lu : 15 and Lu*,= 11,we divide 4 lines


of
' Transformationof object shapesfrom one form to another keyframeu*,into 2 sectionseach. The remaining lines of
calledMorphing. keyframe**,areleft infact.

' . If the vector count in equalized,parametersVu and


Morphing methodscanbe appriedto any motion ortransitio Vu*, are
involving a change in shape. The example is shown i usedto denotethe numberof verticesin the two conse6utive
figure2.37. frames. In this casewe define

Vn* = max (Vu, Vg*,), V* : min(\,Vk*,)


' and Nh : (V*-l)mod(V_. - l)
(v -r\
N
- ' -p i n t le . l '
Halfway Keyframe IV-r-1,/
KeyframeK frame K+1
. Preprocessing
usingvertexcountisperformed
by
Figure2.37
1. adding\pointstoN,.linesei:tion
ofkeyframe. .
Thegeneralpreprocessingrulesfor equalizingkeyfamesin term
ofeither the numberofverticesto beaddedto a keyframe. 2. addingNo- I poihtsto theremaining
edges
of keyframe_,
.
Supposewe equalizethe edgecount, and parameters.Lu 2.6.6Motion Specifications
anr
Lu*,denotethe number.of line segmentsin two consecutivr Theseareseveralwaysin which themotionsof objects'banbe
frames.Wedefine. specifiedin ananimationsystem.
LIE : max (Lu,L,.*,), Direct Motion Specification
Lm : min (Lk,LH,) . Here,the rotationanglesandtranslationvectorsareexplicitly
given.
N = L.omod[.,.
. Then the geometrictransformationmatricesare applied to

N,='"[k) transformcoordinate
. Wecanapproximate
positions.
thepathofa bouncingball with a damped,
Thepreprocessing rectified,sinecurve(figure2.38).
is accomplished
by
y(x) : A/sin(or*+0")/e-t*
l. dividing\ edgesofkeyframer" into
\ * I sections. WhereA is the initial amplitude,ol is the angular@uency, 0ois
2. dividingtheremaininglipesofkeyframe* intoN" sections. thephaseangle,andk is thedampingconstant.
2.68 GMPHICSAND MULTIMEDIA

\ A
l r \
\ r l r . .
I , I /-"\
r J I r ' \
r t 1' , , f tI
-q.

t /
'll J \ z
\i ii \l t
l l i l l l 1l /^trr\ r".

Figure2.38
Goal Directed Systems
* ' we can specifythe motionsthat are to takeplacein generat
termsthat abstractlydescribethe actions.Thesesystemsare
calledgoal directed becausetheydeterminespecificmotion
parametersgiventhegoalsofthe animation.
Eg.Tospecilyanobjectto' walk' orto' run'to aparticulard
istance.
Kinematicsand Dynamics
' with a kinematicdescription,we specifytheanimationby motion
parameters (position,velocity,andacceleration)
withoutreference
to the forcesthat causethemotion.
Forconstantvelocity(zeroacceleration)we designate themotions
ofrigid bodiesin a sceneby givinganinitialpositionandvelociq,
vectorfor eachobject.
Wecanspecifoaccelerations (rateof changeof velocity),speed
up, slow downs,andcurvedmotionpaths.
An alternativeapproachis to useinversekinematics;where,
theinitialandfinalpositionsoftheobjectarespecifiedat specified
timesandthe motionparametersarecomputedby the system.

Вам также может понравиться