Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
640 views
in Technique[技术] by (71.8m points)

如何判断两条线段是否相交

RT,两条曲线都是由触发的点连接的贝塞尔曲线。求,如何判断两个贝塞尔曲线是否是相交的,求指教。


提了好久都没有人来答,那现在问题改简单一下,看看有什么好答案。那么要如何判断两条直线段是否相交呢?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Using the available classes from the 2D Graphics API.

Rectangle r1 = new Rectangle(100, 100, 100, 100); Line2D l1 = new
Line2D.Float(0, 200, 200, 0); 
System.out.println("l1.intsects(r1) = " + l1.intersects(r1));

传送门:
1. How to check intersection between a line and a rectangle?
2. How do you detect where two line segments intersect?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...