Gnuplot:尊重Gnuplot 3d多边形的深度顺序 [英] Gnuplot: Respect depthorder for Gnuplot 3d polygons
问题描述
我有一个完整城市的3D模型,并希望显示这些建筑物的等轴测图。为此,我使用gnuplot多边形,
,因为我认为无法将pm3d用于坐标为
不在定义明确的网格中的多边形。多边形显示的颜色为
,对应于它们获得的平均太阳辐照量。我
还将地面多边形显示为线框,主要是自动设置xrange,
yrange和zrange。
从远处看还可以,但是放大时,您会发现某些多边形的
深度顺序错误。
这是导入SketchUp的CityGML模型:
这是Gnuplot的结果:
您是否知道如何以正确的顺序显示这些多边形?
类似于
为此(删除 front
之后):
(排序后):
我认为第三张照片就是你想要的。
我用过python脚本o对多边形进行排序,基本上可以做到:
- 从文件 poly_raw.dat中读取所有多边形。该文件必须从
行的
set对象x多边形开始。
- 就像gnuplot具有
set view theta, phi
,它会绕着x和z轴旋转多边形(暂时,只是为了排序)。 - 它相对于新的y轴对多边形进行排序。
- 它将更新gnuplot对象ID,即<$ c中的
x
$ c>设置对象x多边形。 - 它打印排序后的多边形数据,包括
set对象
行
请注意,此方法仅适用于静态图片。如果您要交互式旋转图片,则它不起作用。
还请注意,如果该方法不适用于您的完整数据文件,则我可能搞砸了旋转矩阵或
轴分配:)
我附加了python脚本,绘图文件以及数据文件 plot_raw.dat和 plot_sorted.dat
#poly.py
来自数学进口cos,sin,pi
来自数学import sub,match,findall
class多边形:
def __init __(self):
self.firstLine =
self .points = []
self.lastLine =
def __str __(self):
pointStrings = [,。join( [self.points中的点的map(str,point))。]
s =
s + = self.firstLine
s + =到\\\n .join(pointStrings)
s + = \n
s + = self.lastLine
return s
def readObjectFromFile(自我,f,firstObjectLine ):
self.firstLine = firstObjectLine
行= f.readline()
而未匹配( set,line):
坐标= findall( [\d 。] +,行)
坐标=元组(f坐标为x的float(x))
self.points.append(坐标)
行= f.readline()
self.lastLine =行
return self
def meanAfterRotation(self,theta,phi):
cx = 0.0
cy = 0.0
cz = 0.0
theta = theta * pi / 180.0
phi = phi * pi / 180.0
for self.points:
x,y,z =点
x,y,z =(x,y * cos(theta)-z * sin(theta),y * sin(theta)+ z * cos(theta))
x,y,z =(x * cos(phi)-y * sin(phi),x * sin(phi)+ y * cos(phi),z)
cx,cy,cz = (cx + x,cy + y,cz + z)
n = len(self.points)
回报(cx / n,cy / n,cz / n)
def setPosition(self,posIndex):
self.firstLine = sub((\d +),str(posIndex),self.firstLine,1)
self.lastLine = sub((\d +),str(posIndex),self。 lastLine,1)
多边形= []
,其中open( poly_raw.dat)为f:
line = f.readline()
而line:
if line.strip()!=:
多边形.append(Polygon()。readObjectFromFile(f ,line))
line = f.readline()
多边形.sort(key = lambda x:x.meanAfterRotation(60,30)[1],reverse = True)
pos = 1
对于多边形中的p:
p.setPosition(pos)
pos + = 1
对于多边形p:
print(p)
gnuplot脚本:
#poly.plt,gnuplot 4.6
#交互式旋转图片时不起作用。
设置样式行1 linecolor rgbcolor#777777线宽1
设置样式增量用户
设置调色板文件-
0.00000 0.23137 0.22353 0.64314
0.17990 0.47843 0.34510 0.71765
0.32010 0.34902 0.17647 0.55686
0.43990 0.40784 0.10980 0.36471
0.59010 0.46275 0.09020 0.16863
0.78000 0.86667 0.41569 0.24314
0.92990 0.92549 0.66667 0.33725
1.00000 0.91765 0.82745
e
设置cbrange [50:150]
设置cbtics 25
设置格式cb%.0f W /m²
未设置xtics
未设置ytics
未设置ztics
未设置边框
设置颜色框
kzoom = 1.0
phi = 30.0
theta = 60.0
设置xyplane 0#删除xy平面的偏移
set view equal xyz#力等于所有三个轴的单位
set view theta,phi,kzoom
#load poly_raw.dat
load poly_sorted.dat
set terminal png
#set输出 raw.png
set输出 sorted.png
splot -,行notitle ls 1,NaN标题调色板
2.0 0.0 0.0
2.0 2.0 0.0
4.0 2.0 0.0
4.0 0.0 0.0
2.0 0.0 0.0
0.0 0.0 0.0
0.0 2.0 0.0
2.0 2.0 0.0
2.0 0.0 0.0
0.0 0.0 0.0
e
除去前面的 c分隔符后的未排序面数据:
设置对象1多边形,从\
2.0,0.0,3.0到\
3.0,0.0,3.5到\
3.0,2.0,3.5到\
2.0,2.0,3.0至\
2.0,0.0,3.0
设置对象1填充实心0.9边框lw 2 fc调色板cb 128.1315
设置对象2来自polygon
4.0,0.0,3.0至\
4.0,2.0,3.0至\
3.0,2.0,3.5至\
3.0,0.0,3.5至\
4.0,0.0,3.0
设置对象2填充实心0.9边框lw 2 fc调色板cb 128.62192
设置对象3多边形从\
2.0,0.0,0.0到\ \
4.0,0.0,0.0至\
4.0,0.0,3.0至\
3.0,0.0,3.5至\
2.0,0.0,3.0至\
2.0,0.0,0.0
设置对象3填充实心0.9边框lw 2 fc调色板cb 100.545204
se t对象4多边形从\
4.0,0.0,0.0到\
4.0,2.0,0.0到\
4.0,2.0,3.0到\
4.0,0.0 ,3.0至\
4.0,0.0,0.0
设置对象4填充实心0.9边框lw 2 fc调色板cb 85.58082
设置对象5来自\
的多边形4.0,2.0,0.0至\
2.0,2.0,0.0至\
2.0,2.0,3.0至\
3.0,2.0,3.5至\
4.0, 2.0,3.0至\
4.0,2.0,0.0
设置对象5填充实心0.9边框lw 2 fc调色板cb 55.88219
设置对象6来自\ $ b $的多边形b 2.0,2.0,0.0到\
2.0,0.0,0.0到\
2.0,0.0,3.0到\
2.0,2.0,0.0
设置对象6填充实心0.9边框lw 2 fc调色板cb 85.25754
设置对象7多边形从\
2.0,2.0,0.0到\
2.0,0.0,3.0到\
2.0,2.0,3.0至\
2.0,2.0,0.0
设置对象7填充实心0.9边框lw 2 fc调色板cb 85.25754
设置对象8来自from \
0.0,0.0,3.0到\
1.0,0.0,3.5到\
1.0,2.0,3.5到\
0.0,2.0,3.0到\
0.0,0.0,3.0
设置对象8 f病固体0.9边框lw 2 fc调色板cb 128.1315
设置对象9多边形从\
2.0,0.0,3.0到\
2.0,2.0,3.0到\
1.0,2.0,3.5至\
1.0,0.0,3.5至\
2.0,0.0,3.0
设置对象9填充实心0.9边框lw 2 fc调色板cb 128.62192
设置对象10个多边形,从\
0.0,0.0,0.0到\
2.0,0.0,0.0到\
2.0,0.0,3.0到polygon
1.0,0.0,3.5至\
0.0,0.0,3.0至\
0.0,0.0,0.0
设置对象10填充实心0.9边框lw 2 fc调色板cb 100.545204
设置对象11多边形从\
2.0,0.0,0.0到\
2.0,2.0,0.0到\
2.0,2.0,3.0到polygon \
2.0,0.0,3.0到\
2.0,0.0,0.0
设置对象11填充实心0.9边框lw 2 fc调色板cb 85.58082
设置对象12多边形从\
2.0,2.0,0.0到\
0.0,2.0,0.0到\
0.0,2.0,3.0到\
1.0,2.0,3.5到\
2.0,2.0,3.0到\
2.0,2.0,0.0
设置对象12填充实心0.9边框lw 2 fc调色板cb 55.88219
设置对象13点ygon从\
0.0,2.0,0.0到\
0.0,0.0,0.0到\
0.0,0.0,3.0到\
0.0,2.0,0.0
设置对象13填充实线0.9边框lw 2 fc调色板cb 85.25754
设置对象14多边形从\
0.0,2.0,0.0到\
0.0,0.0 ,3.0到\
0.0,2.0,3.0到b
0.0,2.0,0.0
设置对象14填充实心0.9边框lw 2 fc调色板cb 85.25754
运行 python poly.py>之后的排序数据poly_sorted.dat
设置对象1来自from
的多边形4.0,0.0,0.0到\
4.0,2.0,0.0到\
4.0,2.0,3.0到\
4.0,0.0,3.0到\
4.0,0.0,0.0
设置对象1填充实线0.9边框lw 2 fc调色板cb 85.58082
设置对象2多边形从\
4.0,2.0,0.0到\
2.0,2.0, 0.0到b
2.0,2.0,3.0到\
3.0,2.0,3.5到\
4.0,2.0,3.0到\
4.0,2.0,0.0
设置对象2填充实心0.9边框lw 2 fc调色板cb 55.88219
设置对象3多边形从\
2.0,2.0,0.0到\
2.0,0.0 ,0.0到\
2.0,0.0,3.0到\
2.0,2.0,0.0
设置对象3填充实心0.9边框lw 2 fc调色板cb 85.25754
将对象4多边形从\
2.0,2.0,0.0到\
2.0,0.0,3.0到\
2.0,2.0,3.0到\
2.0, 2.0,0.0
设置对象4填充实线0.9边框lw 2 fc调色板cb 85.25754
设置对象5多边形从\
2.0,0.0,0.0到\
2.0,2.0,0.0至\
2.0,2.0,3.0至\
2。 0,0.0,3.0到\
2.0,0.0,0.0
设置对象5填充实心0.9边框lw 2 fc调色板cb 85.58082
设置对象6来自\ $的多边形b $ b 2.0,2.0,0.0至\
0.0,2.0,0.0至\
0.0,2.0,3.0至\
1.0,2.0,3.5至\
2.0,2.0,3.0至\
2.0,2.0,0.0
设置对象6填充实心0.9边框lw 2 fc调色板cb 55.88219
设置对象7来自polygon的多边形
2.0,0.0,0.0至\
4.0,0.0,0.0至\
4.0,0.0,3.0至\
3.0,0.0,3.5至\
2.0,0.0,3.0至\
2.0,0.0,0.0
设置对象7填充实心0.9边框lw 2 fc调色板cb 100.545204
设置对象8来自\ \
0.0,2.0,0.0至\
0.0,0.0,0.0至\
0.0,0.0,3.0至\
0.0,2.0,0.0
设置对象8填充实心0.9边框lw 2 fc调色板cb 85.25754
设置对象9多边形从\
4.0,0.0,3.0到\
4.0,2.0,3.0至\
3.0,2.0,3.5至\
3.0,0.0,3.5至\
4.0,0.0,3.0
设置对象9填充实心0.9边框lw 2 fc调色板cb 128.62192
设置对象10多边形,从\
0.0,2.0,0.0到\
0.0,0.0,3.0到\
0.0,2.0,3.0到\
0.0,2.0,0.0
设置对象10填充实心0.9边框lw 2 fc调色板cb 85.25754
设置对象11多边形从\
0.0,0.0,0.0到\
2.0,0.0,0.0至\
2.0,0.0,3.0至\
1.0,0.0,3.5至\
0.0,0.0,3.0至\
0.0,0.0,0.0
设置对象11填充实心0.9边框lw 2 fc调色板cb 100.545204
设置对象12多边形从\
2.0,0.0,3.0到\ \
3.0,0.0,3.5至\
3.0,2.0,3.5至\
2.0,2.0,3.0至\
2.0,0.0,3.0
设置对象12填充实心0.9边框lw 2 fc调色板cb 128.1315
设置对象13多边形从\
2.0,0.0,3.0到\
2.0,2.0,3.0至\
1.0,2.0,3.5至\
1.0,0.0,3.5至\
2.0,0.0,3.0
设置对象13填充实心0.9边框lw 2 fc调色板cb 128.62192
设置对象14多边形从\
0.0,0.0,3.0到\
1.0,0.0,3.5到\
1.0,2.0,3.5至\
0.0,2.0,3.0至\
0.0,0.0,3.0
设置对象14填充实心0.9边框lw 2 fc调色板cb 128.1315
I have a 3D model of a complete city, and would like to show an isometric view of those buildings. I use gnuplot polygons for this, since I don't think I can use pm3d for polygons with coordinates that aren't on a well defined grid. The polygons are displayed with a color corresponding to the average amount of solar irradiance they get. I also display the ground polygons as wireframe, mostly to set xrange, yrange and zrange automatically.
It looks okay from far away, but when you zoom in, you see that the depthorder of some polygons are wrong.
This is the CityGML model imported into SketchUp :
This is what comes out of Gnuplot :
Do you have any idea how I could display those polygons in the right order?
Something like this would be great, but it only seems to work with splot
.
Here is a Gnuplot file to see the problem (2 Buildings and 4 roofs) :
set style line 1 linecolor rgbcolor "#777777" linewidth 1
set style increment user
set palette file "-"
0.00000 0.23137 0.22353 0.64314
0.17990 0.47843 0.34510 0.71765
0.32010 0.34902 0.17647 0.55686
0.43990 0.40784 0.10980 0.36471
0.59010 0.46275 0.09020 0.16863
0.78000 0.86667 0.41569 0.24314
0.92990 0.92549 0.66667 0.33725
1.00000 0.97647 0.91765 0.82745
e
set cbrange [50:150]
set cbtics 25
set format cb "%.0f W/m²"
unset xtics
unset ytics
unset ztics
unset border
set colorbox
kzoom=1.0
phi=30.0
theta=60.0
set xyplane 0 # removes the offset of the xy plane
set view equal xyz # force equal units to all three axes
set view theta,phi,kzoom
set object 1 polygon from \
2.0,0.0,3.0 to \
3.0,0.0,3.5 to \
3.0,2.0,3.5 to \
2.0,2.0,3.0 to \
2.0,0.0,3.0
set object 1 fill solid 0.9 border lw 2 fc palette cb 128.1315 front
set object 2 polygon from \
4.0,0.0,3.0 to \
4.0,2.0,3.0 to \
3.0,2.0,3.5 to \
3.0,0.0,3.5 to \
4.0,0.0,3.0
set object 2 fill solid 0.9 border lw 2 fc palette cb 128.62192 front
set object 3 polygon from \
2.0,0.0,0.0 to \
4.0,0.0,0.0 to \
4.0,0.0,3.0 to \
3.0,0.0,3.5 to \
2.0,0.0,3.0 to \
2.0,0.0,0.0
set object 3 fill solid 0.9 border lw 2 fc palette cb 100.545204
set object 4 polygon from \
4.0,0.0,0.0 to \
4.0,2.0,0.0 to \
4.0,2.0,3.0 to \
4.0,0.0,3.0 to \
4.0,0.0,0.0
set object 4 fill solid 0.9 border lw 2 fc palette cb 85.58082
set object 5 polygon from \
4.0,2.0,0.0 to \
2.0,2.0,0.0 to \
2.0,2.0,3.0 to \
3.0,2.0,3.5 to \
4.0,2.0,3.0 to \
4.0,2.0,0.0
set object 5 fill solid 0.9 border lw 2 fc palette cb 55.88219
set object 6 polygon from \
2.0,2.0,0.0 to \
2.0,0.0,0.0 to \
2.0,0.0,3.0 to \
2.0,2.0,0.0
set object 6 fill solid 0.9 border lw 2 fc palette cb 85.25754
set object 7 polygon from \
2.0,2.0,0.0 to \
2.0,0.0,3.0 to \
2.0,2.0,3.0 to \
2.0,2.0,0.0
set object 7 fill solid 0.9 border lw 2 fc palette cb 85.25754
set object 8 polygon from \
0.0,0.0,3.0 to \
1.0,0.0,3.5 to \
1.0,2.0,3.5 to \
0.0,2.0,3.0 to \
0.0,0.0,3.0
set object 8 fill solid 0.9 border lw 2 fc palette cb 128.1315 front
set object 9 polygon from \
2.0,0.0,3.0 to \
2.0,2.0,3.0 to \
1.0,2.0,3.5 to \
1.0,0.0,3.5 to \
2.0,0.0,3.0
set object 9 fill solid 0.9 border lw 2 fc palette cb 128.62192 front
set object 10 polygon from \
0.0,0.0,0.0 to \
2.0,0.0,0.0 to \
2.0,0.0,3.0 to \
1.0,0.0,3.5 to \
0.0,0.0,3.0 to \
0.0,0.0,0.0
set object 10 fill solid 0.9 border lw 2 fc palette cb 100.545204
set object 11 polygon from \
2.0,0.0,0.0 to \
2.0,2.0,0.0 to \
2.0,2.0,3.0 to \
2.0,0.0,3.0 to \
2.0,0.0,0.0
set object 11 fill solid 0.9 border lw 2 fc palette cb 85.58082
set object 12 polygon from \
2.0,2.0,0.0 to \
0.0,2.0,0.0 to \
0.0,2.0,3.0 to \
1.0,2.0,3.5 to \
2.0,2.0,3.0 to \
2.0,2.0,0.0
set object 12 fill solid 0.9 border lw 2 fc palette cb 55.88219
set object 13 polygon from \
0.0,2.0,0.0 to \
0.0,0.0,0.0 to \
0.0,0.0,3.0 to \
0.0,2.0,0.0
set object 13 fill solid 0.9 border lw 2 fc palette cb 85.25754
set object 14 polygon from \
0.0,2.0,0.0 to \
0.0,0.0,3.0 to \
0.0,2.0,3.0 to \
0.0,2.0,0.0
set object 14 fill solid 0.9 border lw 2 fc palette cb 85.25754
splot "-" with lines notitle ls 1, NaN notitle palette
2.0 0.0 0.0
2.0 2.0 0.0
4.0 2.0 0.0
4.0 0.0 0.0
2.0 0.0 0.0
0.0 0.0 0.0
0.0 2.0 0.0
2.0 2.0 0.0
2.0 0.0 0.0
0.0 0.0 0.0
e
pause mouse
Thanks for the interest!
I could not find an option to convince gnuplot that it should set the depthorder of the polygon objects automatically. The only way I found was to already define the objects in the correct order. Then gnuplot draws each of them on top of the previous one which leads to the expected result.
Taking your example polygons after removing the front
specifiers, this approach changes the original picture from this one:
to this one (after removing front
):
to this one (after sorting):
I think the third picture is what you want.
I used a python script to sort the polygons, which basically does:
- Read all polygons from a file "poly_raw.dat". The file must start with a
set object x polygon from
line. - Like gnuplot with
set view theta, phi
, it rotates the polygons around x and z axis (temporarily, just for sorting). - It sorts the polygons with respect to the new y-axis. This should be the axis which is orthogonal to the screen.
- It updates the gnuplot object IDs, i.e. the
x
inset object x polygon
. - It prints the sorted polygon data including the
set object
lines.
Notice that this approach only works for static pictures. It does not work if you want to interactively rotate the picture.
Also notice, if the approach does not work for your full data file, I have probably messed up the rotation matrix or the axis assignment :)
I attach the python script, the plot file, and the data files "plot_raw.dat" and "plot_sorted.dat" for reference.
# poly.py
from math import cos, sin, pi
from re import sub, match, findall
class Polygon:
def __init__(self):
self.firstLine = ""
self.points = []
self.lastLine = ""
def __str__(self):
pointStrings = [",".join(map(str,point)) for point in self.points]
s = ""
s += self.firstLine
s += " to \\\n".join(pointStrings)
s += "\n"
s += self.lastLine
return s
def readObjectFromFile(self, f, firstObjectLine):
self.firstLine = firstObjectLine
line = f.readline()
while not match("set",line):
coordinates = findall("[\d.]+", line)
coordinates = tuple(float(x) for x in coordinates)
self.points.append(coordinates)
line = f.readline()
self.lastLine = line
return self
def meanAfterRotation(self, theta, phi):
cx = 0.0
cy = 0.0
cz = 0.0
theta = theta*pi/180.0
phi = phi*pi/180.0
for point in self.points:
x,y,z = point
x,y,z = (x, y*cos(theta) - z*sin(theta), y*sin(theta) + z*cos(theta))
x,y,z = (x*cos(phi) - y*sin(phi), x*sin(phi) + y*cos(phi), z)
cx, cy, cz = (cx + x, cy + y, cz + z)
n = len(self.points)
return (cx/n, cy/n, cz/n)
def setPosition(self, posIndex):
self.firstLine = sub("(\d+)", str(posIndex), self.firstLine, 1)
self.lastLine = sub("(\d+)", str(posIndex), self.lastLine, 1)
polygons = []
with open("poly_raw.dat") as f:
line = f.readline()
while line:
if line.strip() != "":
polygons.append(Polygon().readObjectFromFile(f,line))
line = f.readline()
polygons.sort(key = lambda x: x.meanAfterRotation(60,30)[1], reverse = True)
pos = 1
for p in polygons:
p.setPosition(pos)
pos += 1
for p in polygons:
print(p)
The gnuplot script:
# poly.plt, gnuplot 4.6
# Does not work when interactively rotating the picture.
set style line 1 linecolor rgbcolor "#777777" linewidth 1
set style increment user
set palette file "-"
0.00000 0.23137 0.22353 0.64314
0.17990 0.47843 0.34510 0.71765
0.32010 0.34902 0.17647 0.55686
0.43990 0.40784 0.10980 0.36471
0.59010 0.46275 0.09020 0.16863
0.78000 0.86667 0.41569 0.24314
0.92990 0.92549 0.66667 0.33725
1.00000 0.97647 0.91765 0.82745
e
set cbrange [50:150]
set cbtics 25
set format cb "%.0f W/m²"
unset xtics
unset ytics
unset ztics
unset border
set colorbox
kzoom=1.0
phi=30.0
theta=60.0
set xyplane 0 # removes the offset of the xy plane
set view equal xyz # force equal units to all three axes
set view theta,phi,kzoom
#load "poly_raw.dat"
load "poly_sorted.dat"
set terminal png
#set output "raw.png"
set output "sorted.png"
splot "-" with lines notitle ls 1, NaN notitle palette
2.0 0.0 0.0
2.0 2.0 0.0
4.0 2.0 0.0
4.0 0.0 0.0
2.0 0.0 0.0
0.0 0.0 0.0
0.0 2.0 0.0
2.0 2.0 0.0
2.0 0.0 0.0
0.0 0.0 0.0
e
The unsorted polygon data after removing the front
specifiers:
set object 1 polygon from \
2.0,0.0,3.0 to \
3.0,0.0,3.5 to \
3.0,2.0,3.5 to \
2.0,2.0,3.0 to \
2.0,0.0,3.0
set object 1 fill solid 0.9 border lw 2 fc palette cb 128.1315
set object 2 polygon from \
4.0,0.0,3.0 to \
4.0,2.0,3.0 to \
3.0,2.0,3.5 to \
3.0,0.0,3.5 to \
4.0,0.0,3.0
set object 2 fill solid 0.9 border lw 2 fc palette cb 128.62192
set object 3 polygon from \
2.0,0.0,0.0 to \
4.0,0.0,0.0 to \
4.0,0.0,3.0 to \
3.0,0.0,3.5 to \
2.0,0.0,3.0 to \
2.0,0.0,0.0
set object 3 fill solid 0.9 border lw 2 fc palette cb 100.545204
set object 4 polygon from \
4.0,0.0,0.0 to \
4.0,2.0,0.0 to \
4.0,2.0,3.0 to \
4.0,0.0,3.0 to \
4.0,0.0,0.0
set object 4 fill solid 0.9 border lw 2 fc palette cb 85.58082
set object 5 polygon from \
4.0,2.0,0.0 to \
2.0,2.0,0.0 to \
2.0,2.0,3.0 to \
3.0,2.0,3.5 to \
4.0,2.0,3.0 to \
4.0,2.0,0.0
set object 5 fill solid 0.9 border lw 2 fc palette cb 55.88219
set object 6 polygon from \
2.0,2.0,0.0 to \
2.0,0.0,0.0 to \
2.0,0.0,3.0 to \
2.0,2.0,0.0
set object 6 fill solid 0.9 border lw 2 fc palette cb 85.25754
set object 7 polygon from \
2.0,2.0,0.0 to \
2.0,0.0,3.0 to \
2.0,2.0,3.0 to \
2.0,2.0,0.0
set object 7 fill solid 0.9 border lw 2 fc palette cb 85.25754
set object 8 polygon from \
0.0,0.0,3.0 to \
1.0,0.0,3.5 to \
1.0,2.0,3.5 to \
0.0,2.0,3.0 to \
0.0,0.0,3.0
set object 8 fill solid 0.9 border lw 2 fc palette cb 128.1315
set object 9 polygon from \
2.0,0.0,3.0 to \
2.0,2.0,3.0 to \
1.0,2.0,3.5 to \
1.0,0.0,3.5 to \
2.0,0.0,3.0
set object 9 fill solid 0.9 border lw 2 fc palette cb 128.62192
set object 10 polygon from \
0.0,0.0,0.0 to \
2.0,0.0,0.0 to \
2.0,0.0,3.0 to \
1.0,0.0,3.5 to \
0.0,0.0,3.0 to \
0.0,0.0,0.0
set object 10 fill solid 0.9 border lw 2 fc palette cb 100.545204
set object 11 polygon from \
2.0,0.0,0.0 to \
2.0,2.0,0.0 to \
2.0,2.0,3.0 to \
2.0,0.0,3.0 to \
2.0,0.0,0.0
set object 11 fill solid 0.9 border lw 2 fc palette cb 85.58082
set object 12 polygon from \
2.0,2.0,0.0 to \
0.0,2.0,0.0 to \
0.0,2.0,3.0 to \
1.0,2.0,3.5 to \
2.0,2.0,3.0 to \
2.0,2.0,0.0
set object 12 fill solid 0.9 border lw 2 fc palette cb 55.88219
set object 13 polygon from \
0.0,2.0,0.0 to \
0.0,0.0,0.0 to \
0.0,0.0,3.0 to \
0.0,2.0,0.0
set object 13 fill solid 0.9 border lw 2 fc palette cb 85.25754
set object 14 polygon from \
0.0,2.0,0.0 to \
0.0,0.0,3.0 to \
0.0,2.0,3.0 to \
0.0,2.0,0.0
set object 14 fill solid 0.9 border lw 2 fc palette cb 85.25754
The sorted data after running python poly.py > poly_sorted.dat
set object 1 polygon from \
4.0,0.0,0.0 to \
4.0,2.0,0.0 to \
4.0,2.0,3.0 to \
4.0,0.0,3.0 to \
4.0,0.0,0.0
set object 1 fill solid 0.9 border lw 2 fc palette cb 85.58082
set object 2 polygon from \
4.0,2.0,0.0 to \
2.0,2.0,0.0 to \
2.0,2.0,3.0 to \
3.0,2.0,3.5 to \
4.0,2.0,3.0 to \
4.0,2.0,0.0
set object 2 fill solid 0.9 border lw 2 fc palette cb 55.88219
set object 3 polygon from \
2.0,2.0,0.0 to \
2.0,0.0,0.0 to \
2.0,0.0,3.0 to \
2.0,2.0,0.0
set object 3 fill solid 0.9 border lw 2 fc palette cb 85.25754
set object 4 polygon from \
2.0,2.0,0.0 to \
2.0,0.0,3.0 to \
2.0,2.0,3.0 to \
2.0,2.0,0.0
set object 4 fill solid 0.9 border lw 2 fc palette cb 85.25754
set object 5 polygon from \
2.0,0.0,0.0 to \
2.0,2.0,0.0 to \
2.0,2.0,3.0 to \
2.0,0.0,3.0 to \
2.0,0.0,0.0
set object 5 fill solid 0.9 border lw 2 fc palette cb 85.58082
set object 6 polygon from \
2.0,2.0,0.0 to \
0.0,2.0,0.0 to \
0.0,2.0,3.0 to \
1.0,2.0,3.5 to \
2.0,2.0,3.0 to \
2.0,2.0,0.0
set object 6 fill solid 0.9 border lw 2 fc palette cb 55.88219
set object 7 polygon from \
2.0,0.0,0.0 to \
4.0,0.0,0.0 to \
4.0,0.0,3.0 to \
3.0,0.0,3.5 to \
2.0,0.0,3.0 to \
2.0,0.0,0.0
set object 7 fill solid 0.9 border lw 2 fc palette cb 100.545204
set object 8 polygon from \
0.0,2.0,0.0 to \
0.0,0.0,0.0 to \
0.0,0.0,3.0 to \
0.0,2.0,0.0
set object 8 fill solid 0.9 border lw 2 fc palette cb 85.25754
set object 9 polygon from \
4.0,0.0,3.0 to \
4.0,2.0,3.0 to \
3.0,2.0,3.5 to \
3.0,0.0,3.5 to \
4.0,0.0,3.0
set object 9 fill solid 0.9 border lw 2 fc palette cb 128.62192
set object 10 polygon from \
0.0,2.0,0.0 to \
0.0,0.0,3.0 to \
0.0,2.0,3.0 to \
0.0,2.0,0.0
set object 10 fill solid 0.9 border lw 2 fc palette cb 85.25754
set object 11 polygon from \
0.0,0.0,0.0 to \
2.0,0.0,0.0 to \
2.0,0.0,3.0 to \
1.0,0.0,3.5 to \
0.0,0.0,3.0 to \
0.0,0.0,0.0
set object 11 fill solid 0.9 border lw 2 fc palette cb 100.545204
set object 12 polygon from \
2.0,0.0,3.0 to \
3.0,0.0,3.5 to \
3.0,2.0,3.5 to \
2.0,2.0,3.0 to \
2.0,0.0,3.0
set object 12 fill solid 0.9 border lw 2 fc palette cb 128.1315
set object 13 polygon from \
2.0,0.0,3.0 to \
2.0,2.0,3.0 to \
1.0,2.0,3.5 to \
1.0,0.0,3.5 to \
2.0,0.0,3.0
set object 13 fill solid 0.9 border lw 2 fc palette cb 128.62192
set object 14 polygon from \
0.0,0.0,3.0 to \
1.0,0.0,3.5 to \
1.0,2.0,3.5 to \
0.0,2.0,3.0 to \
0.0,0.0,3.0
set object 14 fill solid 0.9 border lw 2 fc palette cb 128.1315
这篇关于Gnuplot:尊重Gnuplot 3d多边形的深度顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!