cad unit2.pptx

  • View

  • Download

Embed Size (px)

Text of cad unit2.pptx

  • 8/20/2019 cad unit2.pptx



    Bresenham’s algorithm enables the selection of optimum raster locations to represent a

    straight line

    Fig. a Location of Pixels Using Fig.  Pixels fo! Line of 

    B!esen"a# Algo!it"# Slo$e% # & '.(

  • 8/20/2019 cad unit2.pptx


    Pse)*o co*e fo! B!esen"a#’s line+*!a,ing algo!it"#

    Given a line from x1, y1 to x2, y2...

    dx is the difference between the x components of end points

    dy is the difference between the y components of end points

    ix is the absolute value of dx

    iy is the absolute value of dyinc is the larger of dx, dy

     plotx is x1

     ploty is y1 (the beginning of line

    x starts at !

    y starts at !

     plot a pixel at plotx, ploty

    increment x using ix increment y using iy

     plot is false

    if x is greater than inc

     plot is true

    decrement x using inc

    increment plotx if dx is positive

    decrement plotx id dx is negative

    if y is greater than inc

     plot is true

    decrement y using inc

    increment ploty if dy is positive

    decrement ploty if dy is negative

    if plot is true, plot a pixel at plotx, ploty increment i.

  • 8/20/2019 cad unit2.pptx


    " include #stdio. h$

    " include #graphics. h$

    " include #stdlb. h$

    void draw line (int x1, int y1, int x2, int y2,void main (void


    draw line (1!!, 1!!, &!, &! '

    void draw line (int x1, int y1, int x2 m int y2


    int dx, dy, inc, ix, iy, x, y, plot, plotx, ploty, i 'int gd, gm '

    gd ) *++- '

    initgraph (gd, gm, / / '

    dx ) x1 0 x2 '

    dy ) y1 0 y2 '

    ix ) abs (dx '

    iy ) abs (dy '

    inc ) max (ix, iy '

    x ) y ) ! '

     plot x ) x1 '

     plot y ) y1 '

    for (i ) ! ' i #inc ' i 


    x  ) ix '

    y  iy '

     plot ) !

    if (x $ inc

    %  plot ) 1 '

    x 0 ) inc '

    if (dx # !

     plot x 0 ) 1 '


     plotx  ) 1 '

     if (y $ inc


     plot ) 1 '

    y 0 ) inc '

    if (dy

     ploty 0 ) 1 '

    else  ploty  ) 1 '

    if (plot

     putpixel (plotx, ploty, 1


    getch (  ' closegraph (  '

    P!og!a# in T)!o+- to *!a, a line

  • 8/20/2019 cad unit2.pptx



  • 8/20/2019 cad unit2.pptx



    wire frame, surface and solid modeling


    -omputer representation of the geometry of a component using software is called

    a geometric model. Geometric modeling is done in three principal ways. hey are

    /. 0i!e f!a#e #o*eling

    1. S)!face #o*eling

    2. Soli* #o*eling

    hese modeling methods have distinct features and applications.

    UNIT + 2

  • 8/20/2019 cad unit2.pptx



    3n wire frame modeling the ob4ect is represented by its edges

  • 8/20/2019 cad unit2.pptx


    2 5 * 6odels 75* 8ire 9rame 6odels

    1. +nds (vertices of lines are represented

     by their 3 an* 4 coordinates

    2. -urved edges are represented by

    circles, ellipses, splines etc.

    A**itional 5ie,s an* sectional 5ie,s

    are necessary to represent a complex

    ob4ect with clarity.

    7. 75* image reconstruction is te*io)s.

    :. ;ses only one gloal coo!*inate


    1. +nds of lines are represented by their

    3% 4 an* 7 coordinates.

    2. -urved surfaces are represented by

    suitably spaced generators. Hi**en

    line o! "i**en s)!face eli#ination is

    a must to interpret complex

    components correctly.

    7. 25* views as well as various pictorial

    views can be generated easil6.

    :. 6ay re

  • 8/20/2019 cad unit2.pptx



    3n this approach, a component is represented by its surfaces which in turn are

    represented by their vertices and edges.

    For example, eight surfaces are put together to create a box, as

    shown in

    >urface modeling has been very popular in

    aerospace product design and automotive


    =part from standard surface types

    available for surface modeling

    (ox% $6!a#i*% ,e*ge% *o#e%

    s$"e!e% cone% to!)s% *is" an*

    #es" techni

  • 8/20/2019 cad unit2.pptx



    he representation of solid models uses the fundamental idea that a physical

    ob4ect divides the 75* +uclidean space into two regions, one exterior and one interior,

    separated by the boundary of the solid. >olid models are

    ? bounded

    ? @omogeneously three dimensional

    ? 9inite

    here are six common !e$!esentations in solid modeling.

    i. S$atial En)#e!ation 3n this simplest form of 7* volumetric raster model, a

    section of 7* space is described by a #at!ix  of evenly spaced cubic volume

    elements called 5oxels.

    ii. -ell eco#$osition his is a hierarchical adaptation of spatial enumeration.

    7* space is sub5divided into cells. -ells could be of different siAes. hese simple

    cells are glued together to describe a solid ob4ect.

  • 8/20/2019 cad unit2.pptx


    iii. Bo)n*a!6 Re$!esentation he solid is represented by its boundary which

    consists of a set of faces, a set of e*ges  and a set of 5e!tices  as well as their

    topological relations.

    iv. S,ee$ Met"o*s 3n this techni

  • 8/20/2019 cad unit2.pptx


    -onst!)cti5e Soli* Geo#et!6 9-SG:

    • 3n a ->G model, physical ob4ects

    are created by co#ining asic

    ele#enta!6 s"a$es  Cnown as

     primitives liCe blocCs, cylinders,

    cones, pyramids and spheres.

    • he Boolean operations liCe )nion 

    (∪, *iffe!ence  (0 and

    inte!section E are used to carry out

    this tasC. 9or example, let us

    assume that we are using two

     primitives, a blocC and a cylinder

    which are located in space as

    shown in 9ig.

  • 8/20/2019 cad unit2.pptx


    Bo)n*a!6 Re$!esentation

    Boundary representation is built on

    the concept that a physical ob4ect is

    enclosed by a set of faces which

    themselves are closed and orient able

    surfaces. 9ig. >hows a B5rep model of

    an ob4ect. 3n this model, face is bounded

     by edges and each edge is bounded by

    vertices. he entities which constitute a

    B5rep model are

    Geometric entities opological



  • 8/20/2019 cad unit2.pptx


    0o!=ings of -SG

    -SG E l

  • 8/20/2019 cad unit2.pptx


    -SG Exa#$le

    + =



  • 8/20/2019 cad unit2.pptx




    • he most fundamental aspect in creating a solid model is the concept of feature5based

    design. • 3n typical 25* -=* applications, a designer draws a part by adding basic geometric

    elements such as lines% a!cs% ci!cles an* s$lines.

    • 3n solid modeling a 75* design is created by starting a ase feat)!e and then a**ing other

    feat)!es, one at a time, until the accurate and complete representation of the part’s

    geometry is achieved.

    • = feature is a basic building blocC that describes the design, liCe a =e6,a6 on a s"aft.

    +ach feature indicates how to add material (liCe a !i or remove a portion of material

    (liCe a c)t or a "ole.

  • 8/20/2019 cad unit2.pptx



    • =ll physical ob4ects are 75dimensional.

    • 3n a number of cases, it is sufficient to describe the boundary of a solid ob4ect in order

    to specify its shape without ambiguity. his fact is illustrated in 9ig..

    he boundary is a collection of faces forming a closed surface

  • 8/20/2019 cad unit2.pptx


    = surface can be created in several ways

    i. -reating a plane surface by the linear s,ee$ of

    a line or series of lines.

    ii. Re5ol5ing  a st!aig"t line about an axis.

    -ylindrical, conical surfaces etc. can be generated

     by this techni

  • 8/20/2019 cad unit2.pptx


    6odeling of curves and surfaces is essential to describe

    ob4ects that are encountered in several areas of mechanical

    engineering design. -urves and surfaces are the basic building

     blocCs in the following designs

    i. Bo*6 $anels of passenger cars

    ii. Ai!c!aft  bulC heads and other fuselage structures, slats,

    flaps, wings etc.

    iii. Ma!ine structures

    iv. -onsumer products liCe $lastic containe!s, telephones etc.

    v. +ngineering products liCe mixed flo, i#$elle!s, fo)n*!6 $atte