最小二乘法平面拟合word精品文档17页.docx
《最小二乘法平面拟合word精品文档17页.docx》由会员分享,可在线阅读,更多相关《最小二乘法平面拟合word精品文档17页.docx(11页珍藏版)》请在冰豆网上搜索。
![最小二乘法平面拟合word精品文档17页.docx](https://file1.bdocx.com/fileroot1/2022-10/25/7cd42ea8-05bc-4bc3-a29f-1e3fd4c7414d/7cd42ea8-05bc-4bc3-a29f-1e3fd4c7414d1.gif)
最小二乘法平面拟合word精品文档17页
最小二乘法平面拟合
在介绍平面拟合之前,我先给大家介绍一下有关平面的相关知识(相关介绍来自QVPak3D,日本三丰)
DefinitionofthePlaneFeature
Aplanefeatureisreportedastheprojectionofthecentroidofthepointsusedtofittheplane,whichisprojectedontotheplanefeature,ameasurementofthedirectionmeasuredasanangle,ameasurementoftheflatnessoftheplaneandameasurementoftheparallelismoftheplane.
IfmeasuredinaCartesiancoordinatesystem,thecoordinatesoftheplane'scentroidarereportedasfollows:
X:
Thedistancefromtheorigintothecentroid,asmeasuredalongthex-axis.
Y:
Thedistancefromtheorigintothecentroid,asmeasuredalongthey-axis.
Z:
Thedistancefromtheorigintothecentroid,asmeasuredalongthez-axis.
IfmeasuredinaCylindricalcoordinatesystem,thecoordinatesoftheplane'scentroidarereportedasfollows:
R:
Thedistancefromthez-axisofthecoordinatesystemtothecentroid,asmeasuredwithinaplanewhichcontainsthecentroidandisorthogonaltothez-axisofthecoordinatesystem.
A:
Thedirection,measuredasanangle,betweenareferenceradiusvectorandaradiusvectorthatcontainsthecentroidandisprojectedontothexy-plane.Thereferenceradiusvectormaybeconsideredtobethex-axis.
Z:
Theheightfromtheorigintothecentroidinthecylindricalcoordinatesystem,asmeasuredalongthez-axis.
Theotherattributesoftheplanefeatureare:
Angle:
Theanglebetweentheprojectionoftheplane’snormalvectorontothexy-planeandthex-axisofthecurrentcoordinatesystem.
X-angle:
Theanglebetweentheplane’snormalvectorandthex-axisofthecurrentcoordinatesystem.(X-Angle=arccosinek).Thex-angleisapositivenumberbetween0and180degrees.
Y-angle:
Theanglebetweentheplane’snormalvectorandthey-axisofthecurrentcoordinatesystem.(Y-Angle=arccosinel).They-angleisapositivenumberbetween0and180degrees.
Z-angle:
Theanglebetweentheplane’snormalvectorandthez-axisofthecurrentcoordinatesystem.(Z-Angle=arccosinem).Thez-angleisapositivenumberbetween0and180degrees.
Flatness:
Flatnessisaconditionforwhichanelementofasurfaceisinaplane.
Flatnessisreportedasthewidthofthezoneformedbytwoclosestparallelplanesthatfullycontainthepointsetusedtofittheplanefeature.Avalueofzeroindicatesperfectflatness.
Flatness(minimum):
Thedistancefromthefittedplanetothemeasuredpointfarthestbelowthefittedplaininthepointset.Aboveandbelowaredeterminedbythedirectionoftheplanevector.SeeExplanationofMax/Mindistanceindifferentcases.
Flatness(maximum):
Thedistancefromthefittedplanetothemeasuredpointfarthestabovethefittedplaininthepointset.Aboveandbelowaredeterminedbythedirectionoftheplanevector.SeeExplanationofMax/Mindistanceindifferentcases.
Parallelism:
Theconditionofafeature,projectedtoacertainplane,beingequidistantatallelementsfromadatum(reference).Quantitatively,parallelismisdefinedastheabsolutedistantdifferencebetweenthefarthestandclosestpointsfromthedatum.
Parallelismisevaluatedrelativetoareferencelineorxy-plane.Whenevaluatingasetofpointswithareferenceline,parallelismusestheprojectionsofthepointsandreferencelineontothexy-planeinthecurrentcoordinatesystem,orz/refplanefeature,andisspecifiedasazonetolerance.Thez/refplanefeatureisaplaneincludingthereferencelineandparallelto(orincluding)thez-axis.Whenevaluatingasetofpointswithaxy-plane,parallelismiscalculatedinthree-dimensionalspace.
Parallelism(minimum):
Thedistancefromthereferencedlineorplanetothepointinthepointsetwiththeleastvalue(leastpositivevalueifallevaluatedpointsarepositive,ormostnegativevalueifevaluatedpointsincludenegativevalues).SeeExplanationofMax/Mindistanceindifferentcases.
Parallelism(maximum):
Thedistancefromthereferencelineorplanetothepointinthepointsetwiththegreatestvalue(mostpositivevalueifevaluatedpointsincludepositivevalues,orleastnegativevalueifallevaluatedpointsarenegative).SeeExplanationofMax/Mindistanceindifferentcases.
平面相关知识:
算法如下:
VB源代码:
OptionExplicit
PublicConstPI=3.1415926535897
PublicTypetagPoint
xAsDouble
yAsDouble
zAsDouble
EndType
PublicTypetagLine2D
kAsDouble 'Slope,Kis the"K"of"y=kx+b"
bAsDouble 'intercept,Bis the"B"of"y=kx+b"
AngleAsDouble 'arctg(k) '0to180deg
StraightnessAsDouble
RSQAsDouble
EndType
PublicTypetagLine3D
'3Dline'sformulaisshowingasfollowing.
'1)|Ax+By+Z+D=0
' |A1x+B1y+z+D1=0
'2)(x-x0)/m=(y-y0)/n=(z-z0)/p----(x-x0)/m=(y-y0)/n=z/1
'3)x=mt+x0,y=nt+y0,z=pt+z0
'Onlypoint'scoordinateis(a+b*Z,c+d*Z,Z),sothe