Lines intersection Onisim Junior Member Posts: 10 Threads: 5 Joined: Jul 2023 Reputation: 0 11-17-2023, 10:58 AM How to get the Point3D of a two intersected lines? I want to get the intersection Point3D of two or more lines (LineVisual3D) from VisualSpace (or ViewPort). Find Reply abenedik Administrator Posts: 731 Threads: 8 Joined: Sep 2009 Reputation: 35 11-20-2023, 10:20 AM For such general 3D graphics problems, it is best to search the internet for the anwser. For example, I found an answer to your question on stackoverflow (https://stackoverflow.com/questions/2316...ne-segment) - on answer mentioned the code on https://bloodstrawberry.tistory.com/1037 I have updated the code to work with WPF 3D objects (Point3D and Vector3D): Code:```public double GetDistanceTwoLine(Point3D A, Point3D B, Point3D C, Point3D D) {     Vector3D AB = A - B;     Vector3D CD = C - D;     Vector3D AC = A - C;     Vector3D line = Vector3D.CrossProduct(AB, CD);     return Math.Abs(Vector3D.DotProduct(AC, line)) / line.Length; } public Point3D GetContactPoint(Vector3D normal, Point3D planeDot, Point3D A, Point3D B) {     Vector3D nAB = B - A;     nAB.Normalize();     return A + nAB * Vector3D.DotProduct(normal, planeDot - A) / Vector3D.DotProduct(normal, nAB); } public (Point3D point1, Point3D point2) GetShortestPath(Point3D A, Point3D B, Point3D C, Point3D D) {     Vector3D AB = A - B;     Vector3D CD = C - D;     Vector3D line = Vector3D.CrossProduct(AB, CD);     Vector3D crossLineAB = Vector3D.CrossProduct(line, AB);     Vector3D crossLineCD = Vector3D.CrossProduct(line, CD);     return (GetContactPoint(crossLineAB, A, C, D), GetContactPoint(crossLineCD, C, A, B)); }``` Andrej Benedik Find Reply Onisim Junior Member Posts: 10 Threads: 5 Joined: Jul 2023 Reputation: 0 11-20-2023, 01:41 PM I understand. Thank you very much! Find Reply

Forum Jump:

 Users browsing this thread: 1 Guest(s)