Skip to content

kanitsch/Location-of-the-point-using-the-trapezoidal-method

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

41 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ 2D Point Location using the Trapezoidal Map Method πŸš€

Welcome to the 2D Point Location project! πŸ‘‹ This project implements the trapezoidal map method to locate a point in a 2D plane using a randomized incremental algorithm. πŸ—ΊοΈ The program allows you to manually input segments, generate random segments, and visualize the process of building the trapezoidal map and locating a point. 🎨

🧠 Algorithm Overview

The trapezoidal map method is a geometric algorithm used to partition a 2D plane into trapezoids (or triangles) based on a set of non-intersecting line segments. πŸ—ΊοΈ The goal is to quickly determine which trapezoid contains a given query point. πŸ”

The algorithm works in two main steps:

Build the Trapezoidal Map: Construct a map by incrementally adding segments in random order, splitting the plane into trapezoids.

Point Location: Use a search structure (DAG) to efficiently locate the trapezoid containing the query point.

πŸ› οΈ How It Works

Input: A set of non-intersecting line segments and a query point. πŸ“

Trapezoidal Map Construction:

Start with a bounding box that contains all segments.

Add segments one by one in random order, splitting the existing trapezoids into smaller trapezoids.

Update the search structure (DAG) to reflect the new trapezoids.

Point Location:

Traverse the DAG to find the trapezoid containing the query point.

The search is efficient, with a complexity of O(log n).

✨ Features

Randomized Incremental Algorithm: Segments are added in random order, ensuring an expected O(n log n) construction time. 🎲

Visualization: The program provides visualizations of the trapezoidal map construction and point location process. πŸ–ΌοΈ

Interactive Input: You can manually draw segments or generate random ones. πŸ–±οΈ

Efficient Query: Locate a point in O(log n) time using the search structure. πŸ”

πŸš€ Usage

Run the Program: Open the main file nitsch_sankowska_kod in your preferred Python environment (e.g., PyCharm, VSCode). πŸ–₯️

Input Segments:

Manually draw segments using the mouse. πŸ–±οΈ

Or generate random segments using generate_segments(n, x_range, y_range).

Visualize:

Watch the trapezoidal map being built step by step. πŸŽ₯

Locate a point and see which trapezoid it falls into. πŸ”

⏱️ Complexity Analysis

Construction Time: O(n log n) expected time to build the trapezoidal map. πŸ—οΈ

Query Time: O(log n) to locate a point in the map. πŸ”

Thanks for checking out our project! 😊 If you have any questions or suggestions, feel free to open an issue or contact us! πŸ“©

Authors: Maja Sankowska, Karolina Nitsch

About

This repository contains a Python implementation of the Trapezoidal Map Method for 2D point location, developed as part of the Computational Geometry course at AGH University of Science and Technology.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Jupyter Notebook 100.0%