资源简介
用python3.6实现delaunay三角剖分算法,读入存有坐标的csv文件,计算出结果用Tkinter库显示。
代码片段和文件信息
import tkinter
from tkinter import filedialog
import csv
# 根据两点坐标计算距离
def caldis(x1 y1 x2 y2):
return ((x1-x2)**2+(y1-y2)**2)**0.5
# 输入三角形三个顶点,计算外接圆圆心及半径
def calcenter(x1 y1 x2 y2 x3 y3):
y1=-y1 # 计算公式是根据平面直角坐标推算的,原点在左下角,但是计算机屏幕坐标原点在右上角,所以计算式y坐标取负
y2=-y2
y3=-y3
if (y1 != y3 and y1 != y2 and y2 != y3) : # 判断是否有y坐标相等,即三角形某边斜率为0的情况,避免出现坟分母为0的错误
if(((x3-x1)/(y3-y1))-((x2-x1)/(y2-y1))) == 0:
x2 = x2+1
x = (((y1 + y3) / 2) + ((x1 + x3) / 2) * ((x3 - x1) / (y3 - y1)) - ((y1 + y2) / 2) - ((x1 + x2) / 2) *
((x2 - x1) / (y2 - y1))) / (((x3 - x1) / (y3 - y1)) - ((x2 - x1) / (y2 - y1)))
y = -((x3 - x1) / (y3 - y1)) * x + ((y1 + y3) / 2) + (((x1 + x3) / 2) * ((x3 - x1) / (y3 - y1)))
return (x -y
- 上一篇:python实现身份证号码分割提取
- 下一篇:盲水印python3.zip
相关资源
- Python Testing with pytest
- Starting Out with Python 4th Global Edition
- time_series_forecasting_with_python.zip
- Deep Time Series Forecasting with Python 无水印
- Learning IPython for Interactive Computing and
- Practical Quantum Computing for Developers
- Introducing Python;Modern Computing in Simple
- Deep Learning for Natural Language Processing.
-
ANSYS Workbench sc
ripting Guide - Introduction to time series.pdf + Deep Time Se
- Web Scraping with Python_Collecting Data from
- Python_Testing_with_pytest
- yolov3-tiny检测网络
- ThePracticeofComputingUsingPython3rdedition.pd
- Practical Web Penetration Testing pdf
- Numerical Python Scientific Computing and Data
- IPython Interactive Computing and Visualizatio
- LEARNING_ROBOTICS_USING_PYTHON(Lentin Joseph)
- crowd counting test single image demo
- Iterative Bagging和MultiBoosting 算法python实
- python-tin
- datingTestSet2.txt
- Introduction To Computing Using Python 2nd 201
- time series forecasting with python gakhov 高清
- KNN算法的Python实现(datingrecd.ipynb)
- python图像处理(Background Matting)
- Tossim仿真两个经典
评论
共有 条评论