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

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

Intersection problem

Post by MagicBoy » Wed Feb 06, 2019 5:00 am

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

Post by bogs » Wed Feb 06, 2019 10:55 am

Well, mind you I only just woke up and aren't yet up to *thinking* level Image 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 :wink:
Last edited by bogs on Wed Feb 06, 2019 4:52 pm, edited 1 time in total.
Image

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

Re: Intersection problem

Post by dunbarx » Wed Feb 06, 2019 4:01 pm

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
VIP Livecode Opensource Backer
Posts: 6179
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Intersection problem

Post by dunbarx » Wed Feb 06, 2019 4:02 pm

Klaus et al...

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

Craig

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

Re: Intersection problem

Post by Klaus » Wed Feb 06, 2019 4:33 pm

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

Post by capellan » Thu Feb 07, 2019 4:20 am

Hi Geoff,

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

Al

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”