线路的CGAL交点和circle< cincular_kernel> gt;随着圆极点处理圆弧的扩展
我是新手使用CGAL库和
试图获得线路的交集< circular_kernel>和circle< cincular_kernel> gt;
circular_kernel是extcre_circular_kernel
在一般情况下,交叉点很好
没有任何交点
但是,如果线与圆的极端相交,我的目的是扩展圆形弧, 。因此,我使用弧的中心用新半径(arc.radius + constant c)构建同心圆,并与两行相交,以获取新的起点和新弧的新终点
此处的示例这种情况
#include <CGAL/Exact_circular_kernel_2.h>
#include <CGAL/Line_2.h>
#include <CGAL/Circle_2.h>
#include <CGAL/Circular_kernel_intersections.h>
#include <vector>
#include <iterator>
typedef CGAL::Exact_circular_kernel_2 CK;
typedef CK::Point_2 Point
typedef CK::Circle_2 Circle;
typedef CK::Line_2 Line;
typedef CK::FT FT;
int main()
{
// both lines intersect with the circle in extremal point
Line l1(FT(0), FT(1), FT(-0.3532));
Line l2(FT(-1), FT(0), FT(2.1838));
Circle c(Point(FT(2.0138), FT(0.5232)), CGAL::square(0.17));
/*My circle construction is like this
double radius = CGAL::sqrt(to_double(CGAL::squared_distance(PointOnArc, c.center())));
Circle c(ArcCenter, CGAL::squared_distance(radius + EXPAND_GAP));
*/
typedef typename CGAL::CK2_Intersection_traits<CK, Line, Circle>::type Intersection_result;
std::vector<Intersection_result> res;
CGAL::intersection(l1, c, std::back_inserter(res));
CGAL::intersection(l2, c, std::back_inserter(res));
std::cout << res.size() << '\n'; // should be 2 but it is 0
}
是由精确造成的吗? 任何建议都将不胜感激,谢谢!
编辑:
上面提取以代表此问题的示例
RES的大小为2,但似乎只有L1和Circle的交点获取相交点(但重复一次,因此Res.Size()为2)
RES的正确尺寸应为L1和一个圆,一个用于L2和圆圈)
L1是水平线,L2是垂直线
测试后,如果线是垂直线,则问题似乎会发生
I'm new to using CGAL library and
trying to get the intersection of line<circular_kernel> and circle<circular_kernel>
The circular_kernel is Exact_circular_kernel
In the general case, intersection is just fine
But there did not have any intersection point if the line is intersect with the extremal points of the circle
My purpose is to expand a circular arcs. So, I use the center of arcs to construct concentric circles with new radius(arc.radius + CONSTANT C) and do intersect with two lines to get the new start point and new end point of this new arcs
Here's example of this situation
#include <CGAL/Exact_circular_kernel_2.h>
#include <CGAL/Line_2.h>
#include <CGAL/Circle_2.h>
#include <CGAL/Circular_kernel_intersections.h>
#include <vector>
#include <iterator>
typedef CGAL::Exact_circular_kernel_2 CK;
typedef CK::Point_2 Point
typedef CK::Circle_2 Circle;
typedef CK::Line_2 Line;
typedef CK::FT FT;
int main()
{
// both lines intersect with the circle in extremal point
Line l1(FT(0), FT(1), FT(-0.3532));
Line l2(FT(-1), FT(0), FT(2.1838));
Circle c(Point(FT(2.0138), FT(0.5232)), CGAL::square(0.17));
/*My circle construction is like this
double radius = CGAL::sqrt(to_double(CGAL::squared_distance(PointOnArc, c.center())));
Circle c(ArcCenter, CGAL::squared_distance(radius + EXPAND_GAP));
*/
typedef typename CGAL::CK2_Intersection_traits<CK, Line, Circle>::type Intersection_result;
std::vector<Intersection_result> res;
CGAL::intersection(l1, c, std::back_inserter(res));
CGAL::intersection(l2, c, std::back_inserter(res));
std::cout << res.size() << '\n'; // should be 2 but it is 0
}
Is this caused by precision?
Any suggestion is appreciated, Thanks!
Edit:
The example above is extracted for represeting this problem
The size of res is 2 but it seems that only the intersection of l1 and circle get the intersection point(but duplicate once, so the res.size() is 2)
The correct size of res should be 2 and one for l1 and circle, one for l2 and circle)
And l1 is horizontal line, and l2 is vertical line
After testing, the problem seems to happen if the line is vertical line i.e. no intersection point between vertical line and circle
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论