Skip to content

Commit 49b17a1

Browse files
committed
Update documentation in README.md
1 parent ecebce6 commit 49b17a1

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# polyboolean
22
Background
33

4-
The C codes in this repository are extracted and extended from one Computer Aided Engineering (CAE) project. The main goal is to get intersections or unions of two 3D convex polygons. The codes emphasize the implementation of a general algorithm for Boolean operations of polygons, in which the intersection and inner points are used to construct new polygon for each Boolean operation. This algorithm is similar to the widely known Sutherland-Hodgman algorithm for convex polygon clipping, and implement general idea for both intersection and merge operations.
4+
The C codes in this repository are extracted and extended from one Computer Aided Engineering (CAE) project. The main goal is to get intersections or unions of two 3D convex polygons. The codes emphasize the implementation of a general algorithm for Boolean operations of polygons, in which the intersection and inner points are used to construct new polygon for each Boolean operation. This algorithm is similar to the widely known Sutherland-Hodgman algorithm for convex polygon clipping, and implements general idea for both intersection and merge operations.
55

66
Data structure
77

8-
The data structure for polygons is just array in built-in floating number which represents ordered points set in 3D space. The order of points set in the first (poly1) and second (poly2) polygon should be identical (both clockwise or both counterclockwise if viewing along a certain direction). Obviously the polygons should be planar (or approximately planar based on geometric tolerance) for valid Boolean operations. The reason why the polygons are 3D is that the application scenarios in CAE is always three dimensional and some approximate cases should be treated. Because the focus of functions in the codes is on Boolean operations of two polygons, no extra tree-like data structure is introduced to improve the efficiency of geometric calculation, which is commonly used in Boolean operations of polygons (graphs) in large amount. The application in CAE shows the codes are efficient if the number of points and Boolean operations are not larger than 1M.
8+
The data structure for polygons is just array in built-in floating number which represents ordered points set in 3D space. The order of points set in the first (poly1) and second (poly2) polygon should be identical (both clockwise or both counterclockwise if viewing along a certain direction). Obviously the polygons should be planar (or approximately planar based on geometric tolerance) for valid Boolean operations. The reason why the polygons are 3D is that the application scenarios in CAE are always three dimensional and some approximate cases should be treated. Because the focus of functions in the codes is on Boolean operations of two polygons, no extra tree-like data structure is introduced to improve the efficiency of geometric operations, which is commonly used in Boolean operations of polygons (graphs) in large amount. The application in CAE shows the codes are efficient if the number of points and Boolean operations are not larger than 1M.
99

1010
Algorithm
1111

@@ -17,10 +17,18 @@ There is a Makefile in this repository, just type
1717

1818
make
1919

20-
in a Unix-like OS environment in which gcc has been deployed, then a shared library named "libpolyboolean.so" and an exec named "polyop" will be generated. You can also use the script in file cclib2exe to build this programme.
20+
in a Unix-like OS environment in which gcc has been deployed, then a shared library named "libpolyboolean.so" and an exec named "polyop" will be generated. You can also use the script in file cclib2exe to build this programme.
2121

2222
The codes in source file main.c represent some examples which call Boolean operation functions in source file convex_poly_boolean.c. The examples include
2323
1. intersection and union sets of two moving triangles.
2424
2. intersection and union sets between one static hexagon and one moving square.
2525

26-
Note that enough memory should be allocated for result polygon after Boolean operations. There are comments in source file convex_poly_boolean.c, which describe each geometric function. The functions in section of basic geometry calculation are low-level and can be used for other target of computational geometry.
26+
There is a golden file output_golden which records all the ouputs of examples, after running exec file like
27+
28+
bin/polyop > output
29+
30+
the accuracy of the codes can be monitored using the command
31+
32+
diff output output_golden
33+
34+
Note that enough memory should be allocated for result polygons after Boolean operations. There are comments in source file convex_poly_boolean.c, which describe each Boolean operation and helper function. The functions in geometry3d_basic.c belong to low-level geometric operations and can be used for other targets of computational geometry.

0 commit comments

Comments
 (0)