-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* CI tests * Added bounding box to jcv_diagram_generate() Input points are now culled against the bounding box Added .csv support to test program * Added missing file * Windown compile fixes * Added missing include for linux * Added an examples folder * Ensure to include stdlib.h for malloc/free (#14) * Updated max number of events that can be used at the same time (#16) * Increased the maximum number of events the priority queue can have * Added test for max num events
- Loading branch information
Showing
16 changed files
with
222 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#!/usr/bin/env bash | ||
mkdir -p build | ||
|
||
clang -c src/stb_wrapper.c -o build/stb_wrapper.o | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
echo off | ||
|
||
if NOT DEFINED VCINSTALLDIR ( | ||
if exist "C:\Program Files (x86)\Microsoft Visual Studio 15.0\VC\vcvarsall.bat" ( | ||
call "C:\Program Files (x86)\Microsoft Visual Studio 15.0\VC\vcvarsall.bat" amd64 | ||
echo "USING VISUAL STUDIO 15" | ||
) | ||
) | ||
|
||
if NOT DEFINED VCINSTALLDIR ( | ||
if exist "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ( | ||
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 | ||
echo "USING VISUAL STUDIO 14" | ||
) | ||
) | ||
|
||
if NOT DEFINED VCINSTALLDIR ( | ||
if exist "C:\Program Files (x86)\Microsoft Visual Studio 13.0\VC\vcvarsall.bat" ( | ||
call "C:\Program Files (x86)\Microsoft Visual Studio 13.0\VC\vcvarsall.bat" amd64 | ||
echo "USING VISUAL STUDIO 13" | ||
) | ||
) | ||
|
||
if NOT DEFINED VCINSTALLDIR ( | ||
if exist "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" ( | ||
call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 | ||
echo "USING VISUAL STUDIO 12" | ||
) | ||
) | ||
|
||
if NOT DEFINED VCINSTALLDIR ( | ||
echo "No compatible visual studio found! run vcvarsall.bat first!" | ||
) | ||
|
||
mkdir build | ||
|
||
cl.exe /nologo /O2 /D_CRT_SECURE_NO_WARNINGS /W4 -I.. simple.c /link /out:../../build/simple.exe | ||
|
||
del *.obj | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
BUILD_DIR=../../build | ||
mkdir -p $BUILD_DIR | ||
|
||
clang -Wall -Weverything -pedantic -Wno-float-equal simple.c -I.. -lm -o $BUILD_DIR/simple |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Contribution by: Abe Tusk https://github.com/abetusk | ||
// To compile: | ||
// gcc -Wall -Weverything -Wno-float-equal src/examples/simple.c -Isrc -o simple | ||
// | ||
|
||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <string.h> | ||
|
||
#define JC_VORONOI_IMPLEMENTATION | ||
// If you wish to use doubles | ||
//#define JCV_REAL_TYPE double | ||
//#define JCV_FABS fabs | ||
//#define JCV_ATAN2 atan2 | ||
#include "jc_voronoi.h" | ||
|
||
#define NPOINT 10 | ||
|
||
int main(int argc, char** argv) { | ||
(void)argc; | ||
(void)argv; | ||
|
||
int i; | ||
jcv_rect bounding_box = { { 0.0f, 0.0f }, { 1.0f, 1.0f } }; | ||
jcv_diagram diagram; | ||
jcv_point points[NPOINT]; | ||
const jcv_site* sites; | ||
jcv_graphedge* graph_edge; | ||
|
||
memset(&diagram, 0, sizeof(jcv_diagram)); | ||
|
||
srand(0); | ||
for (i=0; i<NPOINT; i++) { | ||
points[i].x = (float)(rand()/(1.0f + RAND_MAX)); | ||
points[i].y = (float)(rand()/(1.0f + RAND_MAX)); | ||
} | ||
|
||
printf("# Seed sites\n"); | ||
for (i=0; i<NPOINT; i++) { | ||
printf("%f %f\n", (double)points[i].x, (double)points[i].y); | ||
} | ||
|
||
jcv_diagram_generate(NPOINT, (const jcv_point *)points, &bounding_box, &diagram); | ||
|
||
printf("# Edges\n"); | ||
sites = jcv_diagram_get_sites(&diagram); | ||
for (i=0; i<diagram.numsites; i++) { | ||
|
||
graph_edge = sites[i].edges; | ||
while (graph_edge) { | ||
// This approach will potentially print shared edges twice | ||
printf("%f %f\n", (double)graph_edge->pos[0].x, (double)graph_edge->pos[0].y); | ||
printf("%f %f\n", (double)graph_edge->pos[1].x, (double)graph_edge->pos[1].y); | ||
graph_edge = graph_edge->next; | ||
} | ||
} | ||
|
||
jcv_diagram_free(&diagram); | ||
} |
Oops, something went wrong.