简体   繁体   English

3D 空间中的圆-圆交点

[英]Circle-Circle Intersection in 3D space

I have 2 circles C1 and C2 which lies on 2 different planes in 3D space.我有 2 个圆C1C2 ,它们位于 3D 空间的 2 个不同平面上。 I want to intersect those circles and find the intersection points.我想与这些圆圈相交并找到交点。

Inputs:输入:

C1(x,y,z), Radius R1 and Plane P1 C1(x,y,z),半径 R1 和平面 P1

C2(x,y,z), Radius R2 and Plane P2. C2(x,y,z)、半径 R2 和平面 P2。

For 2D we can do it easily with the equation of circle but in this case, I'm unable to do the same.对于 2D,我们可以使用圆方程轻松完成,但在这种情况下,我无法做到这一点。

I got the solution by using CGAL library.我通过使用CGAL库得到了解决方案。 This library gives solutions for these kind of various mathematical problems.这个库为这些类型的各种数学问题提供了解决方案。 Here, I know the planes of 2 circle and I can use plane of 1 circle to intersect the other.Refer to this below code.在这里,我知道 2 个圆的平面,我可以使用 1 个圆的平面与另一个相交。请参阅下面的代码。

#include <CGAL/Exact_spherical_kernel_3.h>
typedef CGAL::Exact_spherical_kernel_3               SK;
typedef CGAL::Sphere_3<SK>                           sphere3Sk;
typedef CGAL::Point_3<SK>                            point3Sk;
typedef CGAL::Circle_3<SK>                           circle3Sk;
typedef CGAL::Circular_arc_point_3<SK>               circularArcSk;
typedef CGAL::Plane_3<SK>                            planeSk;
typedef CGAL::Vector_3<SK>                           vec3SK;

QList<QVector3D*> intersectPlaneCircle(planeSk pl, circle3Sk c2) {
    QList<QVector3D*> retVal;
    SK::Intersect_3 inter;
    std::vector< CGAL::Object > opVec;
    inter(pl,c2,std::back_inserter(opVec));

    std::pair<circularArcSk,unsigned> p1=
            CGAL::object_cast< std::pair<circularArcSk,unsigned> >(opVec[0]);
    std::pair<circularArcSk,unsigned> p2=
            CGAL::object_cast< std::pair<circularArcSk,unsigned> >(opVec[1]);

    retVal.append(new QVector3D(CGAL::to_double(p1.first.x()), 
    CGAL::to_double(p1.first.y()), CGAL::to_double(p1.first.z())));
    retVal.append(new QVector3D(CGAL::to_double(p2.first.x()), 
    CGAL::to_double(p2.first.y()), CGAL::to_double(p2.first.z())));
    return retVal;
}

math.stackexchange.com Maybe this is the place to ask the question, more mathematicians math.stackexchange.com 也许这是问问题的地方,更多的数学家

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM