Find closed figures within a group of points?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Find closed figures within a group of points?
I am working on a program for electrical technicians to learn about resistor circuits.
The user will place resistors between the black dots and the program will calculate
the circuit resistance. To start the program process, I need to first find each complete circuit
(closed figure). I also need to determine circuits (figures) that share the same side. I have attached
a pic and the beginning of the program. In the attached example, I need to determine that the Black, Green and Red squares are closed figures and that the Blue and Purple are open figures. Also, that the Black and Green figures share a side. I might eventually figure something out, but any guidance would be greatly appreciated.
Thanks,
David
The user will place resistors between the black dots and the program will calculate
the circuit resistance. To start the program process, I need to first find each complete circuit
(closed figure). I also need to determine circuits (figures) that share the same side. I have attached
a pic and the beginning of the program. In the attached example, I need to determine that the Black, Green and Red squares are closed figures and that the Blue and Purple are open figures. Also, that the Black and Green figures share a side. I might eventually figure something out, but any guidance would be greatly appreciated.
Thanks,
David
- Attachments
-
- Circuit Resistace Finder_Info.livecode.zip
- (3.38 KiB) Downloaded 244 times
Re: Find closed figures within a group of points?
Hi David,
I played with your stack. Polygon grcs seems better than rectangle grcs in this case.
If i think correctly a polygon is closed if last point = first point.
Best regards
Jean-Marc
I played with your stack. Polygon grcs seems better than rectangle grcs in this case.
If i think correctly a polygon is closed if last point = first point.
Best regards
Jean-Marc
https://alternatic.ch
Re: Find closed figures within a group of points?
Hi,
Jean-Marc led the way. The "points" of a graphic, though unfortunately they do not work with rectangle graphics, will let you do what you want. but you will be well served to set up a grid of some kind, a fairly coarse one at that, so that the points will snap together easily.
So if you look at the points of the black square and the green square, and again, these have to be polyLlines, not rectangles, each will have eight points. You can see how to proceed.
I bet there are many small issues to really make this easy to use. The ordering of points, or a common starting position, such as the topLeftMost, might be essential. A routine to find the common points between one or more graphics is probably essential.
When a resistor is placed at the intersection of two cirucuits you may have both parallel and series components in play. That is why the ordering of the pathway is critical
Sound like fun, though.
Craig
Jean-Marc led the way. The "points" of a graphic, though unfortunately they do not work with rectangle graphics, will let you do what you want. but you will be well served to set up a grid of some kind, a fairly coarse one at that, so that the points will snap together easily.
So if you look at the points of the black square and the green square, and again, these have to be polyLlines, not rectangles, each will have eight points. You can see how to proceed.
I bet there are many small issues to really make this easy to use. The ordering of points, or a common starting position, such as the topLeftMost, might be essential. A routine to find the common points between one or more graphics is probably essential.
When a resistor is placed at the intersection of two cirucuits you may have both parallel and series components in play. That is why the ordering of the pathway is critical
Sound like fun, though.
Craig
Re: Find closed figures within a group of points?
Jean-Mark,
Thanks for downloading my LC file.
I was in a rush to show what I was trying to do and I did a VERY poor job.
I apologize!!!
Please download the file attached to this response, as it better represents what I am trying to do.
The user will put components between the black dots (either a resistor group or a line). I am looking for a way to identify the circuits (each closed rectangular with components). In the attached example, I need a way of finding and grouping the red items, finding and grouping green items and knowing that the purple items do not complete a closed circuit (rectangle).
Thanks So MUCH,
David
Thanks for downloading my LC file.
I was in a rush to show what I was trying to do and I did a VERY poor job.
I apologize!!!
Please download the file attached to this response, as it better represents what I am trying to do.
The user will put components between the black dots (either a resistor group or a line). I am looking for a way to identify the circuits (each closed rectangular with components). In the attached example, I need a way of finding and grouping the red items, finding and grouping green items and knowing that the purple items do not complete a closed circuit (rectangle).
Thanks So MUCH,
David
- Attachments
-
- Circuit Resistace Finder_Zip_2.livecode.zip
- (4.97 KiB) Downloaded 205 times
Re: Find closed figures within a group of points?
Craig,
I totally agree with you, that I will need components to "snap" into place. I also agree that there are many challenges to this app, but I know that LC can do it. its just a matter of finding out how.
Thanks for help,
David
I totally agree with you, that I will need components to "snap" into place. I also agree that there are many challenges to this app, but I know that LC can do it. its just a matter of finding out how.
Thanks for help,
David
Re: Find closed figures within a group of points?
David.
Why is the unclosed section at the bottom not relevant? Might not the end of that section be a terminal of the resistor array? In other words, how do we know where the two ends are? There are many places they might be.
Craig
Why is the unclosed section at the bottom not relevant? Might not the end of that section be a terminal of the resistor array? In other words, how do we know where the two ends are? There are many places they might be.
Craig
Re: Find closed figures within a group of points?
Hi David,
I think you have to find a system allow to know intersections between objects. I mean a system based on object names.
You might rename you bullet like a grid (For example line of bullet "mybullet_Row_Range" like this:
"mybullet_1_1" "mybullet_1_2" etc...) for first line of bullet
"mybullet_1_2" "mybullet_1_3" etc...for second line of bullet
You will win a lot about your goal and the useful ways to find a solution.
Jean-Marc
Please, no apology (I've 'made worst)I apologize!!!

I think you have to find a system allow to know intersections between objects. I mean a system based on object names.
You might rename you bullet like a grid (For example line of bullet "mybullet_Row_Range" like this:
"mybullet_1_1" "mybullet_1_2" etc...) for first line of bullet
"mybullet_1_2" "mybullet_1_3" etc...for second line of bullet
You will win a lot about your goal and the useful ways to find a solution.
Jean-Marc
https://alternatic.ch
Re: Find closed figures within a group of points?
Craig,
The unclosed section at the bottom represents a circuit that the user did not complete and therefore its components are ignored.
The unclosed section at the bottom represents a circuit that the user did not complete and therefore its components are ignored.
Re: Find closed figures within a group of points?
jmburnod,
I am thinking that your idea of ""mybullet_1_1" "mybullet_1_2" etc..." is a good idea and I will use it.
Thanks
I am thinking that your idea of ""mybullet_1_1" "mybullet_1_2" etc..." is a good idea and I will use it.
Thanks
Re: Find closed figures within a group of points?
David.
I am interested in how a circuit is constructed, then. Are you asking for calculations of mixtures of series and parallel resistance values, based on measurements taken at various points? In other words, I do not see anything special about either closed or open structures. But I will wait for you to get farther along...
Craig
I am interested in how a circuit is constructed, then. Are you asking for calculations of mixtures of series and parallel resistance values, based on measurements taken at various points? In other words, I do not see anything special about either closed or open structures. But I will wait for you to get farther along...
Craig
Re: Find closed figures within a group of points?
Hi,
I notice that if you set the points of a grc polygon to the effective points of a grc rectangle, you get a curious result as below. Fours points for both but it seems polygon is opened and the rectangle closed.
Jean-Marc
Yes, but we can use effective points for a grc rectangle.The "points" of a graphic, though unfortunately they do not work with rectangle graphics.
I notice that if you set the points of a grc polygon to the effective points of a grc rectangle, you get a curious result as below. Fours points for both but it seems polygon is opened and the rectangle closed.
Jean-Marc
https://alternatic.ch
Re: Find closed figures within a group of points?
Craig,
Good questions!
The circuits are constructed loops within loops (rectangles) of components. I am not asking for calculations for finding the resistances, I am an Electrical engineer. I will be using what's called "Mesh Current" method. It is a somewhat complicated method using matrices, but it can solve most any resistor circuit (series, parallel or combination). But to use the "Mesh Current" method, I have to be able to identify each current loop (components (wires or resistors) that form a closed rectangle).
David
Good questions!
The circuits are constructed loops within loops (rectangles) of components. I am not asking for calculations for finding the resistances, I am an Electrical engineer. I will be using what's called "Mesh Current" method. It is a somewhat complicated method using matrices, but it can solve most any resistor circuit (series, parallel or combination). But to use the "Mesh Current" method, I have to be able to identify each current loop (components (wires or resistors) that form a closed rectangle).
David
Last edited by DR White on Sat Apr 27, 2019 10:54 am, edited 2 times in total.
Re: Find closed figures within a group of points?
jmburnod,
The user will not actually be using grc rectangles. They will be constructing rectangular figures using wires and resistors. see pic from post by DR White » Fri Apr 26, 2019 12:46 pm.
Thanks,
David
The user will not actually be using grc rectangles. They will be constructing rectangular figures using wires and resistors. see pic from post by DR White » Fri Apr 26, 2019 12:46 pm.
Thanks,
David
Re: Find closed figures within a group of points?
Sorry David, trying to link a post that way will not work unless someone is in your own timezone. The best way to link a post is to actually right click on the post title you want linked, copy the link, and then either post it raw or in linked text. Raw paste - https://forums.livecode.com/posting.php ... 9#pr179246
Linked -
Code: Select all
[url=https://forums.livecode.com/posting.php?mode=reply&f=7&t=32529#pr179246]Linked[/url]
Hope that helps

