python根据圆的参数方程求圆上任意一点的坐标

from math import cos, sin,pi


x0,y0=0,0
r=4.0
angle=-25
x1 = x0 + r * cos(angle * pi / 180)

y1 = y0 + r * sin(angle * pi /180)
print(x1)
print(y1)

根据点的坐标画出圆的内接三角形:

import numpy as np
import matplotlib.pyplot as plt

x = y = np.arange(-5, 5, 0.1)


x1=[-3.064177772475912,0,3.6252311481465997,-3.064177772475912]
y1=[-2.571150438746157,4,-1.6904730469627978,-2.571150438746157]

x, y = np.meshgrid(x,y)
plt.contour(x, y, x**2 + y**2, [16])     #x**2 + y**2 = 9 的圆形
plt.plot(0,0,'r.')
plt.plot(x1,y1,'r-')

plt.axis('scaled')
plt.show()

 

posted on 2018-11-06 16:28  一杯明月  阅读(5092)  评论(0编辑  收藏  举报