## Intersection problem

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller

MagicBoy
Posts: 3
Joined: Wed Feb 06, 2019 12:35 am

### Intersection problem

I want to define the points of intersection of a black & white graphic and a line.

The intersection function only returns "yes" or "no" if an intersection occurs.

I need to find the exact points that the intersection(s) occur.

Any ideas?

Thanks,

Geoff

bogs
Posts: 3817
Joined: Sat Feb 25, 2017 10:45 pm

### Re: Intersection problem

Well, mind you I only just woke up and aren't yet up to *thinking* level so this may or may not make sense to you.

I would take the brute force method and do it in a repeat loop. You'll have all the points of both lines, shove them into 2 different variables, pick the variable of your preference, and then something like (psuedo code) -

Code: Select all

``````set the itemDelimiter to comma

repeat for each item x in var1
if x is among the items of var2 then put x into var3
end repeat
``````
any coordinate from the graphic that is the same as a coordinate from the line should wind up in var3. Or I could just not be awake yet, like I said
Last edited by bogs on Wed Feb 06, 2019 4:52 pm, edited 1 time in total.

dunbarx
VIP Livecode Opensource Backer
Posts: 6179
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

### Re: Intersection problem

Bogs is likely on the right track.

But what do you mean by a "black and white graphic"? A line is a graphic. Do you mean an image? And do you want to find the black pixels in the image that coincide with the points of a line graphic?

Craig Newman

dunbarx
VIP Livecode Opensource Backer
Posts: 6179
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

### Re: Intersection problem

Klaus et al...

I would move this to the beginners pane; it has nothing to do with new features.

Craig

Klaus
Posts: 11210
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

### Re: Intersection problem

Hi Geoff,

welcome to the forum!
And Craig is correct, will move this thread now to the beginners section (Hint, Hint!).

Best

Klaus

P.S.
A little "Hello" or something will surely not hurt in the first posting...

capellan
Posts: 610
Joined: Wed Aug 15, 2007 11:09 pm
Contact:

### Re: Intersection problem

Hi Geoff,

Check the stacks posted in this other forum thread:
https://forums.livecode.com/viewtopic.php?f=10&t=32027

Al