日期:2014-05-18  浏览次数:20644 次

数学公式问题
p1和p2是空间两点 r是球半径
Point3d p1 = new Point3d(...);
Point3d p2 = new Point3d(..);

double a = (p2.X - p1.X) * (p2.X - p1.X) + (p2.Y - p1.Y) * (p2.Y - p1.Y) + (p2.Z - p1.Z) * (p2.Z - p1.Z);
double b = 2.0*((p2.X - p1.X)*(p1.X) + (p2.Y - p1.Y)*(p1.Y) + (p2.Z - p1.Z)*(p1.Z));
double c = p1.X*p1.X + p1.Y*p1.Y + p1.Z*p1.Z - r * r;

double discriminant = b*b - 4 * a * c;

以上a b c根据什么公式算出来的

------解决方案--------------------
没有明白你的意思。代码不是你写的??
------解决方案--------------------
引用楼主 hhfh 的帖子:
p1和p2是空间两点 r是球半径
Point3d p1 = new Point3d(...);
Point3d p2 = new Point3d(..);

double a = (p2.X - p1.X) * (p2.X - p1.X) + (p2.Y - p1.Y) * (p2.Y - p1.Y) + (p2.Z - p1.Z) * (p2.Z - p1.Z);
double b = 2.0*((p2.X - p1.X)*(p1.X) + (p2.Y - p1.Y)*(p1.Y) + (p2.Z - p1.Z)*(p1.Z));
double c = p1.X*p1.X + p1.Y*p1.Y + p1.Z*p1.Z - r * r;

double discriminant = b*b - 4 * a * c;

以上a b c根据…

------解决方案--------------------
a,b,c表示什么呀