摘要3D打印机(一种快速成形技术的机器),以数字模型文件为基础,直接从计算机图形数据中生成任意几何图形的模型,产品的生产时间被极大地缩减了,生产效率也随之提高。而计算几何作为一门主要研究几何模型和数据处理的数学,又是计算机科学领域中的重要分支之一,其研究成果在3D打印机中的模型建立及设计过程中发挥着重要的作用。如何为各种模型设计有效的基础算法以及理论依据,一直是国内外学者研究的方向。19969
本毕业论文通过对3D打印机Python源代码的解读,利用C语言,每一层的多边形面积及任意两条直线的夹角,采用向量叉积等多种几何算法进行算法设计。另外,增加计算任意两条线段的交点以及判断一个多边形是否为凸多边形二个功能来完善程序。
主要对于多边形面积的计算,本文主要将求解多边形面积的问题转化为求解多个三角形面积之和的方法来计算,利用 (其中 及 式设计算法。另外,利用atan反正切函数(C++)对任意直线间的夹角计算,设计出有效的算法。
最后,利用上述设计的算法,得出有效计算分层层面相关几何问题的程序。
关键词:数字模型 模型建立 向量叉积 反正切函数
Application of computational geometry in the 3D printer
Abstract:
3D printer (a rapid photo typing technology machines), based on the digital model file, generates any geometry model data directly from the computer graphics. Its producing time is greatly reduced and production efficiency is highly increased. As a major study of mathematics and geometry data processing, the computational geometry research plays an important role in the 3D printer model and design process .A research that how to design an effective model for a variety of basic algorithms and theory has been the direction of research scholars at home and abroad.
This paper design the algorithm through the interpretation of the 3D printer Python source code, using C language and hierarchical level polygon model to calculate the area and any angle between two straight lines, using the vector cross product, and other geometric algorithms. In addition, to increase the intersection calculation of arbitrary two line, whether a polygon is convex polygon and judging whether a point is in a polygon, three functions to improve the procedures.
For the calculation of polygon area, this paper will solve the problem of solving the polygon area into multiple areas of the triangle and the method to calculate, Using (where )and design algorithms. In addition, the use of atan arc tangent function of the angle between any line calculation, designs an effective algorithm.
Finally, draw valid calculate geometric problems related to the hierarchical level of the program by using the above algorithm design.
Keywords: Digital model, set model, the cross product of vectors, arctangent
目录
摘要 2
Abstract: 2
1 绪论 5
1.1 背景 5
1.2 论文内容概要 5
2 Python源代码解读 6
2.1源代码部分函数解读 6
2.1.1 计算多边形面积 6
2.1.2计算两个向量的夹角 7
2.2源代码分析 7
2.2.1面积算法分析 7
2.2.2夹角算法分析 8
3 C语言算法设计与说明 9
3.1面积算法 9
3.1.1 叉积求解 9
3.1.2 其他求解公式 10
3.2直线夹角算法 12
3.3 计算任意二条线段的交点 13
3.4 判断一个多边形是否为凸多边形 16