
This course includes our updated coding exercises so you can practice your skills as you learn.
See a demo
Explore how to set up and engage with the course on computational geometry, including the GitHub repository, resources, simulations, and interactive exercises to build practical algorithms.
Define computational geometry and its algorithms for 2d and 3d space, focusing on collision detection, convex hulls, and bounding boxes. Show how BSP space partitioning and multi-stage checks optimize performance.
Identify and master vector algebra operations, learn 2D and 3D primitives, lines and planes, implement a vector class, and perform distance, angle, and intersection queries plus point orientation w.r.t. line.
The lecture introduces points, lines, line segments, and rays; defines polygons as planar, bounded figures with edges, and distinguishes simple and complex and convex and concave polygons, polytopes and polyhedrons.
Explore practical visualization of vectors in 2d and 3d, distinguish scalars from vectors, and learn core operations, vector addition, subtraction, and scalar scaling, along with vector magnitude and normal vectors.
Compute the dot product of two vectors by multiplying their magnitudes with the cosine of the angle, yielding a scalar. Relate algebraic and geometric definitions; perpendicular vectors yield zero.
Explore the vector cross product in 3d space, using determinant methods for 2d and 3d cases, with the right-hand rule guiding direction and magnitude linked to parallelogram area.
Develop a templated vector class as the foundation for geometric primitives, supporting 2d and 3d, multiple numeric types, constructors, arithmetic operators, indexing, and dot and cross products.
Define and implement magnitude as the square root of the sum of squares, then normalize vectors by dividing each component by their magnitude to obtain unit direction vectors.
Classify a point's relative position to a directed line segment using two-dimensional cross products and area of triangle, defining left, right, on the line, on extended line, and beyond cases.
Study line representations from slope-intercept to the parametric form using a point and a direction vector. Apply normal form, half-planes, and intersections in a templated C++ line class.
Represent a plane in 3d with a normal and a point, deriving ax+by+cz=d where d=n·Q. Implement a C++ plane with point and normal constructors and three-point construction via cross product.
Learn to determine if two line segments intersect using orientation tests and endpoint side checks, combining results with xor, and prepare for computing the intersection point later.
Compute the intersection point of two lines using their parametric form, direction vectors, and a normal vector, then solve for the parameter and substitute to obtain coordinates.
Compute the angle between two lines in 2d and 3d using directional vectors, magnitudes, and dot products. Explore parallel, intersecting, and skew lines, with normalization of vectors for simplified calculations.
Compute the angle between a line and a plane using the line's direction and the plane's normal, then subtract from 90 degrees to obtain the plane angle.
Explore collinear tests to decide if points lie on the same line, and coplanar tests using the scalar triple product to check if four points share a plane.
Define the point-to-point distance in 2d and 3d, then derive the point-to-line distance by constructing the perpendicular to the line, finding the intersection, and measuring the distance.
Explore how to compute the distance from a point to a plane by projecting onto the plane along the plane normal, using dot products with a normalized normal vector.
Derive the intersection of a line and a plane in 2d/3d using the line’s parametric form, plane normal, and dot products; compute the intersection point or handle parallel cases.
Derive the line of intersection between two planes in 3-d space by using the cross product of normals for direction and solving plane equations to find a point on line.
Explore core data structures for geometric algorithms: stacks, queues, priority queues, and linked lists, with vectors; practice push, pop, top, front, back, and memory considerations for efficient C++.
Explore polygon partitioning through triangulation and monotone partitioning, then apply color-based guarding strategies for the art gallery problem, using three colors to bound the number of guards.
Explore polygon triangulation and the ear clipping algorithm, defining diagonals and ears, and learn how to represent a polygon, classify ear vertices, and iteratively remove ears until a triangle remains.
Build a simple polygon representation as a list of points using a vertex structure with next and previous pointers, in counterclockwise order, for 2d triangulation and dcel-based workflows.
Decide whether a line between two polygon vertices is a diagonal by checking edge intersections and applying an interior check, accounting for convex and reflex angles for ear clipping triangulation.
Demonstrates polygon triangulation by ear clipping, initializing vertex status, validating diagonals with neighboring vertices, clipping ears, updating neighbor statuses, and analyzing a quadratic-time algorithm.
Explore the doubly connected edge list representation for planar subdivisions, detailing vertices, half-edges, edges, and faces, including outer and inner boundaries and hole handling in counterclockwise conventions.
Construct a DCEL representation for a polygon by building vertices and half-edges with incident pointers in counterclockwise order, then define outer and inner faces and assign incident phases.
Explore DCEL utility functions for retrieving vertex lists and edges, and learn how to split a face by adding an edge between two vertices, updating pointers and incident faces.
Learn to partition polygons into monotone pieces by adding diagonals, using y-monotone and x-monotone concepts and vertex classifications to guide diagonal placement.
Explore monotone polygon partitioning with a plain see algorithm (plane sweep), using event points, a status structure, and helpers to connect diagonals at split and merge vertices.
Implement monotone polygon partitioning in C++ using a sweep-line approach, categorizing vertices into five types, ordering events by y, and maintaining a status structure for edges.
Leverage line segment intersection to solve real-world map queries and compute intersection points; use a variant of plenty algorithm with runtime proportional to input segments and output intersections.
Explore an output-sensitive line-segment intersection algorithm using a sweep line that checks only nearby segments whose windows overlap, processing endpoints and intersections via a status structure and events.
Explore the plane sweep algorithm for finding line segment intersections, handling event points, updating the sweep status, and recognizing all intersection forms between segments.
Implement the plane sweep algorithm to detect intersections among a set of line segments, using an event queue and a sweep line status stored as red-black trees.
Explore how convex hulls encapsulate two-dimensional and three-dimensional point sets, compare to other polygons, and enable efficient collision checks, home range analysis, and robust statistical estimation.
Builds a 2d convex hull using gift wrapping by starting at a bottom extreme point and selecting each next vertex with the minimum polar angle, producing a counterclockwise hull.
Modified Grahame's algorithm builds the 2D convex hull by constructing upper and lower hulls from a left-to-right sorted point set, using a stack and cross products.
Present an incremental 3d convex hull algorithm by starting with a tetrahedron from four non-coplanar points, then expand the hull with outside points while updating faces and edges.
Explore two essential utilities for 3d convex hulls: visible faces from a point and point inclusion checks, using cross products and scalar triple products.
Apply an incremental 3d convex hull implementation: start with four non-coplanar points forming a tetrahedron, then update faces and edges via visibility checks and orientation handling.
Explore binary search tree fundamentals, insertion operations, and the three traversals—pre-order, in-order, and post-order—along with balance, height, and logarithmic search efficiency.
Explore binary search tree operations, including search, minimum, maximum, and inorder predecessor and successor, with parent pointers and clean function design.
Explore the delete operation in a binary search tree, covering leaf, one-child, and two-children cases with successor or predecessor substitution and the transplant-based implementation.
Learn orthogonal range searching in two dimensions, using rectangle queries on age and salary, and compare brute force with tree-based structures for logarithmic-time searches.
Explore one-dimensional range queries on binary search trees, finding the split node and reporting leaves in the left and right subtrees to retrieve inclusive range values efficiently.
Explore kd trees as a space-partitioning data structure for organizing points in k dimensions, focusing on two-dimensional range queries and median-based construction.
Explore kd-tree range queries in two-dimensional space. Learn to represent node regions, perform inside and intersection tests, and traverse to report points within a rectangular search region.
Master KD trees by implementing the pre-positioning stage to assign region bounds to non-live nodes using bounding boxes and splitting lines, enabling efficient search queries.
Explore how k-d trees perform nearest neighbor queries by recursively traversing axis-aligned splits, using squared distances to prune branches and identify the closest point efficiently.
Learn how two-dimensional range trees pair a main x-tree with y-ordered associated trees to support efficient range queries. Build canonical subsets via medians for each node.
Learn how to answer two-dimensional range queries using range trees by decomposing into x and y one-dimensional queries, navigating split nodes, and querying associated trees.
Explore how quad trees enable non-uniform mesh generation for heat-transfer simulations on circuit boards, refining near components while preserving material borders and enabling efficient finite element computations.
Explore quad tree construction by bounding a data set in a root square and recursively dividing into four quadrants until each leaf holds at most one point.
Implement quad tree construction for a country data structure using axis-aligned bounding boxes. Create nodes with four children and a parent, partitioning recursively into quadrants until leaves hold a point.
Explore how to find neighboring squares in a quad tree, define balance in non-uniform subdivisions, and implement north, south, east, west neighbor and nearest and best neighbor logic.
Balance a quad tree by applying neighbor-based partition rules, splitting leaves that violate size constraints, updating nodes and neighbors, illustrated in the quadruple visualization app.
Explore graph theory basics and graph structures, including vertices and edges, and see real-world applications in social graphs, network routing, and vehicle routing, such as Google Maps.
Explore adjacency matrix representations for graphs, using a boolean matrix for undirected unweighted graphs and an integer matrix for weighted graphs, with add, delete, and print in C++.
explore the adjacency list representation of graphs, implementing vertex structures with unique ids and weights, and maintaining edge lists to support undirected graphs, degree-based operations, and comparisons to adjacency matrices.
Compare adjacency matrix and adjacency list representations for graphs, contrasting dense and sparse cases, and explain memory and time trade-offs for add, delete, and lookup operations.
Explore BFS to discover all vertices reachable from a source by expanding the frontier. Use a first-in, first-out queue and color states white, grey, and black to track progress.
implement breadth-first search in a simple graph by initializing vertex colors and distances, pushing source into queue, and traversing neighbors to mark grey, then black as exploration completes.
Explore the depth first search algorithm, marking vertices visited and gray, then recursively exploring unvisited neighbors via an adjacency list and backtracking. It runs in O(V+E).
Classification of edges in a predecessor subgraph reveals four types, tree edges, back edges, forward edges, and cross edges, and uses depth-first search color marking to detect cycles.
Learn to compute a topological order for directed acyclic graphs using dfs, finishing times, and front-insert to produce a valid order, with a c++ implementation.
Illustrates how to implement topological sort with depth-first search, manage a process list, and print vertices in topological order for a sample graph.
Identify strongly connected components in a graph by using reverse edges and a topological order, guided by a transpose graph and DFS, then implement in C++.
Implement the strongly connected components by building the graph's transpose, processing vertices in reverse topological order, and grouping nodes into SCCs.
Explore shortest path algorithms on graphs, focusing on single-source shortest path and its reduction from single-destination cases, handling negative weights and cycles with initialization and relaxation steps.
Learn how Bellman-Ford handles negative weights and detects negative cycles. See how initialization and relaxation yield the single-source shortest path in graphs.
Implement the Bellman-Ford algorithm in C++ by initializing vertices and distances, setting the start distance to zero, and performing vertex-1 relaxations to detect negative cycles.
Compute the single-source shortest path in a directed acyclic graph by processing vertices in topological order, initializing the source distance to zero, others to infinity, and relaxing edges.
Apply Dijkstra's algorithm to find shortest paths in weighted graphs with non-negative edges. Initialize distances to infinity, use a queue to extract the vertex with minimum distance and relax edges.
Explore a Dijkstra's algorithm implementation for the shortest path, contrasting a linked-list priority queue with a binary-tree priority queue, using extract-min and relax to update distances and handle duplicates.
Demonstrates Dijkstra's algorithm implementation in C++ using a priority queue and priority object, initializing the source vertex and state, relaxing edges, and validating shortest path on a sample graph.
Explore how minimum spanning trees connect all vertices in a weighted undirected graph with minimum total weight, using the cut-based approach to build a cycle-free tree.
Kruskal's algorithm introduces building a minimum spanning tree by adding edges in non decreasing weight order, skipping edges that would create a cycle, and uniting components with a union-find structure.
Explore Kruskal's algorithm for constructing a minimum spanning tree by sorting all edges in non-decreasing order, adding the smallest edge that connects two disjoint sets, and uniting them.
Explore Prim's algorithm for the minimum spanning tree, using cut-based edge selection and iterative MST construction, with a walkthrough and C++ pseudocode.
Implement prim's algorithm for building a minimum spanning tree using a priority queue, selecting edges from a source vertex and updating the MST.
Introduces flow networks to model material flows and find the maximum flow from factory to warehouse, explaining capacity constraints and flow conservation with super sources and sinks.
derive the max flow min cut theorem by examining cuts and capacities, and verify maximum flow with a concrete example before introducing the efficient algorithm to follow.
Computational Geometry algorithms have tons of applications in the fields like computer games, computer simulation, computer graphic, CAD/CAM software's, Navigation systems and many more day to day applications. But the data structure and algorithms fall under this category is still considered specialized area due to inherit complexities of those. To become fluent in computational geometry you need at least following knowledge.
Through knowledge on linear algebra and geometrical representation of those.
Mathematical representation of geometrical shapes.
Computational steps for primitive test like intersection and distance queries.
Good understanding on algorithms in computational geometry and where to use those.
In this course I will cover all the required knowledge for you to be fluent and confident on Computational Geometry. Following are the topic expected to cover in this course.
Topics
Basics of linear algebra including vector and matrix arithmetic and implementation of those operations.
Mathematical representation of basic geometry primitives and implementation.
Computational approach for finding intersections and distance between basic primitives like rectangles, lines, planes etc.
Orientation test on geometric primitives.
Polygon triangulation.
Monotone polygon partition.
Plane sweep algorithms.
Convex hull calculations and implementation in both 2D and 3D space.
Overview of simple tree data structures like Binary Search Trees (BST) and Red Black Tree (RBT)
KD Tree implementation and range queries using KDTrees.
Range Trees..
Graph Theory