机械CADChapter 5Basic Graphics Concepts.docx

上传人:b****8 文档编号:9599966 上传时间:2023-02-05 格式:DOCX 页数:15 大小:104.33KB
下载 相关 举报
机械CADChapter 5Basic Graphics Concepts.docx_第1页
第1页 / 共15页
机械CADChapter 5Basic Graphics Concepts.docx_第2页
第2页 / 共15页
机械CADChapter 5Basic Graphics Concepts.docx_第3页
第3页 / 共15页
机械CADChapter 5Basic Graphics Concepts.docx_第4页
第4页 / 共15页
机械CADChapter 5Basic Graphics Concepts.docx_第5页
第5页 / 共15页
点击查看更多>>
下载资源
资源描述

机械CADChapter 5Basic Graphics Concepts.docx

《机械CADChapter 5Basic Graphics Concepts.docx》由会员分享,可在线阅读,更多相关《机械CADChapter 5Basic Graphics Concepts.docx(15页珍藏版)》请在冰豆网上搜索。

机械CADChapter 5Basic Graphics Concepts.docx

机械CADChapter5BasicGraphicsConcepts

Chapter5BasicGraphicsConcepts

5.1Introduction

WhenweuseCADsystemstobuildamodel,geometrytransformationsareoftenperformedtochangetheposition,orientation,andsizeofthemodelingobjects.Geometrytransformationsareoftenperformedinhomogenouscoordinates,andmatricesaresuitabletorepresentthesetransformations.

Visualizationisimportantbothduringandaftermodelgenerations,Inordertodisplaya3Dobject,techniqueslikeperspectiveprojections,hiddenlineandsurfaceremovalareused.Variousshadingmodelsareusedtogivetheobjectarealisticimage.Thischaptergivesanintroductiontothesebasictechniquesusedinmodelgenerationsandvisualization.

5.2GeometryTransformation

5.2.13DTransformations

5.2.1.1Translation

ApointP(x,y,z)maybetranslatedintotoanewpositionP*(x*,y*,z*)byaddingtranslationamountsd(dx,dy,dz)tothecoordinatesofthepoint,i.e.

P*=P+d(5.1)

whereP*isthefinalpositionvector,Pistheinitialpositionvector,anddisshowninFig.5.1.

Inscalarform,Eq.(5.1)canbewrittenas

(5.2)

5.2.1.2Scaling

Thepointcanbescaledbysxalongxaxis,sya1ongyaxisandszalongzaxis,whichmaybemathematicallyexpressedas

P*=[S]P(5.3)

where[S]isadiagonalmatrix,

(5.4)

Inscalarform,Eq.(5.3)maybewrittenas

(5.5)

5.2.1.3Reflection

Reflection(ormirror)operationsareoftenusedtogeneratesymmetricmodels.Reflectionoperationsrelativetothemodelcoordinatesystemcanbeexpressedas

P*=[M]P(5.6)

Where

(5.7)

wherem11,m22,m33=

1.

Forexample,thetransformationmatrixtoreflectPrelativetoxyplaneis

(5.8)

5.2.1.4Rotation

AtypicalrotationoperationisdemonstratedinFig.5.2,wherepointPisrotatedanangel

aboutzaxis,andthenewpositionisP*.

Fromthefigure,itcanbeobtainedthat

.Utilizingthetrigonometricfunctions,wegetthematrixformfortherotationaboutzaxis

P*=[R]P(5.9)

Where

(5.10)

Therotationsaboutxandyaxiscanbederivedinthesimilarway.

5.2.2HomogenousRepresentation

Thetranslationtransformationinpreviouschapterisrepresentedbymatrixaddition,whilescalingandrotationbymatrixmultiplications.Itisconvenienttorepresentalloperationsbymatrixmultiplication,suchas

P*=[T]P(5.11)

where[T]isthetransformationmatrixwewanttodeduce,PandP*arethecoordinatesofpointsbeforeandafterthetransformations.Thiscanbedonewithhomogenouscoordinates,andthetransformationmatrix[T]becomesa4

4matrix.

Foranypoint(x,y,z)inCartesiancoordinates,wedefinethefollowingrepresentation:

①Fromthe3Dcoordinatetothehomogenouscoordinate:

(x,y,z)=>(.x,y,z,1)

②Promthehomogenouscoordinatetothe3Dcoordinate:

(x,y,z,W)=>(x/W,y/W,z/W)(W

).

③Hormogenizing:

(x,y,z,W))=>(x/W,y/W,z/W,1).

Forexample,(4,0,0,2)and(2,0,0,1)representthesamecoordinates(2,0,0).

Wenowusethehomogenouscoordinatestorepresentthegeometrytransformationdiscussedinpreviouschapter.

GiveP=[xyz1]T,thefollowingoperationsmaybedefined.

(1)Translation

P*=T(dx,dy,dz)P(5.12)

Where

(5.13)

(2)Scaling

P*=S(sx,sy,sz)P(5.14)

Where

(5.15)

(3)Rotaiton

(5.16)

Whereforrotationaboutxaxis

(5.17a)

forrotationaboutyaxis

(5.17b)

forrotationaboutzaxis

(5.17c)

(4)Compositetransformation

Inpractice,aseriesoftransformationsmaybeappliedtoageometrymodel,resultinginacompositetransformation.Compositetransformationmatrixisequaltotheproductofthesequenceofthegiventransformationmatrices.Theorderofmultiplicationofthematricesisimportantbecausematrixmultiplicationisnotcommutative.

Mostofthetransformationsthatwenormallydealwithcanbeobtainedasacompositetransformationofbasictransformations.Ingeneralwehave

(5.18)

where[Ti]aretransformationmatricesand[T]istheproductofthem.

5.3MappingofGeometryModels

Thegeometrytransformationsdiscussedsofarassumethatthecoordinatesystemstaysunchangedandtheobjectistransformedwithrespecttotheoriginofthecoordinatesystem.Analternativebutequivalentwayofthinkingistotakethegeometrytransformationasachangeofcoordinatesystem.Thegeometrytransformationscanberegardedasmappingsofthegeometrymodelbetweendifferentcoordinatesystems,andtherelatedmatricesarecalledmappingmatrices.

Thisviewisusefulduringthemodelgeneration,asitisoftenconvenienttobuildsomepartofthemodelinthelocal(working)coordinatesystems.Thesoftwaremapsthesecoordinatestoglobalcoordinates.

5.3.1Translation

Figure5.3showsthatpointPisdescribedintwocoordinatesystemsxyzandx*y*z*.ThemappingbetweenthesetwocoordinatesystemscanbewrittenasP*=[T]P,where[T]isthesameasT(dx,dy,dz)inEq.(5.13).

5.3.2Rotation

Figure5.4showstherotationalmappingbetweentwocoordinatesystems.Thesetwocoordinatesystemssharethesameoriginbuttheirorientationsaredifferent.Itisalsoassumedthatthexyandthex*y*planesarecoincident.

Theunitvectorsi*,j*,K*ofthecoordinatesystemx*y*z*canbeexpressedas

(5.19)

Inmatrixform,

(5.20)

5.3.3GeneralMapping

ForageneralmappingasshowninFig.5.5,wehaveP*=[T]P

Where

(5.21)

Inwhich[R]istheorientationvectorsoftheorigintothexyzcoordinatesystem,whiledisthepositionvector,bothexpressedinx*y*z*system.

 

5.4ProjectionsofGeometryModels

Projectionisusedtoreducethedimensionofamodelfrom3Dto2D.Therearetwotypesofprojections:

parallelprojectionandperspectiveprojection.

5.4.1ParallelProjection

Parallelprojectioncanbedividedintoorthographicandobliqueprojections.Inorthographicprojection,directionofprojectionandprojectionplanenormalareparallel,whileinobliqueprojection,directionofprojectionandprojectionplanenormalarenotparallel.

Thematrixformoforthographicprojectionis:

Pv=[T]P(5.22)

Where

(5.23)

Orthographicprojectionpreservesrelativeproportionsandiscommonlyusedindraftingtoproducedrawingof3Dobjects.

5.4.2PerspectiveProjection

Ifthedistancebetweentheprojectioncenterandtheprojectionplanisfinite,thentheprojectionisperspective.Perspectiveprojectionisrealisticbecauseitresembleshuman’sviewing,andtheobjectbecomessmallerasitismovedawayfromtheviewplane.

Figure5.9showsthatacubeviewedinperspective.Theprojectionplaneisparalleltothexyplaneandperpendiculartothezaxis.Linesthatareparalleltothexoryaxisremainparallel,andxandydistancesbecomeshorteraszbecomesmorenegative.

Toderivethetransformationmatrixinperspectiveprojection,weplacethecentreofprojectionintheoriginofthecoordinatesystemandtheprojectionplanisperpendiculartothezvaxis,seeFig.5.10.Assumethat(xv,yv,zv)and(xp,yp,zp)arecoordinatesbeforeandaftertheperspectiveprojection.Fromthefigure,wegetzp=d,yp=dyv/zv,Similarlyxp=dxv/zv.Thiscanbewritteninhomogenousform,

(5.24)

 

5.5HiddenSurfaceRemoval

Togivea3Dpictureofthemodel,hiddenlinesandsurfacesmustberemoved.Linesareassumedtobetheedgesofthesurfaceandwerefertothegeneralprocessofmovinghiddensurfacesashiddensurfaceremoval.

Therearevariousalgorithmsforhiddensurfaceremoval.Thesealgorithmscanbecharacterizedastwogroups:

objectprecisionandimageprecision.

Objectprecisionisbasedontheobjectgeometryanddecideswhichpartoftheobjectisvisibleandthendrawsthesesurfaces.Theprecisionisindependentoftheresolutiononscreen.

Imageprecisionisapixelbasedmethod.Thismethodgoesthrougheachpixelonthescreen,anddeterminestheobjectclosesttotheprojectorandthendrawsthepixel.Theresultsdependontheresolution.

5.5.1VisualTechniques

Theoperationsusedinthetypicalimage-precisionandobject-precisionalgorithmsareof-tencostly.Weneedtomaketheseoperationsaseffectivelyaspossible.Thefollowingtechniquesprovidesomegeneralwaystodothat.

5.5.1.1Coherence

①Objectcoherence:

Iftwoobjectsareentirelyseparated,weneedonlytocomparetwoobjects,notbetweencomponentfacesoredgesoftheobjects.

②Facecoherence:

Surfacecomputationcanbemodifiedincrementallytoapplytoadjacentparts.

③Edgecoherence:

Anedgecanchangeitsvisibilityonlywhenitcrossesbehindavisibleedge.

④Scan-linecoherence:

Onescan-lineofanimagetypicallydifferslittlefromthepreviousline.

⑤Areacoherence:

Agroupofadjacentpixelsisoftencoveredbythesamevisibleface.

⑥Depthcoherence:

Oncethedepthatonepointofthesurfaceiscalculated,thedepthofpointsontherestofthesurfacecanoftenbedeterminedbysimpledifferenceequation.

⑦Framecoherence:

Calculationsmadeforonepicturecanbeusedforthenextinsequence.

5.5.1.2PerspectiveTransformation

Theideawiththeperspectivetransformationistotransfertheperspectiveprojectionintotheparallelprojectionofthetransformedobjects,asshowninFig5.11.

ThepyramidinFig.5.11iscutbyafrontclippingplaneandabackclippingplane,bothplanesareperpendiculartothedirectionofprojection.Onlytheobjectsinsidethetruncatedpyramidaredisplayedandthistruncatedpyramidiscalledviewingfrustum.Theviewingfrustumbecomesaboxafterperspectivetransformation.

Theadvantagesofperspectivetransformationarethefollowing:

①Providingz-information,whichcanbeusedinz-bufferalgorithmandtexturemapping.

②Simplifyingclipping,asinthecaseofapyramidbecomingabox.

③Invertible

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高等教育 > 文学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1