在gnuplot中绘制轴对齐的边界框(AABB)

时间:2013-06-28 10:51:29

标签: gnuplot

我已经绘制了两个向量(3,3,2),(2,2,1)并希望将AABB添加到第一个 表明第二个向量在第一个向量的范围内。

添加set object rectangle from screen 0,0 to screen 3,3 front无效。 那么如何绘制AABB(或者a = 3,b = 3和c = 2的长方体)?

另外,如何将y轴的刻度放在左侧。

仍然开放:

  • 将y轴的刻度限制为左侧,将x轴的刻度限制为底部
  • 向x轴,y轴和z轴添加箭头
  • 删除第二个x轴和y轴,使每个左侧只有一个

Gnuscript resource_vec_aabb

set xyplane 0
set grid

set xrange [0:5]
set yrange [0:5]
set zrange [0:5]


splot 'resource_vec_aabb.dat' with vectors filled head lw 2

数据 resource_vec_aabb.dat

# Gnuplot .dat file for vectors
0   0   0   3   3   2
0   0   0   2   2   1

Graph

更新

set termoption dashed   #Needs to be set to draw dashed lines

set border 19           #To set axis (1 + 2 + 16). See: set border help
set xyplane 0
set grid
unset key

my_range = 4

set xrange [0:my_range]
set yrange [0:my_range]
set zrange [0:my_range]

set arrow from graph 0,0,0 to graph 1.05,0,0 size screen 0.025,15,60 \
    filled ls 1 linecolor rgb "black"
set arrow from graph 0,0,0 to graph 0,1.05,0 size screen 0.025,15,60 \
    filled ls 1 linecolor rgb "black"
set arrow from graph 0,0,0 to graph 0,0,1.05 size screen 0.025,15,60 \
    filled ls 1 linecolor rgb "black"

set xtic 1
set ytic 1
set ztic 1

# AABB for 3,3,2
set arrow from 3,0,0 to 3,3,0 nohead linetype 2 linecolor rgb "green"
set arrow from 3,3,0 to 3,3,2 nohead linetype 2 linecolor rgb "green"
set arrow from 0,3,0 to 3,3,0 nohead linetype 2 linecolor rgb "green"
set arrow from 0,3,2 to 3,3,2 nohead linetype 2 linecolor rgb "green"
set arrow from 0,3,0 to 0,3,2 nohead linetype 2 linecolor rgb "green"
set arrow from 0,0,2 to 0,3,2 nohead linetype 2 linecolor rgb "green"
set arrow from 0,0,2 to 3,0,2 nohead linetype 2 linecolor rgb "green"
set arrow from 3,0,0 to 3,0,2 nohead linetype 2 linecolor rgb "green"
set arrow from 3,0,2 to 3,3,2 nohead linetype 2 linecolor rgb "green"

# 2,2,1
set arrow from 2,0,0 to 2,2,0 nohead linetype 2 linecolor rgb "blue"
set arrow from 0,2,0 to 2,2,0 nohead linetype 2 linecolor rgb "blue"
set arrow from 2,2,0 to 2,2,1 nohead linetype 2 linecolor rgb "blue"
set arrow from 0,0,1 to 2,0,1 nohead linetype 2 linecolor rgb "blue"
set arrow from 0,0,1 to 0,2,1 nohead linetype 2 linecolor rgb "blue"
set arrow from 0,2,1 to 2,2,1 nohead linetype 2 linecolor rgb "blue"
set arrow from 2,0,1 to 2,2,1 nohead linetype 2 linecolor rgb "blue"
set arrow from 2,0,0 to 2,0,1 nohead linetype 2 linecolor rgb "blue"
set arrow from 0,2,0 to 0,2,1 nohead linetype 2 linecolor rgb "blue"

set view 40,44,1
splot 'resource_vec_aabb.dat' with vectors filled head lw 2

新输出

updated_version

0 个答案:

没有答案