尊敬的 微信汇率:1円 ≈ 0.046166 元 支付宝汇率:1円 ≈ 0.046257元 [退出登录]
SlideShare a Scribd company logo
Polygon Clipping
Collection of connected lines is considered as
Polygon. A polygon clipper takes as input the
vertices of a polygon and returns one(or
   more)
polygons. A closed Polygon when clipped
                C
then we may get one or more open c
                                d
                                    polygon or
                  D
lines.                     a
  A
                           b
      B
When we want clipping of a solid polygon
area(closed polygon), then after clipping the
resulting polygon should be closed. It requires
that lines ab & cd be added to make it closed
polygon. Hence it is difficult to find out
   which
pieces of sections should be joined to make
the clipped polygon closed.
A polygon is called convex if the line joining
  any two interior points of the polygon lies
  completely inside the polygon. A non-
  convex polygon is said to be concave.

             B                     B

       A
                               A
Another problem occurs when clipping a
closed polygon into several distinct smaller
polygons as shown:

   Clipping
   Window


                                      Concave
                                      Polygon
By convention, a polygon with vertices p1..pn
is said to be positively oriented if it produces
a anticlockwise direction. And if produces
clockwise it will be negative oriented.
                             C           D
  D              C
                         L       R
                                             E
             L       R
   E             B           B
                                     A
             A
SUTHERLAND-HODGMAN ALGORITHM
      Each edge of the polygon must be tested
against each edge of the clip rectangle; new
edges must be added, and existing edges must
be discarded, retained, or divided. Multiple
polygons may result from clipping a single
polygon. We need an organized way to deal
with all these cases.
Steps of Sutherland-Hodgman's polygon
clipping algorithm
 Polygons can be clipped against each edge
   of the window one at a time.
   Vertices which are kept after clipping
    against one window edge are saved for
    clipping against the remaining edges.
   Note that the number of vertices usually
    changes and will often increases.


                            The original polygon
                            and the clip
                            rectangle.
After clipped by the
right clip boundary.




After clipped by the
 right and bottom
clip boundaries.
After clipped by the
right, bottom, and
left clip boundaries.




After clipped by
all four
boundaries.
Four Cases of polygon clipping against one
Edge:
The clip boundary determines a visible and
Invisible region. The edges from vertex can
   be
one of four types:
 Case 1 : Wholly inside visible region - save
   endpoint
 Case 2 : Exit visible region - save the
   intersection
   Case 3 : Wholly outside visible region -
    save nothing
   Case 4 : Enter visible region - save
    intersection and endpoint
    V1
               V2                 V1
         V1’

                                 V2



         Out  in            in  in
         Save V1’,V2         Save V2
V2

      V1
V2 V1’      V1

 in  out        out  out
 Save V1’        Save none

More Related Content

What's hot

Seed filling algorithm
Seed filling algorithmSeed filling algorithm
Seed filling algorithm
Mani Kanth
 
Clipping
ClippingClipping
Clipping
AMIT VIRAMGAMI
 
2D transformation (Computer Graphics)
2D transformation (Computer Graphics)2D transformation (Computer Graphics)
2D transformation (Computer Graphics)
Timbal Mayank
 
Back face detection
Back face detectionBack face detection
Back face detection
Pooja Dixit
 
Polygon filling
Polygon fillingPolygon filling
Spline representations
Spline representationsSpline representations
Spline representations
Nikhil krishnan
 
Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.
Mohd Arif
 
Computer graphics chapter 4
Computer graphics chapter 4Computer graphics chapter 4
Computer graphics chapter 4
PrathimaBaliga
 
Computer graphics basic transformation
Computer graphics basic transformationComputer graphics basic transformation
Computer graphics basic transformation
Selvakumar Gna
 
Composite transformations
Composite transformationsComposite transformations
Composite transformations
Mohd Arif
 
Video display devices
Video display devicesVideo display devices
Video display devices
shalinikarunakaran1
 
Polygon clipping with sutherland hodgeman algorithm and scan line fill algorithm
Polygon clipping with sutherland hodgeman algorithm and scan line fill algorithmPolygon clipping with sutherland hodgeman algorithm and scan line fill algorithm
Polygon clipping with sutherland hodgeman algorithm and scan line fill algorithm
Mani Kanth
 
3 d viewing projection
3 d viewing  projection3 d viewing  projection
3 d viewing projection
Pooja Dixit
 
sutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingsutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clipping
Arvind Kumar
 
Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)
shalinikarunakaran1
 
Overview of the graphics system
Overview of the graphics systemOverview of the graphics system
Overview of the graphics system
Kamal Acharya
 
Projection In Computer Graphics
Projection In Computer GraphicsProjection In Computer Graphics
Projection In Computer Graphics
Sanu Philip
 
Raster scan system
Raster scan systemRaster scan system
Raster scan system
Mohd Arif
 
Input of graphical data
Input of graphical dataInput of graphical data
Input of graphical data
Rajapriya82
 
Character attributes
Character attributesCharacter attributes
Character attributes
shalinikarunakaran1
 

What's hot (20)

Seed filling algorithm
Seed filling algorithmSeed filling algorithm
Seed filling algorithm
 
Clipping
ClippingClipping
Clipping
 
2D transformation (Computer Graphics)
2D transformation (Computer Graphics)2D transformation (Computer Graphics)
2D transformation (Computer Graphics)
 
Back face detection
Back face detectionBack face detection
Back face detection
 
Polygon filling
Polygon fillingPolygon filling
Polygon filling
 
Spline representations
Spline representationsSpline representations
Spline representations
 
Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.
 
Computer graphics chapter 4
Computer graphics chapter 4Computer graphics chapter 4
Computer graphics chapter 4
 
Computer graphics basic transformation
Computer graphics basic transformationComputer graphics basic transformation
Computer graphics basic transformation
 
Composite transformations
Composite transformationsComposite transformations
Composite transformations
 
Video display devices
Video display devicesVideo display devices
Video display devices
 
Polygon clipping with sutherland hodgeman algorithm and scan line fill algorithm
Polygon clipping with sutherland hodgeman algorithm and scan line fill algorithmPolygon clipping with sutherland hodgeman algorithm and scan line fill algorithm
Polygon clipping with sutherland hodgeman algorithm and scan line fill algorithm
 
3 d viewing projection
3 d viewing  projection3 d viewing  projection
3 d viewing projection
 
sutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingsutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clipping
 
Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)
 
Overview of the graphics system
Overview of the graphics systemOverview of the graphics system
Overview of the graphics system
 
Projection In Computer Graphics
Projection In Computer GraphicsProjection In Computer Graphics
Projection In Computer Graphics
 
Raster scan system
Raster scan systemRaster scan system
Raster scan system
 
Input of graphical data
Input of graphical dataInput of graphical data
Input of graphical data
 
Character attributes
Character attributesCharacter attributes
Character attributes
 

Similar to Polygon clipping

jd.pptx
jd.pptxjd.pptx
jd.pptx
nabingyawali5
 
ytsju.pptx
ytsju.pptxytsju.pptx
ytsju.pptx
nabingyawali5
 
hgfcftc.pptx
hgfcftc.pptxhgfcftc.pptx
hgfcftc.pptx
nabingyawali5
 
kfty.pptx
kfty.pptxkfty.pptx
kfty.pptx
nabingyawali5
 
yyfty.pptx
yyfty.pptxyyfty.pptx
yyfty.pptx
nabingyawali5
 
hgfcgf.pptx
hgfcgf.pptxhgfcgf.pptx
hgfcgf.pptx
nabingyawali5
 
ytdty.pptx
ytdty.pptxytdty.pptx
ytdty.pptx
sandeshbhusal6
 
jfcft.pptx
jfcft.pptxjfcft.pptx
jfcft.pptx
nabingyawali5
 
ufyty.pptx
ufyty.pptxufyty.pptx
ufyty.pptx
nabingyawali5
 
iuyf.pptx
iuyf.pptxiuyf.pptx
iuyf.pptx
nabingyawali5
 
ohu.pptx
ohu.pptxohu.pptx
ohu.pptx
nabingyawali5
 
Clipping2
Clipping2Clipping2
Clipping2
Udayan Gupta
 
ytt.pptx
ytt.pptxytt.pptx
ytt.pptx
nabingyawali5
 
yutd65.pptx
yutd65.pptxyutd65.pptx
yutd65.pptx
nabingyawali5
 
ibuib.pptx
ibuib.pptxibuib.pptx
ibuib.pptx
nabingyawali5
 
ydyu.pptx
ydyu.pptxydyu.pptx
ydyu.pptx
nabingyawali5
 
Clipping in Computer Graphics
Clipping in Computer Graphics Clipping in Computer Graphics
Clipping in Computer Graphics
Barani Tharan
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
Ankit Garg
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
Taher Barodawala
 
Clipping
ClippingClipping
Clipping
Akash Gupta
 

Similar to Polygon clipping (20)

jd.pptx
jd.pptxjd.pptx
jd.pptx
 
ytsju.pptx
ytsju.pptxytsju.pptx
ytsju.pptx
 
hgfcftc.pptx
hgfcftc.pptxhgfcftc.pptx
hgfcftc.pptx
 
kfty.pptx
kfty.pptxkfty.pptx
kfty.pptx
 
yyfty.pptx
yyfty.pptxyyfty.pptx
yyfty.pptx
 
hgfcgf.pptx
hgfcgf.pptxhgfcgf.pptx
hgfcgf.pptx
 
ytdty.pptx
ytdty.pptxytdty.pptx
ytdty.pptx
 
jfcft.pptx
jfcft.pptxjfcft.pptx
jfcft.pptx
 
ufyty.pptx
ufyty.pptxufyty.pptx
ufyty.pptx
 
iuyf.pptx
iuyf.pptxiuyf.pptx
iuyf.pptx
 
ohu.pptx
ohu.pptxohu.pptx
ohu.pptx
 
Clipping2
Clipping2Clipping2
Clipping2
 
ytt.pptx
ytt.pptxytt.pptx
ytt.pptx
 
yutd65.pptx
yutd65.pptxyutd65.pptx
yutd65.pptx
 
ibuib.pptx
ibuib.pptxibuib.pptx
ibuib.pptx
 
ydyu.pptx
ydyu.pptxydyu.pptx
ydyu.pptx
 
Clipping in Computer Graphics
Clipping in Computer Graphics Clipping in Computer Graphics
Clipping in Computer Graphics
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
 
Clipping
ClippingClipping
Clipping
 

More from Mohd Arif

Bootp and dhcp
Bootp and dhcpBootp and dhcp
Bootp and dhcp
Mohd Arif
 
Arp and rarp
Arp and rarpArp and rarp
Arp and rarp
Mohd Arif
 
User datagram protocol
User datagram protocolUser datagram protocol
User datagram protocol
Mohd Arif
 
Project identification
Project identificationProject identification
Project identification
Mohd Arif
 
Project evalaution techniques
Project evalaution techniquesProject evalaution techniques
Project evalaution techniques
Mohd Arif
 
Presentation
PresentationPresentation
Presentation
Mohd Arif
 
Pointers in c
Pointers in cPointers in c
Pointers in c
Mohd Arif
 
Peer to-peer
Peer to-peerPeer to-peer
Peer to-peer
Mohd Arif
 
Overview of current communications systems
Overview of current communications systemsOverview of current communications systems
Overview of current communications systems
Mohd Arif
 
Overall 23 11_2007_hdp
Overall 23 11_2007_hdpOverall 23 11_2007_hdp
Overall 23 11_2007_hdp
Mohd Arif
 
Objectives of budgeting
Objectives of budgetingObjectives of budgeting
Objectives of budgeting
Mohd Arif
 
Network management
Network managementNetwork management
Network management
Mohd Arif
 
Networing basics
Networing basicsNetworing basics
Networing basics
Mohd Arif
 
Loaders
LoadersLoaders
Loaders
Mohd Arif
 
Lists
ListsLists
Lists
Mohd Arif
 
Iris ngx next generation ip based switching platform
Iris ngx next generation ip based switching platformIris ngx next generation ip based switching platform
Iris ngx next generation ip based switching platform
Mohd Arif
 
Ip sec and ssl
Ip sec and  sslIp sec and  ssl
Ip sec and ssl
Mohd Arif
 
Ip security in i psec
Ip security in i psecIp security in i psec
Ip security in i psec
Mohd Arif
 
Intro to comp. hardware
Intro to comp. hardwareIntro to comp. hardware
Intro to comp. hardware
Mohd Arif
 
Heap sort
Heap sortHeap sort
Heap sort
Mohd Arif
 

More from Mohd Arif (20)

Bootp and dhcp
Bootp and dhcpBootp and dhcp
Bootp and dhcp
 
Arp and rarp
Arp and rarpArp and rarp
Arp and rarp
 
User datagram protocol
User datagram protocolUser datagram protocol
User datagram protocol
 
Project identification
Project identificationProject identification
Project identification
 
Project evalaution techniques
Project evalaution techniquesProject evalaution techniques
Project evalaution techniques
 
Presentation
PresentationPresentation
Presentation
 
Pointers in c
Pointers in cPointers in c
Pointers in c
 
Peer to-peer
Peer to-peerPeer to-peer
Peer to-peer
 
Overview of current communications systems
Overview of current communications systemsOverview of current communications systems
Overview of current communications systems
 
Overall 23 11_2007_hdp
Overall 23 11_2007_hdpOverall 23 11_2007_hdp
Overall 23 11_2007_hdp
 
Objectives of budgeting
Objectives of budgetingObjectives of budgeting
Objectives of budgeting
 
Network management
Network managementNetwork management
Network management
 
Networing basics
Networing basicsNetworing basics
Networing basics
 
Loaders
LoadersLoaders
Loaders
 
Lists
ListsLists
Lists
 
Iris ngx next generation ip based switching platform
Iris ngx next generation ip based switching platformIris ngx next generation ip based switching platform
Iris ngx next generation ip based switching platform
 
Ip sec and ssl
Ip sec and  sslIp sec and  ssl
Ip sec and ssl
 
Ip security in i psec
Ip security in i psecIp security in i psec
Ip security in i psec
 
Intro to comp. hardware
Intro to comp. hardwareIntro to comp. hardware
Intro to comp. hardware
 
Heap sort
Heap sortHeap sort
Heap sort
 

Polygon clipping

  • 1. Polygon Clipping Collection of connected lines is considered as Polygon. A polygon clipper takes as input the vertices of a polygon and returns one(or more) polygons. A closed Polygon when clipped C then we may get one or more open c d polygon or D lines. a A b B
  • 2. When we want clipping of a solid polygon area(closed polygon), then after clipping the resulting polygon should be closed. It requires that lines ab & cd be added to make it closed polygon. Hence it is difficult to find out which pieces of sections should be joined to make the clipped polygon closed.
  • 3. A polygon is called convex if the line joining any two interior points of the polygon lies completely inside the polygon. A non- convex polygon is said to be concave. B B A A
  • 4. Another problem occurs when clipping a closed polygon into several distinct smaller polygons as shown: Clipping Window Concave Polygon
  • 5. By convention, a polygon with vertices p1..pn is said to be positively oriented if it produces a anticlockwise direction. And if produces clockwise it will be negative oriented. C D D C L R E L R E B B A A
  • 6. SUTHERLAND-HODGMAN ALGORITHM Each edge of the polygon must be tested against each edge of the clip rectangle; new edges must be added, and existing edges must be discarded, retained, or divided. Multiple polygons may result from clipping a single polygon. We need an organized way to deal with all these cases.
  • 7. Steps of Sutherland-Hodgman's polygon clipping algorithm  Polygons can be clipped against each edge of the window one at a time.
  • 8. Vertices which are kept after clipping against one window edge are saved for clipping against the remaining edges.  Note that the number of vertices usually changes and will often increases. The original polygon and the clip rectangle.
  • 9. After clipped by the right clip boundary. After clipped by the right and bottom clip boundaries.
  • 10. After clipped by the right, bottom, and left clip boundaries. After clipped by all four boundaries.
  • 11. Four Cases of polygon clipping against one Edge: The clip boundary determines a visible and Invisible region. The edges from vertex can be one of four types:  Case 1 : Wholly inside visible region - save endpoint  Case 2 : Exit visible region - save the intersection
  • 12. Case 3 : Wholly outside visible region - save nothing  Case 4 : Enter visible region - save intersection and endpoint V1 V2 V1 V1’ V2 Out  in in  in Save V1’,V2 Save V2
  • 13. V2 V1 V2 V1’ V1 in  out out  out Save V1’ Save none
  翻译: