POV-Ray : Newsgroups : povray.general : Looking for a formula Server Time
1 Nov 2024 07:27:39 EDT (-0400)
  Looking for a formula (Message 1 to 10 of 35)  
Goto Latest 10 Messages Next 10 Messages >>>
From: H  Karsten
Subject: Looking for a formula
Date: 11 Feb 2013 19:20:01
Message: <web.511989b9a94146cfa3bfeb720@news.povray.org>
Hi people :)
I have two lines and like to have there intersection-point.

Like
<Line_1_Start_X,Line_1_Start_y> to <Line_1_End_X,Line_1_End_Y>
and
<Line_2_Start_X,Line_2_Start_y> to <Line_2_End_X,Line_2_End_Y>

And I like to get <Intersection_X,Intersection_Y>

Is there any formula, coming with the PovRay-Inc-Files, like Math.inc, I can
use?

Or does someone have a quick way to solve this?

Tanx,
Holger :)


Post a reply to this message

From: FlyerX
Subject: Re: Looking for a formula
Date: 11 Feb 2013 20:30:34
Message: <51199b3a$1@news.povray.org>
On 2/11/2013 6:15 PM, H. Karsten wrote:
> Hi people :)
> I have two lines and like to have there intersection-point.
>
> Like
> <Line_1_Start_X,Line_1_Start_y> to <Line_1_End_X,Line_1_End_Y>
> and
> <Line_2_Start_X,Line_2_Start_y> to <Line_2_End_X,Line_2_End_Y>
>
> And I like to get <Intersection_X,Intersection_Y>
>
> Is there any formula, coming with the PovRay-Inc-Files, like Math.inc, I can
> use?
>
> Or does someone have a quick way to solve this?
>
> Tanx,
> Holger :)
>
>
>
>
http://mathworld.wolfram.com/Line-LineIntersection.html


Post a reply to this message

From: Kenneth
Subject: Re: Looking for a formula
Date: 12 Feb 2013 06:20:01
Message: <web.511a248924d8606ec2d977c20@news.povray.org>
FlyerX <fly### [at] yahoocom> wrote:

> >
> http://mathworld.wolfram.com/Line-LineIntersection.html

That looks...complicated :-O

But seeing the diagram there gave me a thought: The problem looks like it might
be solvable by a strictly geometric method instead (triangles, angles, etc.)--
something that might be more conceptually easy to code into SDL.  I sat down
with pencil and paper and worked on it for awhile (resulting in lots of
crumpled-up paper!) But one particular method looks promising. If it pans out,
I'll post it.

I imagine the ancient Greeks might have given this problem a fair amount of
thought.


Post a reply to this message

From: Warp
Subject: Re: Looking for a formula
Date: 12 Feb 2013 08:22:00
Message: <511a41f8@news.povray.org>
Kenneth <kdw### [at] gmailcom> wrote:
> > http://mathworld.wolfram.com/Line-LineIntersection.html

> That looks...complicated :-O

Understanding where the intersection comes from can be complicated, even
though the formula itself is often relatively short.

The formula you are looking for is probably (24) on that page. (It certainly
looks familiar. I have dealt a lot with basic geometry in the past.)

-- 
                                                          - Warp


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Looking for a formula
Date: 12 Feb 2013 08:50:01
Message: <web.511a47e224d8606e81c811d20@news.povray.org>
FlyerX <fly### [at] yahoocom> wrote:
> On 2/11/2013 6:15 PM, H. Karsten wrote:
> > Hi people :)
> > I have two lines and like to have there intersection-point.
> >
> > Like
> > <Line_1_Start_X,Line_1_Start_y> to <Line_1_End_X,Line_1_End_Y>
> > and
> > <Line_2_Start_X,Line_2_Start_y> to <Line_2_End_X,Line_2_End_Y>
> >
> > And I like to get <Intersection_X,Intersection_Y>
> >
> > Is there any formula, coming with the PovRay-Inc-Files, like Math.inc, I can
> > use?
> >
> > Or does someone have a quick way to solve this?
> >
> > Tanx,
> > Holger :)
> >
> >
> >
> >
> http://mathworld.wolfram.com/Line-LineIntersection.html

Since you are dealing with lines in 3-space (x,y,z), the lines will only
intersect if they lie on the same plane.  Otherwise, the best you can do is find
the closest point.

-tgq


Post a reply to this message

From: scott
Subject: Re: Looking for a formula
Date: 12 Feb 2013 10:43:23
Message: <511a631b@news.povray.org>
> But seeing the diagram there gave me a thought: The problem looks like it might
> be solvable by a strictly geometric method instead (triangles, angles, etc.)--

...or do it numerically by using the trace function. You could define 
one of the lines as a very thin cylinder, then do a trace from the start 
point of the 2nd line towards its end point.


Post a reply to this message

From: Samuel Benge
Subject: Re: Looking for a formula
Date: 12 Feb 2013 11:20:00
Message: <web.511a6aee24d8606eb6b777fb0@news.povray.org>
scott <sco### [at] scottcom> wrote:
> > But seeing the diagram there gave me a thought: The problem looks like it might
> > be solvable by a strictly geometric method instead (triangles, angles, etc.)--
>
> ...or do it numerically by using the trace function. You could define
> one of the lines as a very thin cylinder, then do a trace from the start
> point of the 2nd line towards its end point.

Or for more accuracy, make one line a plane. Use VPerp_To_Vector or
Point_At_Trans to align the plane along the line and translate it to one of its
endpoints. Then use trace(). I do that every time I need to find a line
intersection and it works perfectly. Also, using trace()'s fourth parameter
helps make sure you get an intersection: if the ray hits nothing (the normal is
<0, 0, 0>) then just reverse its direction.


Post a reply to this message

From: Stephen
Subject: Re: Looking for a formula
Date: 12 Feb 2013 14:47:05
Message: <511a9c39$1@news.povray.org>
On 12/02/2013 1:47 PM, Trevor G Quayle wrote:
> Since you are dealing with lines in 3-space (x,y,z), the lines will only
> intersect if they lie on the same plane.

Can that be right?
What about the lines of the three axis?

-- 
Regards
     Stephen


Post a reply to this message

From: Christian Froeschlin
Subject: Re: Looking for a formula
Date: 12 Feb 2013 15:22:51
Message: <511aa49b$1@news.povray.org>
Stephen wrote:

>> Since you are dealing with lines in 3-space (x,y,z), the lines will only
>> intersect if they lie on the same plane.

> Can that be right?

take two pens, and you will find you can easily hold them
so that they do not intersect, are not parallel, and with the
point of closest approach clearly within the physical pen
boundaries (and not just their projection to infinity).

> What about the lines of the three axis?

any two axes lie within a plane and intersect at the origin.


Post a reply to this message

From: Stephen
Subject: Re: Looking for a formula
Date: 12 Feb 2013 15:35:07
Message: <511aa77b$1@news.povray.org>
On 12/02/2013 8:22 PM, Christian Froeschlin wrote:
> Stephen wrote:
>
>>> Since you are dealing with lines in 3-space (x,y,z), the lines will only
>>> intersect if they lie on the same plane.
>
>> Can that be right?
>
> take two pens, and you will find you can easily hold them
> so that they do not intersect, are not parallel, and with the
> point of closest approach clearly within the physical pen
> boundaries (and not just their projection to infinity).
>

Yes, that is true.

>> What about the lines of the three axis?
>
> any two axes lie within a plane and intersect at the origin.

And is the third axis, in 3D space, in the same plane as the plane of 
the first two axis?


-- 
Regards
     Stephen


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.