我的工作涉及到网格的生成和处理。我用创建网格,用自己的代码读取GMSH的输出。在我的代码中,我定义了几何形状,如四边形、四面体等。我想使用一个计算几何库来定义形状,并执行所有的几何操作,如相交检测和二叉树、面积计算。我看了一下著名的CGAL,但是它只为2D and 3D Linear Geometry Kernel中的四边形提供了轴线对齐的几何图形( Iso_rectangular_2和2D and 3D Linear Geometry Kernel)。旋转网格不是一个解决方案,因为网格不需要是笛卡尔的,而是可以由多种形状(三角形、四边形)混合而成。CGAL确实提供非轴对齐的四元数吗?CGAL
我希望用CGAL实现α形状。
@sloriot提供了和我的定制之后:
from sys import *
path.append("../../cgal_package")
from CGAL.Alpha_shapes_2 import *
from CGAL.Triangulations_2 import Delaunay_triangulation_2
from CGAL.Kernel import *
from random import *
import matplotlib.pyplot as plt
from matplotlib.font_manager i
在我看来,CGAL文档并没有很好的文档化。我完全不知道如何在Python中使用它们的包。
我已经在我的Windows上安装了CGAL-4.3,并且我尝试这样做
In [233]: """ python 2.4"""
.....: from CGAL.Alpha_shapes_2 import *
.....: from CGAL.Triangulations_2 import Delaunay_triangulation_2
.....: from CGAL.Kernel import *
.....: from Shap
我的问题可能是由于CGAL c++库中的新鲜感,但我一直在逃避任务。也就是说,我想要找到一组点的α形状,但我似乎不理解二维α形状可用的迭代器。
这就是我试过的:
Alpha_shape_2 alpha(pointsVec.begin(), pointsVec.end(), FT(1000), Alpha_shape_2::GENERAL);
//which compiles nicely and provides the regular output where pointsVec is the list of Point_2
//Then I saw the edge iterator a