ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 Excel Home精品图文教程库
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
300集Office 2010微视频教程 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
查看: 4486|回复: 2

用Gauss-Legendre求积公式计算公路曲线线元(正反算)

[复制链接]

TA的精华主题

TA的得分主题

发表于 2012-3-30 21:13 | 显示全部楼层 |阅读模式
'常量声明
Const A = 0.1739274226
Const B = 0.3260725774
Const K = 0.0694318442
Const L = 0.3300094782
'**************************************************************************************************************
'*****************************用Gauss-Legendre求积公式计算线元坐标(根据桩号和偏距算坐标)**********************
'**************************************************************************************************************
'根据测量空间yshf的帖子改编
'已知量注释
'SP_Northing——起点北坐标
'SP_Easting——起点东坐标
'SP_Chainage As Double——起点桩号
'SP_TangentAzimuth——起点切线方位角,如190度33分56.44秒按190.335644输入
'Length——线元长度
'SP_Radius——起点半径
'EP_Radius——终点半径
'Direction——线元偏向,左输入-1,右为1
'Chainge——求算点桩号
'Offset——求算点偏距
'GetValue——返回值,返回N坐标输入x,返回E坐标随意输入
'Skew_angle——斜交角(右角)缺省值为正交90,当为正交时可不输入任何值,为斜交时输入右交角值,格式与切线方位角同
Public Function CO2NE(SP_Northing As Double, SP_Easting As Double, SP_Chainage As Double, SP_TangentAzimuth As Double, Length As Double, SP_Radius As Double, EP_Radius As Double, Direction As Integer, Chainge As Double, Offset As Double, GetValue As String, Optional Skew_angle As Double) As Double
Dim c As Double, d As Double, w As Double, f As Double, m As Double, x As Double, n As Double
Dim az As Double,y as double
'斜交角缺省值设置
If IsMissing(Skew_angle) Then
Skew_angle = worksheetfunction.Pi() / 2
Else
Skew_angle = WorksheetFunction.Radians(Int(Skew_angle) + (Int(Skew_angle * 100) - Int(Skew_angle) * 100) / 60 + (Skew_angle - Int(Skew_angle * 100) / 100) / 0.36)
End If
'切线方位角化为弧度
az = WorksheetFunction.Radians(Int(SP_TangentAzimuth) + (Int(SP_TangentAzimuth * 100) - Int(SP_TangentAzimuth) * 100) / 60 + (SP_TangentAzimuth - Int(SP_TangentAzimuth * 100) / 100) / 0.36)
'计算起点曲率
c = 1 / SP_Radius
'计算曲率变化率
d = (SP_Radius - EP_Radius) / 2 / Length / SP_Radius / EP_Radius
'计算桩号差
w = Abs(Chainge - SP_Chainage)
'计算桩坐标
f = 1 - L:
m = 1 - K
x = SP_Northing + w * (A * Cos(az + Direction * K * w * (c + K * w * d)) + B * Cos(az + Direction * L * w * (c + L * w * d)) + B * Cos(az + Direction * f * w * (c + f * w * d)) + A * Cos(az + Direction * m * w * (c + m * w * d)))
y = SP_Easting + w * (A * Sin(az + Direction * K * w * (c + K * w * d)) + B * Sin(az + Direction * L * w * (c + L * w * d)) + B * Sin(az + Direction * f * w * (c + f * w * d)) + A * Sin(az + Direction * m * w * (c + m * w * d)))
'计算法线方位角
n = az + Direction * w * (c + w * d) + Skew_angle
'计算边桩坐标
x = x + Offset * Cos(n): y = y + Offset * Sin(n)
'数值输出
If GetValue = "x" Or GetValue = "X" Then
CO2NE = x
Else
CO2NE = y
End If
End Function
'**************************************************************************************************************
'*************************用Gauss-Legendre求积公式计算线元里程和偏距(根据坐标算桩号和偏距)********************
'**************************************************************************************************************
'根据测量空间yshf的帖子改编
'已知量注释
'SP_Northing——起点北坐标
'SP_Easting——起点东坐标
'SP_Chainage As Double——起点桩号
'SP_TangentAzimuth——起点切线方位角,如190度33分56.44秒按190.335644输入
'Length——线元长度
'SP_Radius——起点半径
'EP_Radius——终点半径
'Direction——线元偏向,左输入-1,右为1
'PointNorthing——已知点N坐标
'PointEasting——已知点E坐标
'GetValue——返回值,返回N坐标输入x,返回E坐标随意输入
Public Function NE2CO(SP_Northing As Double, SP_Easting As Double, SP_Chainage As Double, SP_TangentAzimuth As Double, Length As Double, SP_Radius As Double, EP_Radius As Double, Direction As Integer, PointNorthing As Double, PointEasting As Double, GetValue As String) As Double
Dim az As Double, c As Double, d As Double, t As Double, w As Double, z As Double, f As Double, m As Double
Dim x As Double, y As Double, n As Double, ll As Double
'切线方位角化为弧度
az = WorksheetFunction.Radians(Int(SP_TangentAzimuth) + (Int(SP_TangentAzimuth * 100) - Int(SP_TangentAzimuth) * 100) / 60 + (SP_TangentAzimuth - Int(SP_TangentAzimuth * 100) / 100) / 0.36)
'计算起点曲率
c = 1 / SP_Radius
'计算曲率变化率
d = (SP_Radius - EP_Radius) / 2 / Length / SP_Radius / EP_Radius
'计算法线方位角左角
t = az - WorksheetFunction.Pi() / 2
'计算近似桩号
w = Abs((PointEasting - SP_Easting) * Cos(t) - (PointNorthing - SP_Northing) * Sin(t))
z = 0
Lbl0:
'计算近似桩号的中桩坐标
f = 1 - L
m = 1 - K
x = SP_Northing + w * (A * Cos(az + Direction * K * w * (c + K * w * d)) + B * Cos(az + Direction * L * w * (c + L * w * d)) + B * Cos(az + Direction * f * w * (c + f * w * d)) + A * Cos(az + Direction * m * w * (c + m * w * d)))
y = SP_Easting + w * (A * Sin(az + Direction * K * w * (c + K * w * d)) + B * Sin(az + Direction * L * w * (c + L * w * d)) + B * Sin(az + Direction * f * w * (c + f * w * d)) + A * Sin(az + Direction * m * w * (c + m * w * d)))
'计算近似桩号的切线方位角
n = az + Direction * w * (c + w * d)
'计算桩号趋近值
ll = t + Direction * w * (c + w * d)
z = (PointEasting - y) * Cos(ll) - (PointNorthing - x) * Sin(ll)
'判断切线方位角限差,如果超限则继续迭代,否则终止迭代并计算桩号差
If Abs(z) < 0.000001 Then GoTo Lbl1 Else w = w + z: GoTo Lbl0
Lbl1:
'数值结果输出
If GetValue = "C" Or GetValue = "c" Then
NE2CO = SP_Chainage + w
Else
NE2CO = (PointEasting - y) / Sin(n + WorksheetFunction.Pi() / 2)
End If
End Function

TA的精华主题

TA的得分主题

发表于 2012-3-30 21:14 | 显示全部楼层
是分享吗?真看不懂

TA的精华主题

TA的得分主题

 楼主| 发表于 2012-3-30 21:17 | 显示全部楼层
是原创转发一下,原贴由本人于2011年9月23日在“测量空间”网站上发表。http://cehui.w107.leoboard.com/article_view.asp?id=2194
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-3-29 05:42 , Processed in 0.040773 second(s), 9 queries , Gzip On, Redis On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表