Message-ID: <3779DBEF.3000738D@silesia.top.pl> Date: Wed, 30 Jun 1999 11:57:19 +0300 From: Michal X-Mailer: Mozilla 4.6 [en] (Win98; I) X-Accept-Language: en MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Re: A 3D problem References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com "Carlos Giani_AEN2003 (M2003)" wrote: > > Hello people! > I'm developing a 3D system, and now I have a problem. Let me describe > it: > > Let there be three vertices A,B and C. These three vertices (= 3D > points) describe a triangle. Then there are two more vertices, P1 and > P2. P1 ist the start point of a line, P2 is the end point of that line. > All coordinates of all vertices are known. Now I have to find out if > the line goes through the triangle. > A description of a solution would be nice. Source code would be nice, > too. Please help! Tomorrow is my last possibility to check my email! > > Carlos Rafael Giani, student of the T.G.M in Vienna > > During holidays or weekends use this email-address: > darkvale AT fcmail DOT com > > "Its not a bug, its an undocumented feature!" Project the triangle to nearest plane, find intersection point of your line and that plane, and do a simple 2D test:) with this point and 2D triangle. This works also with convex polygons. If you have more such easy problems use search engine and find some tutorials there are plenty of them in the net. I thin that this kind of problems should not be posted to this list.