[BlindMath] Do Two line segments intersect?

ckgoodwin85 at gmail.com ckgoodwin85 at gmail.com
Thu Jan 18 18:47:11 UTC 2024


Repeat of my reply to Jonathan, this time to the group…

 

Hi Jonathan,

 

Many thanks for your help.  I think you have told me the crucial info I need.

 

I understand now how the 4 determinants are written.  A top left, top right, bottom left and bottom right.

And a determinant is

AB

CD

Expanded to

AD-BC

 

So the top left determinant has

A = Ax-Cx

B=Bx-Cx

C=Ay-Cy

D=By-Cy

So I just have to use this approach to write out all 4 determinants.

That is great.  Many thanks.

 

As for floating point.  Yes.  I was watching a variable earlier this evening which had a value that should have been 2.5 but was shown as 2.49999999999999.

I’ll tackle this once I’ve sorted the determinants and have that working with test data.  I think it means I can’t use ‘=’ and only ‘<’ and ‘>’.

I may not be able to get to this again before the weekend but I’m confident I’m on the right track thanks to your help.

Best, Chris

 

From: Jonathan Fine <jfine2358 at gmail.com> 
Sent: Wednesday, January 17, 2024 9:24 PM
To: Blind Math list for those interested in mathematics <blindmath at nfbnet.org>
Cc: ckgoodwin85 at gmail.com
Subject: Re: [BlindMath] Do Two line segments intersect?

 

Hi Chris

 

I'm happy to be your sighted assistant for this. I'll learn something from it.

 

Here's a start, from my phone.

 

To understand the algorithm you will need to know what it is that the determinant calculates.

 

To implement the algorithm you will need to know how to compute a determinant. 

 

You might also need to know something about the hazards of floating point arithmetic. 

 

All the above are equally true for sighted and blind.

 

You quoted some determinants from stack overflow. Unfortunately they've been written as ASCII art, and you've misread them.

 

In ASCII art the basic 2x2 determinant is

 

| a b |

| c d |

 

It's value is (a*d - b*c).

 

The quote from stack overflow you should read as columns, not rows.

 

All this might not be enough to help you. Please let me know how you get on, and I'll respond further tomorrow. 

 

Best wishes

 

Jonathan 



More information about the BlindMath mailing list