求点的距离
已知一个点(Point3d pt)和点集合(Point3dCollectionpts),求点到点集合距离最短的点。 double min=p0.GetDistanceTo(point3dcollenction);foreach(point3d p in pointedCollection)
{
if(min>p0.GetDistanceTo(p))
min=p0.GetDistanceTo(p);
}
你要注意修改大小写,记不太清楚Point3d的方法是不是GetDistanceTo还是DistanceTo了……
cdinten 发表于 2011-8-31 07:39 static/image/common/back.gif
double min=p0.GetDistanceTo(point3dcollenction);
foreach(point3d p in pointedCollection)
{
O(∩_∩)O谢谢 chengw 发表于 2011-8-31 09:27 static/image/common/back.gif
O(∩_∩)O谢谢
my pleasure~ 用Linq就一句:
dim minDistance = (from objPt in pts select pt.DistanceTo(objpt) ).min
guohq 发表于 2011-9-2 00:25 static/image/common/back.gif
用Linq就一句:
dim minDistance = (from objPt in pts select pt.DistanceTo(objpt) ).min
谢谢你的回答、、、
页:
[1]