1. 前言
众所周知,Delaunay三角剖分算法在测绘工程中有着重要的应用。如果你是使用C#,Java之流的编程语言,不好意思你得自己去实现这个算法。好在python有着非常强大的开源库,python+numpy+scipy+matplotlib可谓科学计算”黄金搭档“,当然诸如pandas之流的高性能数据分析库,掌握他们你就不必重复造轮子了。
2. 进入正题
这篇随笔主要介绍如何使用Python+scipy+numpy+matplotlib来演示Delaunay三角网的构建并最终以图形显示出来。
- 首先先贴一下主要的数据结构代码:
class Vector2d(): def __init__(self, x, y, name=""): self.name = name self.x = x self.y = y self.rnx_path = None # 重载运算符 def __eq__(self, other): if isinstance(other, types.NoneType) or not isinstance(other, Vector2d): raise ValueError('Expected type of: %s' % (type(Vector2d))) else: return (other.x == self.x) and (other.y =&