Top Banner

of 25

Aa Seminar - Seminar

Jun 02, 2018

Download

Documents

nikmay2604
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 8/10/2019 Aa Seminar - Seminar

    1/25

    BASIC PROPERTIES OF

    LINE SEGMENT,POLYGON

    Presented by REENA BHATI

  • 8/10/2019 Aa Seminar - Seminar

    2/25

    Applicti!n "!#ins

    Computer Graphics and Virtual Reality 2-D & 3-D: intersections, hidden surface elimination, ray t

    racing

    Virtual Reality: collision detection (intersection

    Ro!otics "otion planning, assem!ly orderings, collision detection,

    shortest path finding

    Glo!al #nformation $ystems (G#$

    %arge Data $etsdata structure design

    'erlaysind points in multiple layers

    #nterpolationind additional points !ased on 'alues of)no*n points

    Voronoi Diagrams of points

  • 8/10/2019 Aa Seminar - Seminar

    3/25

    Applicti!n "!#ins c!ntin$ed

    Computer +ided Design and "anufacturing (C+D C+"

    Design 3-D o!ects and manipulate them

    .ossi!le manipulations: merge (union, separate, mo'e Design for +ssem!ly

    C+DC+" pro'ides a test on o!ects for ease of assem!ly, mainte

    nance, etc/

    Computational 0iology

    Determine ho* proteins com!ine together !ased on folds i

    n structure $urface modeling, path finding, intersection

  • 8/10/2019 Aa Seminar - Seminar

    4/25

    C!#p$tti!nl Ge!#etry

    #ntersection of line segment

    0asic geometric o!ects

    .oint : ( 1, y

    %ine : (x1,y1 , (x2,y2

    %ine segment : si4e of line is gi'en

    (x2,y2)

    (x5,y5)

    (x2,y2)

    (x5,y5)

  • 8/10/2019 Aa Seminar - Seminar

    5/25

    Line Se%#ent Pr!perties

    6*o distinct points: p57(15,y5, p27(12,y2

    Define a ne* point p37 ap58(5-ap2, *here 9 a 5

    p3is any point on the line !et*een p5and p2

    p3is a convex combinationof p5and p2

    line segmentp5p2is the set of con'e1 com!inations of p5and p2/

    p5and p2are the endpoints of segment p5p2

    p1

    p2

    p3

    x

    y

  • 8/10/2019 Aa Seminar - Seminar

    6/25

    Cr!ss Pr!d$cts Can sol'e many geometric pro!lems using the cross product/

    6*o points: p57(15,y5, p27(12,y2 Cross product of the t*o points is defined !y

    p51 p27 the determinant of a matri1 15 12

    y5 y2

    7 15y2 12y5

    7 the signed area of the parallelogram of four points: (9,9, p5

    , p2

    , p5

    8p2

    #f p51 p2is positi'e then p5is cloc)*ise from p2

    #f p51 p2is negati'e then p5is countercloc)*ise from p2

    p1(x1,y1)

    p2(x2,y2)

    p1+p2

    x

    y

  • 8/10/2019 Aa Seminar - Seminar

    7/25

    Cl!c&'ise !r C!$ntercl!c&'ise .ro!lem definition

    Determine *hether a directed segment p9p5is cloc)*ise from a directed segment p9p2*/r/t/ p9

    $olution

    5/ "ap p9to (9,9, p5to p5;, p2to p2;

    p5; 7 p5 p9, p2; 7 p2 p9

    2/ #f p5; 1 p2; < 9 then the segment p9p5is cloc)*ise from p9p2

    3/ else countercloc)*ise

    p0

    p1

    p2

    a) p0p2is counterclockwise

    from p0p1: (p2-p0)x(p1-p0) < 0

    p0

    p2

    p1

    (b) p0p2is clockwise from p0p1:

    (p2-p0)x(p1-p0) 0

  • 8/10/2019 Aa Seminar - Seminar

    8/25

  • 8/10/2019 Aa Seminar - Seminar

    9/25

    Intersecti!n !( * Line Se%#ents

  • 8/10/2019 Aa Seminar - Seminar

    10/25

    T'! Se%#ents Intersect +*

    $i%e cases

    p1

    p&

    p2

    (a) p1p2, p3p&intersect

    p3

    p1

    p2

    p&

    (b) p1p2, p3p&'o not intersect

    p3

    p1

    p2

    p&

    p1p2, p3p&intersect

    p3

    p1

    p2

    p&

    (') p1p2, p3p&intersect

    p3p1

    p3

    p&

    (e) p1p2, p3p&'o not intersect

    p2

  • 8/10/2019 Aa Seminar - Seminar

    11/25

    T'! Se%#ents Intersect +-

    onsi'er two cross pro'ucts:

    1 (p3* p1) x (p2* p1)

    2 (p&* p1) x (p2* p1)

    p1

    p&

    p2

    (a) p1p2, p3p&intersect:

    (p3* p1) x (p2* p1) < 0

    (p&* p1) x (p2* p1) 0

    p3

    p1

    p2

    p&

    (b) p1p2, p3p&'o not intersect:

    (p3* p1) x (p2* p1) < 0

    (p&* p1) x (p2* p1) < 0

    p3

  • 8/10/2019 Aa Seminar - Seminar

    12/25

    T'! Se%#ents Intersect +.

    p1

    p2

    p&

    (c) p1p2, p3p&intersect

    (p3* p1) x (p2* p1) < 0

    (p&* p1) x (p2* p1) 0

    p3

    p1

    p2

    p&

    (') p1p2, p3p&intersect

    (p3* p1) x (p2* p1) 0

    (p&* p1) x (p2* p1) 0

    p3

  • 8/10/2019 Aa Seminar - Seminar

    13/25

    T'! Se%#ents Intersect +/

    Case (e

    =hat are the cross products > (p3 p5 1 (p2 p5 7 9

    (p? p5 1 (p2 p5 7 9

    6he cross products are 4ero;s, !ut they do not intersect

    $ame result *ith Case (d

    p1

    p3

    p4

    (e) p1p2, p3p&'o not intersect

    p2

  • 8/10/2019 Aa Seminar - Seminar

    14/25

    T'! Se%#ents Intersect 0 Al%!rit)#

    6*o@line@segments@intersect (p5p2, p3p?

    5/ (15;,y5;7(min(15,12, min(y5,y2

    2/ (12;,y2;7(ma1(15,12, ma1(y5,y2

    3/ (13;,y3;7(min(13,1?, min(y3,y?

    ?/ (1?;,y?;7(ma1(13,1?, ma1(y3,y?

    A/ if not ((13; 12; and (15; 1?; and (y3; y2; and (y5; y?; then

    B/ return false case (e and more

    / else

    / if (p3p5 1 (p2p5 or (p?p5 1 (p2p5 are 4ero then

    E/ return true case (c and (d59/ else if (p3p5 1 (p2p5 and (p?p5 1 (p2p5 ha'e different sign then

    55/ return true case (a

    52/ else

    53/ return false case (!

  • 8/10/2019 Aa Seminar - Seminar

    15/25

    Orderin% Se%#ents

    6*o nonintersecting segments s5and s2are compara!le at

    1 if the 'ertical s*eep line *ith 1 coordinate 1 intersects!oth of them/

    s5is a!o'e s2at 1, *ritten s5

  • 8/10/2019 Aa Seminar - Seminar

    16/25

    E1#ple

  • 8/10/2019 Aa Seminar - Seminar

    17/25

    M!2in% t)e S'eep Line

    $*eeping algorithms typically manage t*o sets of data:

    5/ 6he s*eep line status gi'es the relationships among the o!ects intersected !y the s*eep line/

    2/ 6he e'ent point schedule is a seFuence of 1 coordina

    tes, ordered from left to right, that defines the haltingpositions (e'ent points of the s*eep line/ Changes to

    the s*eep line status occur only at e'ent points/

    6he e'ent point schedule can !e determined dynamicall

    y as the algorithm progresses or determined statically, !a

    sed solely on simple properties of the input data/

  • 8/10/2019 Aa Seminar - Seminar

    18/25

    M!2in% t)e S'eep Line

    $ort the segment endpoints !y increasing 1 coordi

    nate and proceed from left to right/

    #nsert a segment into the s*eep line status *hen its left e

    ndpoint is encountered, and delete it from the s*eep line

    status *hen its right endpoint is encountered/ =hene'er t*o segments first !ecome consecuti'e in the t

    otal order, *e chec) *hether they intersect/

  • 8/10/2019 Aa Seminar - Seminar

    19/25

    M!2in% t)e S'eep Line

    6he s*eep line status is a total order 6/ for *hich *e reF

    uire the follo*ing operations: #$HR6(6, s: insert segment s into 6/

    DH%H6H(6, s: delete segment s from 6/

    +0VH(6, s: return the segment immediately a!o'e segment s

    in 6/ 0H%=(6, s: return the segment immediately !elo* segment

    s in 6/

    #f there are n segments in the input, *e can perform each

    of the a!o'e operations in (log n time Replace the )ey comparisons !y cross product compariso

    ns that determine the relati'e ordering of t*o segments/

  • 8/10/2019 Aa Seminar - Seminar

    20/25

  • 8/10/2019 Aa Seminar - Seminar

    21/25

    3)et)er P!int is Inside

    .ro!lem definition

    Gi'en a simple polygon . and a point F, determine *hether the point is insi

    de or outside the polygon/

    6he polygon can !e a non-con'e1 polygon

    Dra* a line from the point to a point outside of the polygon, count the num

    !er of intersections *ith the edges of the polygon/

    6he point is inside the polygon if the num!er of intersections is odd

  • 8/10/2019 Aa Seminar - Seminar

    22/25

    3)et)er P!int is Inside +*

    .oint@in@polygon(., F

    .: polygon *ith 'ertices p5, p2, //, pn, edges e5, e2, //, en

    F: point

    5/ pic) an ar!itrary point s outside the polygon

    2/ count 7 9

    3/ for all edges eiof the polygon do

    ?/ if eiintersects the line segment Fs then

    A/ count88

    B/ if count is odd then return true

    / else return false

    Comple1ity

    . (n *hen n 7 si4e of the polygon

  • 8/10/2019 Aa Seminar - Seminar

    23/25

    3)et)er P!int is Inside +-

    +ssume special cases don;t occur

    Case (a and (! !ser'ation

    #s it indeed important to find an optimal line (i/e/, the line segment Fs tha

    t minimi4es the num!er of intersections>

    o/ inding the num!er of intersections is more important

    #dea: Can use the 'ertical line that pass the point F

    s

    (a) s#oul' not count (b) s#oul' count

    s

  • 8/10/2019 Aa Seminar - Seminar

    24/25

    3)et)er P!int is Inside +.

    .oint@in@polygon@2(., F

    .: polygon *ith 'ertices p5, p2, //, pn, edges e5, e2, //, en

    F: point (19, y

    9

    5/ count 7 9

    2/ for all edges eiof the polygon do3/ if eiintersects the line 1719then

    ?/ yi7 y-coordinate of the intersection

    A/ if yiI y9then count88 this can !e yi< y9

    B/ if count is odd then return true

    / else return false

    Comple1ity

    .

    (n *hen n 7 si4e of the polygon

  • 8/10/2019 Aa Seminar - Seminar

    25/25

    THAN4 YO5