Related Topics

Vectors

Mathematical quantities having both magnitude and direction. A vector consists of several components , one for each axis of the coordinate system. If we draw a vector as a line segment starting at the origin, a vector’s components are values that describe how far we must move along each axis to reach the point at which the vector ends. Some operations with vectors include addition, subtraction, dot products, cross products, and magnitudes.

Testing whether any two line segments intersect

A generalization of the test provided earlier in this chapter for determining whether two line segments intersect. However, rather than simply applying this test over and over again to test whether any line segments in a set intersect, it is best to use a dedicated approach. Using a dedicated approach, the problem can be solved in O (n lg n) time, where n is the number of line segments.

Graham’s scan

An alternative approach to Jarvis’s march for computing convex hulls. Graham’s scan works by maintaining a stack of candidate points for the convex hull. Each point is pushed onto the stack once. All points not in the convex hull are eventually popped off the stack so that when the algorithm terminates, the stack contains only the points in the convex hull. Graham’s scan has a runtime complexity of O (n lg n), where n is the number of points in the set to enclose.

Get Mastering Algorithms with C now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.