CAD_PPT_2-1.pdf mechanucal engineering c

UMANGSINGHhbtu 7 views 31 slides Jun 22, 2024
Slide 1
Slide 1 of 31
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31

About This Presentation

CAD


Slide Content

OUTPUT
PRIMITIVES
x
y
ImageRepresentationsinComputers
Incomputergraphics,theimagesarecreatedon thedisplaydevices.
Forbetterunderstandingofimagegeneration,itisnecessarytoknowmoreaboutthe
imagerepresentationmechanism.
Ithasbeenobservedthatanimageisfinallyrepresentedandstoredintheframe
bufferintheformofbinarydigits, i.e.bits.
Analysisof ImageTransferMechanisminComputerGraphics
1.ImageConversioninBinaryForm
Animageisvisualizedintheform ofcollectionofstraight-linesegments,curvesand
textmatter.Ifwegoinsight,theseentitiesare composed ofcollectionofdots.
Forexample,alinecanberepresentedbythecollectionofdots.Similarly,anarcis
representedbythe collectionofdotslyingonthe trajectoryofan arc.

IMAGEREPRESENTATIONSIN
COMPUTERS
42
x
y
1.ImageConversioninBinaryForm…
Theexactpositionsofthesedotsdependontheradius,initial/endangles,endpoints
coordinates,etc.
MostofthemodernCADsystemsuseonlyrasterdisplaysforthegenerationand
representationofgraphicsimages.
2.FrameBuffer
Incomputergraphics,thebinaryimageinformationisstoredinthememory,called as
frame buffer or refreshbuffer.
Thedisplaysurfaceforrasterdisplaysisdividedintogridsofhorizontalandvertical
lines.Eachlineconsists ofseriesofsmallpictureelements,i.e.pixels.
Apixelismadebrightordarkdependinguponthetwostatesofbinarydigits1or0,
respectively.

x IMAGEREPRESENTATIONSIN
COMPUTERS…
43
y
2.FrameBuffer…
Thisisachievedbyassigning1bitmemorycorrespondingtoeachpixelofthe
viewingscreen.
3.ScanConversion
Adrawingcanbedisplayedeitherwiththehelpofpixelarraysstoredintotheframe
buffer(graphicsmemory)orbythescanconversionofstructuralobjectsformingthe
pixelpatterns.
Duringscanconversion,itisrequiredtofindoutthosepixellocations,whichare
bright.
Formonochromedevice,theimageisdisplayedbyassigningthestateofbits
correspondingtothesepixelsequalto1(onposition).

x IMAGEREPRESENTATIONSIN
COMPUTERS…
44
y
3.ScanConversion…
Onceanimageisscanconverted,adisplaycontrollerscanstheframebufferand
makesthosepixelsbrightcorrespondingtothebitsvalue1intheframebuffer.
Forexample,foralinerepresentation,itisrequiredtodeterminethosepixels,which
arebright.Thisisachievedbyassigningthestateofbitscorrespondingtothose
pixelsinthebuffermemoryto1.
Thus,scanconversioninvestigatesthoselocationsofpixels,whicharemadebright
andthenassigningthevalueofcorrespondingbitsinthegraphicsmemoryto1.
Figureshowsthestepsofatypicalscanconversionprocessforgeneratingagraphics
imageonthedisplaysurface.
Thereisone-to-onecorrespondencebetweenthedisplaysurfaceandmemory
locationintheframebuffer,designatedbythecoordinatespair(x,y).

x
y
Displayprocessor
Scan conversion
ofgraphicsimage
Framebuffer
Image definition in
graphicsmemory
Displaycontroller
Imagegeneration
ondisplaydevice
Framebuffer
●●●

IMAGEREPRESENTATIONSIN
COMPUTERS…
45






●●●
●●●


●●
Displaysurface
0000000000
0000011110
0000100010
0000100010
0000100010
0000011110
0000001010
0000010010
0000100010
Scanconversionprocessforgeneratinggraphicsimage

x IMAGEREPRESENTATIONSIN
COMPUTERS…
46
y
3.ScanConversion…
Thecoordinates(x,y)refertothepixellocations;hence,theyareintegerswith
originatbottom-leftcornerofthedisplaydevices.
However,somegraphicssystemslocatetheoriginatthetop-leftcorner.The
applicationprogramordevicedrivershouldtakecareofsuchdifficulties.
Everypixelonthedisplaysurfacerequires1-bitmemory;thus,1024x1024pixels
require1,048,576bitsmemoryintheframebuffer,whichisequivalentto131
kilobytes(8bits=1byte).
Eachpixelcanbemade brightordarkbyassigningthebinaryvalue1or0,
respectively.
Morenumberofbitsisassociatedtoeachpixelifcoloredimages,withvarying
intensitylevels,arerequired.

x IMAGEREPRESENTATIONSIN
COMPUTERS…
47
3.ScanConversion…
Forhighlyspecializedgraphicsapplications,thepresent-daytechnologyoffers
graphicssystemwith4096x4096pixels,inwhicheachprimarycolor(Red,Blueor
Green)isassociatedwithagroupof8-bitplanes.
Personalcomputersofferdifferentgraphicsadapterswithvaryinggraphicsfacilities.
AtypicalEnhancedGraphicsAdapter(EGA)onpersonalcomputersgivesa
resolutionof640x350pixelswith16colors.
EGAadapterswithbettercapabilitiesarealsoavailablewhichgivesverygoodtonal
andspatialresolutionsinthegraphicsimage.

SCANCONVERSIONOF PRIMITIVE
OBJECTS
48
x
y
Theprimitiveobjectssuch aspoints,lines, circles, curves,surfaces,text,etc.,usedfor
thegenerationofcompleximageson the displays.
Eachoutputprimitiveisdefinedbytheinputcoordinatesandotherrelated
informationabout the objectthatistobedisplayed,referredtoasattributes.
Pointsandstraightlinesarethesimplest2Doutputprimitives.
Additionaloutputsprimitivesused forconstructingthecomplexgraphicsimageare:
Conicsections:Circle,ellipse,parabolaandhyperbola
Quadricsurfaces:sphere, ellipsoid,paraboloids,hyperboloid
Splinecurves: Hermitecurve,Beziercurve,-spline
Splinesurfaces:Beziersurface,-spline surface
Polygons:Areaswithlinearboundariesfilledwithcolors/patterns

SCAN CONVERSIONOF
POINTS
49
x
y
Thegraphicselementssuchaslines,circles,surfaces,polygons,etc.consistofpoints.
Theseelementsarelocusofpointsundercertainconstraints.
Apointhasnodimensionsratherrepresentedasadotonthepaperandphosphordot
ontheCRTdisplays.
Apointinadrawingmaybeobtainedasfollows:
1.Inmonochrome(black/white)rasterdisplays,apointplottedbysettingthebitvalue
equalto‘1’(onpositionofpixel)atthespecifiedlocationwithintheframebuffer.
Whenelectronbeamscansacrossahorizontalscanline,itenergizesthepixelatthe
locationwheneverabitvalueequalto‘1’isencounteredintheframebuffer.
2.Incoloreddisplay,differentRGBbitvaluesareloadedintheframebufferatthe
specifiedlocation.Duringsweep,electronbeamenergizestheRGBdots(eitheras
triadsorinline),emittingRGBcolorsofvaryingintensities,producesthecolordot.

SCAN CONVERSIONOF
LINES
50
Agoodline drawingalgorithmmustsatisfy thefollowingcharacteristics:
•Lineshouldappearstraightonthedisplaydevice
•Lineshouldterminateaccuratelyat theendpoints
•Lineshouldhaveconstantdensitythroughoutthelength
•Lineshouldbedrawnaccurately
Foranalogdevicesuchasrandomscandisplayorpenplotter,asmoothlinecanbe
drawnbetweentheendpoints.
Thisisachievedbyapplyinglinearlyvaryinghorizontalandverticaldeflectionvoltages
toelectronbeaminsuchawaythatappliedvoltagesareproportionaltotherequired
deflectionofelectronbeamalongthexandydirections.
Forrasterscandisplay,alinesegmentcanbedrawnbycalculatingthediscrete
coordinatepoints(fromequationofaline)andplotthembetweentheendpoints.

SCAN CONVERSIONOF
LINES…
51
Thevariationinintensityandcolorofthelinecanbevisualizedbyloadingthepixel
informationinto the framebufferandretrievingthesamebythevideo controller.
Inrasterdisplays,thescreenlocationsarealwaysreferredwithintegervalues;therefore,
coordinate(9.43,20.78)wouldbeconvertedintothe approximatevalue(9,21).
Thisroundingoffcoordinatevaluestointegercausesthestaircase(jaggies)appearance,
whichismorepronounced onalow-resolutionrasterdisplay devices
Lineinlow resolutiondevice Lineinhighresolutiondevice
Staircaseeffecton rasterdisplay














Thefollowingalgorithmsaccomplishlinedrawingincomputergraphics:
•DigitalDifferentialAnalyzer(DDA)algorithm
•Bresenham’slinedrawingalgorithm
Thebasicinputforalinegenerationistheendpoints.Thepixellocationsonthelinepath
arecalculatedusingthesealgorithms.Whenelectronbeamenergizesthesepixelsduring
therasterscan,linecanbevisualizedonthecomputerscreen.
DigitalDifferentialAnalyzer(DDA)Algorithm
DDAisascanconversionline-generatingalgorithm,basedonthecalculationofeither
yorxdifferencesalongthelinepath.
Alinecanbegeneratedbyincreasingunitintervalinonecoordinate(say,x)and
determinethecorrespondingintegervaluesofintervalinothercoordinate(say,y)
nearesttothelinepath.
DDAALGORITHMFORLINE
GENERATION
52

DDAALGORITHMFORLINE
GENERATION...
53

DDAALGORITHMFORLINE
GENERATION
54

DDAALGORITHMFORLINE
GENERATION
55

Limitations
AlthoughDDAalgorithmgeneratesastraightlineatafastspeed;however,itsuffersfrom
variousdisadvantages.
Thevaluesoflineslopemmaybearealnumber;therefore,thevaluesofnew
coordinate
(x
k+1
,y
k+1
)
onthelinepathmayalsobearealnumber.
Hence,everytimeduringthecalculations,itbecomesnecessarytoroundoffthereal
numbercoordinatevaluestosomeintegervaluesbecausethepixelsarearrangedinan
integerfashion.
Therealmathematicscalculationsfornewcoordinatevaluesandroundingoff
operationofrealnumbersmakeDDAalgorithmalittleslowerprocess.
Moreover,inlow-resolutiondisplays,staircaseeffectisquiteprominent;hence,DDA
algorithmisnotpreferredfortheCADapplications.
DDAALGORITHMFORLINE
GENERATION
56

DDAALGORITHMFORLINE
GENERATION
57

DDAALGORITHMFORLINE
GENERATION
58
Table Intermediatepixelcalculations
Integervaluesy
k+1
=y
k
+mRealvaluesy
k+1
=y
k
+mIntegervaluesx
k+1
=x
k
+1k
10-180
1110.54191
1111.08202
1211.62213
1212.16224
1312.70235
1313.24246
1413.78257
1414.32268
1514.86279
1515.402810
1615.942911

DDAALGORITHMFORLINE
GENERATION
59
26
24
22
20
18
16
14
12
10
A(18,10)
B(29,16)
Actualline
1820222426283032
PixelNo.
Pixel
No.
Tags