- 积分
- 24557
- 明经币
- 个
- 注册时间
- 2004-3-17
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2012-7-28 10:41:12
|
显示全部楼层
List<Point3d> pts =
new List<Point3d>
{
new Point3d(0,0,0),
new Point3d(3,0,0),
new Point3d(0,3,0),
new Point3d(0,0,3)
};
//获取三点所在圆的法向量
Func<Point3d,Point3d,Point3d,Line3d> getcn =
(Point3d p1, Point3d p2, Point3d p3)
=>
{
var ca = new CircularArc3d(p1, p2, p3);
return new Line3d(ca.Center, ca.Normal);
};
var l3d1 = getcn(pts[0], pts[1], pts[2]);
var l3d2 = getcn(pts[3], pts[1], pts[2]);
if (l3d1.IsParallelTo(l3d2))
{
}
else
{
var ipts = l3d1.IntersectWith(l3d2);
if (ipts.Length == 0)
{
var cen = ipts[0];
var r = (pts[0] - cen).Length;
var sphere = new Sphere(r, cen);
}
} |
|