Click here to Skip to main content
Click here to Skip to main content

Tagged as

Fast Voronoi Diagram in C#

, 15 Jul 2014 CPOL
Rate this:
Please Sign up or sign in to vote.
Fortune Voronoi Diagram in C#

Introduction

This project implements Steve Fortune's algorithm for Voronoi diagram in C#.

I translated the algorithm to C# from Zhenyu Pan's Java version.

The Project

The project is divided into two parts:

  1. Files: Voronoi.cs, VoronoiElements.cs are the algorithm itself, for your projects, you need these files.
  2. The program itself is a simple demonstration to test the code and show how it is used.

The project is done in SharpDevelop, EXE file is found in \Voronoi2\bin\Debug\ path.

How to Use the Code in Your Projects

This is very simple, you need the files: Voronoi.cs, VoronoiElements.cs.

In your code, create a "Voronoi" object.

Create two arrays for X, Y coordinates of any given set of locations.

Use the function "generateVoronoi", provide the function with those arrays.

For example:

// Create Voronoi Object
Voronoi voroObject = new Voronoi ( Error_Margin_Between_Sites );
// Generate the diagram
List<GraphEdge> ge = voroObject.generateVoronoi ( xVal, yVal, 0, width, 0, height );
// where xVal, yVal are arrays for X,Y coordinates,
// the remaining parameters describe the surrounding box around all the sites
// ge the resulting Voronoi Edges

You get a List of voronoi edges. "ge" in the example.

The code doesn't calculate Voronoi Cells, but having those edges you can do it easily.

References

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Burhan Joukhadar

United States United States
No Biography provided

Comments and Discussions

 
GeneralEXCELLENT!!! Pinmemberpan0547-Dec-14 9:58 
QuestionWell Done. Pinmemberbwishniak20-Aug-14 11:01 
AnswerRe: Well Done. PinmemberBurhan Joukhadar21-Aug-14 13:19 
GeneralMy vote of 5 [modified] PinmemberAB Yazan Ghoka18-Jul-14 10:40 
GeneralRe: My vote of 5 PinmemberBurhan Joukhadar18-Jul-14 10:49 
GeneralMy vote of 5 PinmemberTheQult16-Jul-14 0:14 
GeneralRe: My vote of 5 PinmemberBurhan Joukhadar18-Jul-14 4:45 
GeneralMy vote of 1 PinmemberJackson Savitraz15-Jul-14 21:29 
GeneralRe: My vote of 1 PinmemberBurhan Joukhadar18-Jul-14 4:37 
GeneralMy vote of 1 Pinmvp.dan.g.15-Jul-14 20:49 
GeneralRe: My vote of 1 PinmemberBurhan Joukhadar18-Jul-14 4:37 
GeneralRe: My vote of 1 Pinmvp.dan.g.18-Jul-14 18:16 
GeneralMy vote of 1 Pinmemberpstjean15-Jul-14 13:56 
GeneralRe: My vote of 1 PinmemberBurhan Joukhadar18-Jul-14 10:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.141220.1 | Last Updated 15 Jul 2014
Article Copyright 2014 by Burhan Joukhadar
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid