斯潘8
斯潘4
嗨,伙计们,
我一直在尝试使用开始和结束坐标和半径值自动生成地籍地块,这个过程正在进行中,但在某些情况下,python调用程序似乎使用了错误的中心点来生成弧(因为trig中总是有两个潜在的点)。我用的是init(twopoints,半径,逆时针)功能,半径的符号表示方向。我附加了一个工作台,它包含块的一部分和相应的部分区域的生成,两者的外部边界应该匹配,但是不要。我认为这是一个三角学问题,调用方后面的数学运算不适用于大于半圆形的弧。有人对如何解决这个问题有什么想法吗?建立2017
感谢您的期待,
卡特丽娜
从起点创建圆弧,终点,半径,弧长。
导入FmeObjects,mathdef createpolygon(feature):x_coords=feature.getattribute(“u feature_list.easting”)y_coords=feature.getattribute(“u feature_list.northing”)radius=feature.getattribute(“u feature_list.radius”)arc dist=feature.getattribute(“u feature_list arc lengts boundary=fmeobjects.fmepath()x0,y0=浮动(x_坐标[0]),浮动(y_coords[0])用于范围(1,len(x_coords)):x1,y1=浮动(x_坐标[i]),如果半径[i]为float(y_coords[i]),则为float(y_coords[i]):r=float(radius[i])radius A=float(arcdist[i])/abs(r)中心角[弧度]s=abs(r)*(1.0-math.cos(a*0.5))矢状面长度d=math.hypot((x1-x0),(y1-y0)弦长ux,uy=(x1-x0)/d,(y1-y0)/d单位矢量:(x0,y0)到(x1),y1)计算弧的中点xm,Ym=(X0+X1)*0.5,(y0+y1)*0.5如果r<0:xm+=uy*s ym-=ux*s否则:xm-=uy*s ym+=ux*s从三个点创建弧-开始,中间的,结束三个报告=(fmeobjects.fmepoint(x0,Y0)fmeobjects.fmepoint(xm,YM)fmeobjects.fmepoint(x1,y1))边界。附录部分(fmeobjects.fmearc(threeepoints))其他:边界。附录部分(fmeobjects.fmeline([(x0,Y0)(x1)y1)))x0,y0=x1,y1 feature.setgeometry(fmeobjects.fmepolygon(boundary))。
导入FmeObjects,mathdef createpolygon(feature):x_coords=[float(v)for v in feature.getattribute(''u feature.easting')]y_coords=[float(v)for v in feature.getattribute(''u feature.northing')]radius=feature.getattribute(''u feature.radius')arc dist=feature.getattribute(''u feature.arc dist')\arc length boundary=fmeobjects.fmepath()x0,y0=x坐标[0],x1的y坐标[0]Y1拉德,拉链中的距离(X坐标[1:]Y-COORDS〔1〕;半径〔1〕;arcdist[1:):如果r a d:r=浮点(r a d)半径(signed)a=浮点(dist)/abs(r)中心角[弧度]s=r*(1.0-math.cos(a*0.5))矢状面长度(signed)d=math.hypot((x1-x0),(y1-y0)弦长ux,uy=(x1-x0)/d,(y1-y0)/d单位矢量弧中点xm,Ym=(X0+x1)*0.5-uy*s,(y0+y1)*0.5+ux*s从三个点创建弧-开始,中间的,结束三个报告=(fmeobjects.fmepoint(x0,Y0)fmeobjects.fmepoint(xm,YM)fmeobjects.fmepoint(x1,y1))边界。附录部分(fmeobjects.fmearc(threeepoints))其他:边界。附录部分(fmeobjects.fmeline([(x0,Y0)(x1)y1)))x0,y0=x1,y1 feature.setgeometry(fmeobjects.fmepolygon(boundary))。
?2019安全亚搏在线软件公司|合法的