Skip to content

Pyother/voronoi-diagram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Voronoi_Diagram

This repository contains a simple implementation of 2D Voronoi Diagram calculated for three random points. Points always form acute triangle.

Table of contents

Introduction

Algorithm at the beginning randomly generates points on the board. At the same time, it is verified that the points are not too close to each other.

obraz

Next, objects representing lines between points and the centers of the lines are created.

obraz

Parametres of the circle described on this triangle are determined.

obraz

The next step is to determine the connections between the centers of the line and the center of the circle.

obraz

To obtain a Voronoi diagram for an acute triangle, it is necessary to determine the points of intersection of the pink lines with the lines x = 0 and x = 500 (frame sizes). If the intersection point is to the left of the center of the circle, then the line is routed to the intersection with the line x = 0, and the left side of the line intersects with x = 500.

obraz

At the end, you can cover the intersection points, the center of the circle and the sides of the triangle. Thus, we obtain the Voronoi diagram.

obraz

Technologies

The project was made entirely in Java. The paint method was used to draw elements, thanks to which the interface of the frame was designed.

List of crucial classes:

  • java.util.Arrays (storing data)
  • java.util.Random (random points)
  • javax.swing (frame interface)
  • java.awt (geometric structures)

Sources

Links to useful pages:

About

Implementation of Voronoi Diagram in Java.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages