예제 #1
0
import numpy as np
from mpl_toolkits.axisartist.axislines import SubplotZero
from mpl_toolkits.axes_grid1 import host_subplot
import mpl_toolkits.axisartist as AA
import matplotlib.pyplot as plt
import math
# h=math.atan(0.6080070686637377)
# print(h)
import numpy as np

a = 6.53023
b = 3.970426

# distance=get_distance_from_point_to_line((6.53023,3.970426), (1.380606,2.756528), (15.301006,10.696528))
distance = func.get_distance_from_point_to_line((5, 12), (0, 26), (20, 15))
print(func.point2point(2, 3, 4, 5))
print(distance)
fig = plt.figure()
# # ax = fig.add_subplot(211, aspect='auto')
# fig,ax=plt.subplots()
plt.plot((1.380606, 15.301006, 14.405506, 0.134806),
         (2.756528, 10.696528, 11.953528, 3.744528))
#求障碍物顶点到轨迹线距离

# ax = fig.add_subplot(111)   #创建子图
# x=(6.53023)
# y=(3.970426)
# rect = plt.Rectangle((0.1,0.2),0.4,0.3, fill=False,edgecolor="red")    # (0.1,0.2)为左下角的坐标,0.4,0.3为宽和高,负数为反方向,红色填充
# plt.scatter(x,y)
# x,y=qianjin(x,y)
# plt.scatter(x,y)
예제 #2
0
import numpy as np
from mpl_toolkits.axisartist.axislines import SubplotZero
from mpl_toolkits.axes_grid1 import host_subplot
import mpl_toolkits.axisartist as AA
import matplotlib.pyplot as plt
import math
# h=math.atan(0.6080070686637377)
# print(h)
import numpy as np

a = 6.53023
b = 3.970426

# distance=get_distance_from_point_to_line((6.53023,3.970426), (1.380606,2.756528), (15.301006,10.696528))
distance = func.get_distance_from_point_to_line((5, 12), (0, 26), (20, 15))
print(func.point2point(2, 3, 4, 5))
print(distance)
fig = plt.figure()

# # ax = fig.add_subplot(211, aspect='auto')
# fig,ax=plt.subplots()
plt.plot((1.380606, 15.301006, 14.405506, 0.134806),
         (2.756528, 10.696528, 11.953528, 3.744528))
#求障碍物顶点到轨迹线距离
distance2 = func.get_distance_from_point_to_line(
    (15.301006, 10.696528), (a, b), (func.qianjin_x(a), func.qianjin_y(b)))
print(distance2)
distance_zhangai = func.point2point(15.301006, 10.696528, 14.405506, 11.953528)
print("障碍物宽度")
print(distance_zhangai)
# ax = fig.add_subplot(111)   #创建子图
예제 #3
0
import matplotlib.pyplot as plt
from matplotlib.patches import Wedge
import matplotlib.pyplot as plt
import func

import math
plt.rcParams['font.sans-serif']=['SimHei'] # 用来正常显示中文标签
plt.rcParams['axes.unicode_minus']=False # 用来正常显示负号
import pandas as pd
import numpy as np
from mpl_toolkits.axisartist.axislines import SubplotZero
from mpl_toolkits.axes_grid1 import host_subplot
import mpl_toolkits.axisartist as AA
import matplotlib.pyplot as plt
import math
# h=math.atan(0.6080070686637377)
# print(h)
import numpy as np
distance_zhangai = func.point2point(15.301006,10.696528,14.405506,11.953528)
R=np.sqrt((1.3+1+distance_zhangai/2)**2+2.5**2)+0.3
print("请输入障碍物右侧边界上的任意两点的横纵坐标!")
val_1x=eval(input('第一个点的横坐标:'))
val_1y=eval(input('第一个点的纵坐标:'))
val_2x=eval(input('第二个点的横坐标:'))
val_2y=eval(input('第二个点的纵坐标:'))
func.isnotdaoche(val_1x,val_1y,val_2x,val_2y)

예제 #4
0
import numpy as np
from mpl_toolkits.axisartist.axislines import SubplotZero
from mpl_toolkits.axes_grid1 import host_subplot
import mpl_toolkits.axisartist as AA
import matplotlib.pyplot as plt
import math
# h=math.atan(0.6080070686637377)
# print(h)
import numpy as np

a = 6.53023
b = 3.970426

# distance=get_distance_from_point_to_line((6.53023,3.970426), (1.380606,2.756528), (15.301006,10.696528))
distance = func.get_distance_from_point_to_line((5, 12), (0, 26), (20, 15))
print(func.point2point(2, 3, 4, 5))
print(distance)
fig = plt.figure()
# # ax = fig.add_subplot(211, aspect='auto')
# fig,ax=plt.subplots()
plt.plot((1.380606, 15.301006, 14.405506, 0.134806),
         (2.756528, 10.696528, 11.953528, 3.744528))
#求障碍物顶点到轨迹线距离

# ax = fig.add_subplot(111)   #创建子图
# x=(6.53023)
# y=(3.970426)
# rect = plt.Rectangle((0.1,0.2),0.4,0.3, fill=False,edgecolor="red")    # (0.1,0.2)为左下角的坐标,0.4,0.3为宽和高,负数为反方向,红色填充
# plt.scatter(x,y)
# x,y=qianjin(x,y)
# plt.scatter(x,y)