upload src
This commit is contained in:
parent
499878f944
commit
569dce62e5
@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.15.2)
|
||||
|
||||
# 设置工程名称和语言
|
||||
project(TETGEN)
|
||||
project(TRIANGLE)
|
||||
|
||||
message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME})
|
||||
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
cmd=${1}
|
||||
package=tetgen
|
||||
package=triangle
|
||||
address=/opt/stow
|
||||
targetdir=/usr/local
|
||||
|
||||
|
31
data/A.1.ele
Normal file
31
data/A.1.ele
Normal file
@ -0,0 +1,31 @@
|
||||
29 3 0
|
||||
1 29 2 1
|
||||
2 2 29 23
|
||||
3 25 24 23
|
||||
4 23 22 2
|
||||
5 25 23 29
|
||||
6 2 22 3
|
||||
7 3 21 4
|
||||
8 21 3 22
|
||||
9 4 21 20
|
||||
10 5 4 26
|
||||
11 19 26 4
|
||||
12 26 19 18
|
||||
13 19 4 20
|
||||
14 5 26 28
|
||||
15 12 14 13
|
||||
16 14 12 11
|
||||
17 11 10 9
|
||||
18 8 14 9
|
||||
19 8 15 14
|
||||
20 9 14 11
|
||||
21 6 27 7
|
||||
22 26 18 27
|
||||
23 5 28 6
|
||||
24 27 18 7
|
||||
25 28 27 6
|
||||
26 15 7 16
|
||||
27 7 15 8
|
||||
28 17 7 18
|
||||
29 7 17 16
|
||||
# Generated by ./build/bin/triangle -p data/A.poly
|
31
data/A.1.node
Normal file
31
data/A.1.node
Normal file
@ -0,0 +1,31 @@
|
||||
29 2 1 1
|
||||
1 0.20000000000000001 -0.77639999999999998 -0.56999999999999995 1
|
||||
2 0.22 -0.7732 -0.55000000000000004 1
|
||||
3 0.24560000000000001 -0.75639999999999996 -0.51000000000000001 1
|
||||
4 0.27760000000000001 -0.70199999999999996 -0.53000000000000003 1
|
||||
5 0.48880000000000001 -0.20760000000000001 0.28000000000000003 1
|
||||
6 0.50480000000000003 -0.20760000000000001 0.29999999999999999 1
|
||||
7 0.74080000000000001 -0.73960000000000004 0 1
|
||||
8 0.75600000000000001 -0.76119999999999999 -0.01 1
|
||||
9 0.77439999999999998 -0.77239999999999998 0 1
|
||||
10 0.80000000000000004 -0.77639999999999998 0.02 1
|
||||
11 0.80000000000000004 -0.79239999999999999 0.01 1
|
||||
12 0.57920000000000005 -0.79239999999999999 -0.20999999999999999 1
|
||||
13 0.57920000000000005 -0.77639999999999998 -0.20000000000000001 1
|
||||
14 0.62160000000000004 -0.77159999999999995 -0.14999999999999999 1
|
||||
15 0.63360000000000005 -0.76280000000000003 -0.13 1
|
||||
16 0.63919999999999999 -0.74439999999999995 -0.10000000000000001 1
|
||||
17 0.62080000000000002 -0.68440000000000001 -0.059999999999999998 1
|
||||
18 0.58720000000000006 -0.60440000000000005 -0.01 1
|
||||
19 0.36080000000000001 -0.60440000000000005 -0.23999999999999999 1
|
||||
20 0.31919999999999998 -0.70679999999999998 -0.39000000000000001 1
|
||||
21 0.312 -0.73960000000000004 -0.42999999999999999 1
|
||||
22 0.31840000000000002 -0.76119999999999999 -0.44 1
|
||||
23 0.33439999999999998 -0.77159999999999995 -0.44 1
|
||||
24 0.37119999999999997 -0.77639999999999998 -0.40999999999999998 1
|
||||
25 0.37119999999999997 -0.79239999999999999 -0.41999999999999998 1
|
||||
26 0.37440000000000001 -0.56999999999999995 -0.20000000000000001 1
|
||||
27 0.57440000000000002 -0.56999999999999995 0 1
|
||||
28 0.47360000000000002 -0.33079999999999998 0.14000000000000001 1
|
||||
29 0.20000000000000001 -0.79239999999999999 -0.58999999999999997 1
|
||||
# Generated by ./build/bin/triangle -p data/A.poly
|
34
data/A.1.poly
Normal file
34
data/A.1.poly
Normal file
@ -0,0 +1,34 @@
|
||||
0 2 1 1
|
||||
29 1
|
||||
1 29 1 1
|
||||
2 2 1 1
|
||||
3 2 3 1
|
||||
4 4 3 1
|
||||
5 4 5 1
|
||||
6 5 6 1
|
||||
7 7 6 1
|
||||
8 8 7 1
|
||||
9 9 8 1
|
||||
10 10 9 1
|
||||
11 10 11 1
|
||||
12 11 12 1
|
||||
13 13 12 1
|
||||
14 13 14 1
|
||||
15 15 14 1
|
||||
16 15 16 1
|
||||
17 17 16 1
|
||||
18 18 17 1
|
||||
19 19 18 1
|
||||
20 19 20 1
|
||||
21 20 21 1
|
||||
22 22 21 1
|
||||
23 22 23 1
|
||||
24 24 23 1
|
||||
25 25 24 1
|
||||
26 25 29 1
|
||||
27 26 27 1
|
||||
28 27 28 1
|
||||
29 28 26 1
|
||||
1
|
||||
1 0.46999999999999997 -0.5
|
||||
# Generated by ./build/bin/triangle -p data/A.poly
|
62
data/A.poly
Normal file
62
data/A.poly
Normal file
@ -0,0 +1,62 @@
|
||||
29 2 1 0
|
||||
1 0.200000 -0.776400 -0.57
|
||||
2 0.220000 -0.773200 -0.55
|
||||
3 0.245600 -0.756400 -0.51
|
||||
4 0.277600 -0.702000 -0.53
|
||||
5 0.488800 -0.207600 0.28
|
||||
6 0.504800 -0.207600 0.30
|
||||
7 0.740800 -0.739600 0
|
||||
8 0.756000 -0.761200 -0.01
|
||||
9 0.774400 -0.772400 0
|
||||
10 0.800000 -0.776400 0.02
|
||||
11 0.800000 -0.792400 0.01
|
||||
12 0.579200 -0.792400 -0.21
|
||||
13 0.579200 -0.776400 -0.2
|
||||
14 0.621600 -0.771600 -0.15
|
||||
15 0.633600 -0.762800 -0.13
|
||||
16 0.639200 -0.744400 -0.1
|
||||
17 0.620800 -0.684400 -0.06
|
||||
18 0.587200 -0.604400 -0.01
|
||||
19 0.360800 -0.604400 -0.24
|
||||
20 0.319200 -0.706800 -0.39
|
||||
21 0.312000 -0.739600 -0.43
|
||||
22 0.318400 -0.761200 -0.44
|
||||
23 0.334400 -0.771600 -0.44
|
||||
24 0.371200 -0.776400 -0.41
|
||||
25 0.371200 -0.792400 -0.42
|
||||
26 0.374400 -0.570000 -0.2
|
||||
27 0.574400 -0.570000 0
|
||||
28 0.473600 -0.330800 0.14
|
||||
29 0.200000 -0.792400 -0.59
|
||||
29 0
|
||||
1 29 1
|
||||
2 1 2
|
||||
3 2 3
|
||||
4 3 4
|
||||
5 4 5
|
||||
6 5 6
|
||||
7 6 7
|
||||
8 7 8
|
||||
9 8 9
|
||||
10 9 10
|
||||
11 10 11
|
||||
12 11 12
|
||||
13 12 13
|
||||
14 13 14
|
||||
15 14 15
|
||||
16 15 16
|
||||
17 16 17
|
||||
18 17 18
|
||||
19 18 19
|
||||
20 19 20
|
||||
21 20 21
|
||||
22 21 22
|
||||
23 22 23
|
||||
24 23 24
|
||||
25 24 25
|
||||
26 25 29
|
||||
27 26 27
|
||||
28 27 28
|
||||
29 28 26
|
||||
1
|
||||
1 0.47 -0.5
|
@ -1,54 +1,67 @@
|
||||
# 设定源文件文件夹
|
||||
aux_source_directory(lib TETGENLIB_SRC)
|
||||
aux_source_directory(lib TRILIB_SRC)
|
||||
# 设置编译选项
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
|
||||
|
||||
# 以下部分为库的编译
|
||||
# 注意目标名必须唯一 所以不能直接生成相同名称的动态库与静态库
|
||||
# 注意此处不必为目标名称添加lib前缀和相应后缀,cmake会自行添加
|
||||
add_library(tetlib SHARED ${TETGENLIB_SRC})
|
||||
add_library(trilib SHARED ${TRILIB_SRC})
|
||||
# 首先添加静态库的生成命令
|
||||
add_library(tetlib_static STATIC ${TETGENLIB_SRC})
|
||||
add_library(trilib_static STATIC ${TRILIB_SRC})
|
||||
# 设置编译选项 将源代码编译为动态与静态库
|
||||
# 设置静态库的输出名称从而获得与动态库名称相同的静态库
|
||||
set_target_properties(tetlib PROPERTIES OUTPUT_NAME "tetgen")
|
||||
set_target_properties(tetlib_static PROPERTIES OUTPUT_NAME "tetgen")
|
||||
set_target_properties(trilib PROPERTIES OUTPUT_NAME "triangle")
|
||||
set_target_properties(trilib_static PROPERTIES OUTPUT_NAME "triangle")
|
||||
# 设置库的编译选项
|
||||
set_target_properties(trilib PROPERTIES COMPILE_DEFINITIONS "TRILIBRARY")
|
||||
set_target_properties(trilib_static PROPERTIES COMPILE_DEFINITIONS "TRILIBRARY")
|
||||
# 设置输出目标属性以同时输出动态库与静态库
|
||||
set_target_properties(tetlib PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
||||
set_target_properties(tetlib_static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
||||
set_target_properties(trilib PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
||||
set_target_properties(trilib_static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
||||
# 设置动态库的版本号
|
||||
set_target_properties(tetlib PROPERTIES VERSION 1.5.1 SOVERSION 1.5.1)
|
||||
set_target_properties(trilib PROPERTIES VERSION 1.6 SOVERSION 1.6)
|
||||
# 设置库文件的输出地址
|
||||
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
|
||||
|
||||
# 库的安装命令
|
||||
if(WIN32)
|
||||
install(TARGETS tetlib DESTINATION lib)
|
||||
install(TARGETS tetlib_static DESTINATION lib)
|
||||
install(TARGETS trilib DESTINATION lib)
|
||||
install(TARGETS trilib_static DESTINATION lib)
|
||||
else()
|
||||
install(TARGETS tetlib tetlib_static
|
||||
install(TARGETS trilib trilib_static
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
endif()
|
||||
# 头文件安装命令
|
||||
install(FILES lib/tetgen.h DESTINATION include)
|
||||
install(FILES lib/triangle.h DESTINATION include)
|
||||
|
||||
|
||||
# 设置可执行文件的输出地址
|
||||
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||
|
||||
# 以下为可执行命令行工具的编译
|
||||
# 设定源文件文件夹
|
||||
aux_source_directory(tool TETGEN_SRC)
|
||||
# 添加可执行文件
|
||||
add_executable(tetgen ${TETGEN_SRC})
|
||||
add_executable(triangle ${TRILIB_SRC})
|
||||
# 命令行工具安装命令
|
||||
install(TARGETS tetgen RUNTIME DESTINATION sbin)
|
||||
install(TARGETS triangle RUNTIME DESTINATION sbin)
|
||||
|
||||
# 设定源文件文件夹
|
||||
aux_source_directory(tool SHOWME_SRC)
|
||||
# 设置X11的地址
|
||||
include_directories(/opt/X11/include)
|
||||
# 添加可执行文件
|
||||
add_executable(showme_triangle ${SHOWME_SRC})
|
||||
# 链接动态库
|
||||
find_library(X_LIBRARY X11 /opt/X11/lib)
|
||||
target_link_libraries(showme_triangle PUBLIC ${X_LIBRARY})
|
||||
# 命令行工具安装命令
|
||||
install(TARGETS showme_triangle RUNTIME DESTINATION sbin)
|
||||
|
||||
# 以下部分为例子程序的编译
|
||||
# 添加可执行文件
|
||||
add_executable(tetcall sample/tetcall.cxx)
|
||||
add_executable(tricall sample/tricall.cxx)
|
||||
# 为安装文件添加动态库的搜索地址 在Windows下并没有什么用 直接忽略
|
||||
set_target_properties(tetcall PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
set_target_properties(tricall PROPERTIES INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib)
|
||||
# 链接动态库
|
||||
target_link_libraries(tetcall PUBLIC tetlib)
|
||||
target_link_libraries(tricall PUBLIC trilib)
|
||||
|
@ -248,42 +248,58 @@
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef _TRIANGLE_H
|
||||
#define _TRIANGLE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
#define REAL double
|
||||
#define ANSI_DECLARATORS
|
||||
#define VOID int
|
||||
|
||||
struct triangulateio {
|
||||
REAL *pointlist; /* In / out */
|
||||
REAL *pointattributelist; /* In / out */
|
||||
int *pointmarkerlist; /* In / out */
|
||||
int numberofpoints; /* In / out */
|
||||
int numberofpointattributes; /* In / out */
|
||||
REAL *pointlist; /* In / out */
|
||||
REAL *pointattributelist; /* In / out */
|
||||
int *pointmarkerlist; /* In / out */
|
||||
int numberofpoints; /* In / out */
|
||||
int numberofpointattributes; /* In / out */
|
||||
|
||||
int *trianglelist; /* In / out */
|
||||
REAL *triangleattributelist; /* In / out */
|
||||
REAL *trianglearealist; /* In only */
|
||||
int *neighborlist; /* Out only */
|
||||
int numberoftriangles; /* In / out */
|
||||
int numberofcorners; /* In / out */
|
||||
int numberoftriangleattributes; /* In / out */
|
||||
int *trianglelist; /* In / out */
|
||||
REAL *triangleattributelist; /* In / out */
|
||||
REAL *trianglearealist; /* In only */
|
||||
int *neighborlist; /* Out only */
|
||||
int numberoftriangles; /* In / out */
|
||||
int numberofcorners; /* In / out */
|
||||
int numberoftriangleattributes; /* In / out */
|
||||
|
||||
int *segmentlist; /* In / out */
|
||||
int *segmentmarkerlist; /* In / out */
|
||||
int numberofsegments; /* In / out */
|
||||
int *segmentlist; /* In / out */
|
||||
int *segmentmarkerlist; /* In / out */
|
||||
int numberofsegments; /* In / out */
|
||||
|
||||
REAL *holelist; /* In / pointer to array copied out */
|
||||
int numberofholes; /* In / copied out */
|
||||
REAL *holelist; /* In / pointer to array copied out */
|
||||
int numberofholes; /* In / copied out */
|
||||
|
||||
REAL *regionlist; /* In / pointer to array copied out */
|
||||
int numberofregions; /* In / copied out */
|
||||
REAL *regionlist; /* In / pointer to array copied out */
|
||||
int numberofregions; /* In / copied out */
|
||||
|
||||
int *edgelist; /* Out only */
|
||||
int *edgemarkerlist; /* Not used with Voronoi diagram; out only */
|
||||
REAL *normlist; /* Used only with Voronoi diagram; out only */
|
||||
int numberofedges; /* Out only */
|
||||
int *edgelist; /* Out only */
|
||||
int *edgemarkerlist; /* Not used with Voronoi diagram; out only */
|
||||
REAL *normlist; /* Used only with Voronoi diagram; out only */
|
||||
int numberofedges; /* Out only */
|
||||
};
|
||||
|
||||
#ifdef ANSI_DECLARATORS
|
||||
void triangulate(char *, struct triangulateio *, struct triangulateio *,
|
||||
struct triangulateio *);
|
||||
void trifree(VOID *memptr);
|
||||
void triangulate(char *, struct triangulateio *, struct triangulateio *, struct triangulateio *);
|
||||
void trifree(VOID *memptr);
|
||||
#else /* not ANSI_DECLARATORS */
|
||||
void triangulate();
|
||||
void trifree();
|
||||
void triangulate();
|
||||
void trifree();
|
||||
#endif /* not ANSI_DECLARATORS */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // _TRIANGLE_H
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "triangle.h"
|
||||
#include "../lib/triangle.h"
|
||||
|
||||
/*****************************************************************************/
|
||||
/* */
|
||||
@ -37,15 +37,8 @@
|
||||
/* */
|
||||
/*****************************************************************************/
|
||||
|
||||
void report(io, markers, reporttriangles, reportneighbors, reportsegments,
|
||||
reportedges, reportnorms)
|
||||
struct triangulateio *io;
|
||||
int markers;
|
||||
int reporttriangles;
|
||||
int reportneighbors;
|
||||
int reportsegments;
|
||||
int reportedges;
|
||||
int reportnorms;
|
||||
void report(triangulateio *io, int markers, int reporttriangles, int reportneighbors,
|
||||
int reportsegments, int reportedges, int reportnorms)
|
||||
{
|
||||
int i, j;
|
||||
|
3375
src/tool/showme.c
Normal file
3375
src/tool/showme.c
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user