CS110 Chapter Notes - Chapter 4: Convex Hull, Computational Geometry, Init
Document Summary
*note that line segment is made up of points, through makeline function as shown below: Format: line makeline(point a,point b: firstly, orientation of two line segments (formed by three points) is examined. Consider the line segments ab and bc below: Note that the gradient of line segment bc is greater than that of line segment ab, and when traversing from ab to bc, the orientation is anti-clockwise (i. e. turn left) The reverse is true, and the orientation is clockwise (i. e. turn right). Therefore, the orientation of three points can be determined by comparing the gradients of line segments formed by those points. Note that the orientation is returned as integer (i. e. 0 for colinear line segments, -1 for anti-clockwise direction and 1 for clockwise direction) Similarly, the orientation of two joined line segments is determined by comparing their gradients. Format: int orientationl(line a,line b: the second concept is intersection of two line segments.