Skip to main content

Geometry

  • Chapter
  • First Online:
Guide to Competitive Programming

Part of the book series: Undergraduate Topics in Computer Science ((UTICS))

  • 195k Accesses

Abstract

This chapter discusses algorithm techniques related to geometry. The general goal of the chapter is to find ways to conveniently solve geometric problems, avoiding special cases and tricky implementations. Section 13.1 introduces the C++ complex number class which has useful tools for geometric problems. After this, we will learn to use cross products to solve various problems, such as testing whether two line segments intersect and calculating the distance from a point to a line. Finally, we discuss ways to calculate polygon areas and explore special properties of Manhattan distances. Section 13.2 focuses on sweep line algorithms which play an important role in computational geometry. We will see how to use such algorithms for counting intersection points, finding closest points, and constructing convex hulls.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    Creating an efficient algorithm for the closest pair problem was once an important open problem in computational geometry. Finally, Shamos and Hoey [26] discovered a divide and conquer algorithm that works in \(O(n \log n)\) time. The sweep line algorithm presented here has common elements with their algorithm, but it is easier to implement.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Antti Laaksonen .

Rights and permissions

Reprints and permissions

Copyright information

© 2017 Springer International Publishing AG

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Laaksonen, A. (2017). Geometry. In: Guide to Competitive Programming. Undergraduate Topics in Computer Science. Springer, Cham. https://doi.org/10.1007/978-3-319-72547-5_13

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-72547-5_13

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-72546-8

  • Online ISBN: 978-3-319-72547-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics