Presentation is loading. Please wait.

Presentation is loading. Please wait.

Spatial Information Systems (SIS) COMP 30110 Terrain modeling and geometric problems (part 2)

Similar presentations


Presentation on theme: "Spatial Information Systems (SIS) COMP 30110 Terrain modeling and geometric problems (part 2)"— Presentation transcript:

1 Spatial Information Systems (SIS) COMP Terrain modeling and geometric problems (part 2)

2 Visibility Problems GIS query: “Is an entity located on the terrain visible from a given viewpoint?” Geometric problem: Intersection of lines andsurfaces Geometric problem: Intersection of lines and surfaces

3 Segment intersection problem: given a set of segments in the plane, calculate their intersections Segment intersection problems arise in several different contexts (example: map overlay, clipping in GIS and computer graphics, etc.) Segment intersection algorithms

4 Test all possible pairs of segments For a set of N segments: N (N-1) intersection tests 2 2 Time complexity O(N 2 ) Brute force algorithm

5 Exploits the so-called plane sweep technique We consider a straight line (called sweep line) that sweeps the plane In general, it is a vertical line that proceeds from left to right and stops at certain “events” This line partitions the plane into a left and a right half plane Bentley Ottmann Algorithm (1979)

6 Based on the fact that the set of intersections of N segments in the plane is the union of intersections that occur in the left half plane and of intersections that occur in the right half plane Bentley Ottmann Algorithm (cont.d)

7 Also based on the fact that in order for two segments to intersect, their respective intersections with the sweep line must become at some stage adjacent (e.g., s1 and s2) Bentley Ottmann Algorithm (cont.d) s1 s2

8 Event points: segment endpoints and intersections The intersection of the sweep line with the input segments contains all relevant information Two basic data structures: - event point schedule - sweep line status Bentley Ottmann Algorithm (cont.d)

9 Event point schedule: a sequence of x values ordered from left to right, defining the positions at which the sweep line will stop This is a dynamic structure as it is not entirely defined by the input data: it will be updated as intersection points are being found Bentley Ottmann Algorithm (cont.d)

10 Sweep line status: contains information about the intersections of the sweep line and the input segments This is a also dynamic structure being updated at each event point Bentley Ottmann Algorithm (cont.d)

11 Order relation between segments: Consider two non-intersecting segments s1 and s2 s1 and s2 are said to be comparable at abscissa x 0 if the vertical line x = x 0 intersects both s1 and s2 Bentley Ottmann Algorithm (cont.d) s1 s2 x = x 0

12 s1 is said to be above s2 at x 0 and indicated: s1 > x0 s2 if s1 and s2 are comparable at x 0 and the intersection of s1 with the vertical line x = x 0 is above the intersection of s2 with the vertical line x = x 0 Bentley Ottmann Algorithm (cont.d) s1 s2 x = x 0

13 As the vertical line moves from left to right the order relation between the segments changes. Segments can enter or leave the ordering as they may intersect or not the sweep line at a given value x The ordering will change only when: - the left endpoint of a segment is encountered (then the segment is added to the ordering) (then the segment is added to the ordering) - the right endpoint of a segment is encountered (then the segment is removed from the ordering) (then the segment is removed from the ordering) - an intersection point between two segments is encountered (then the two segments must exchange place in the ordering) (then the two segments must exchange place in the ordering) Bentley Ottmann Algorithm (cont.d)

14 s1 s2 s3 s1 added to the sweep line status s1 removed from the sweep line status s2 and s3 exchanged in the sweep line status

15 Bentley Ottmann Algorithm (cont.d) The sweep line status is a description of the relation > x0 i.e. it is a sequence of segments. The operations we perform on the sweep line status are: - Insertion - Deletion - Retrieve the segment immediately above or below a given segment in the sweep line status These operations should be performed efficiently (i.e., in time at most logarithmic in the number of segments contained in it)

16 Bentley Ottmann Algorithm (cont.d) The event point schedule contains all event points: - segment endpoints (known a priori) and - intersection points (calculated dynamically) Intersection points are not necessarily being processed as events at the time they are detected. It might be necessary to process other events before. p s1 s2 s3 Example:

17 Bentley Ottmann Algorithm (cont.d) The event point schedule should support the following operations efficiently (i.e. in logarithmic time): -Retrieve the smallest element in it - Insertion - Membership

18 Bentley Ottmann Algorithm (cont.d) Algorithm: Sort the endpoints of the input segments in lexicographic order by x and y and insert them in the event point schedule As the sweep line sweeps the plane, update the sweep line status at each event and test all segments that become adjacent for intersection If an intersection is detected for the first time, report the intersection and insert its abscissa into the event point schedule

19 Bentley Ottmann Algorithm (cont.d) No intersection is missed as all pairs of adjacent segments are correctly examined Complexity: O((n + k) log n) Where n is the number of segments and k is the number of intersections that occur among the n segments Intuitively: we have O(n+k) events and at each event we perform a constant number of operations that require logarithmic time (assuming that we use data structures that support operations in at most logarithmic time)

20 Summary Terrain modeling: polyhedral models (e.g. TINs) and gridded elevation models (RSGs) Examples of geometric problems associated with DTMs: - triangulation calculation (Watson’s algorithm) - intersection problems arising for example during visibility calculations (Bentley-Ottmann algorithm) An interesting reseach topic: multiresolution models (generate models using larger/smaller datasets and with different associated approximation errors)


Download ppt "Spatial Information Systems (SIS) COMP 30110 Terrain modeling and geometric problems (part 2)"

Similar presentations


Ads by Google