# Finding the sandwich sector/point

Hi! I’am trying to develop a logic to find the sandwich sector/point as shown in the diagram- I tried the closest point approach [ found the dist between from destination"A" to remaining destinations and summed it up , similarly did the same for other two points and the one with shortest distance becomes the point in between. This logic fails in case of an oblong shape[( where the actual in between point is far off). Refer image below. Any ideas?

If this means finding the ccx between the A,B line (as LineCurve) and the common edge (if the ccx exists, that is) then do a brep from the out Curve and split the BrepFace with the other two (or more) LineCurves. This yields a Brep with faces that are connected in “similar” ways with a mesh. Then start playing connectivity games. Prior all that see Methods available in R SDK for Brep (BrepFace) connectivity (Faces, Edges, Vertices, Cats and Dogs).

Here’s a hint (limited time available: wind starts to build-up > waves wait for me).

BrepFace_Split_JustAHint_V1.gh (19.3 KB)

So … what you have to do is an EF connectivity thingy (E: edge, F: Face).

Hail Dark Lord!
Appreciate the help… but I’am after the mid sector.
// take a square or any piece of land cut it into 4 parts ( in anyway you like)
// remove one part(randomly, now you are left with three parts)
// Now i want to find out the mid/sandwich plot from these 3 sectors.
I’am unable to think of logic for this.

You are surfing way harder than required. Save some boards for the next season

Life’s short you know: whatever you do … do it to the max (and beyond).

On less important matters: My dear Watson that’s still a connectivity game. See attached (and elaborate further - the first thing to do is a 2 dimension FF Tree since the general case is a List of parcels).

In plain English: find the Face that is connected with 2 Faces => the bacon in your Big Mac (i.e. in the FF tree … get the branch that has 2 items where the path.Indices[0] is the index of the bacon).

BrepFace_Split_JustAHint_V1A.gh (121.2 KB)

Obviously for more complex queries we need a custom Class (say: a BrepInfo thingy that contains any info/property imaginable on these Breps … then we just write the proper LINQ Query: Find the Brep that has 2.78 adjacent Breps PLUS has 6.66 holes (each one has 66 edges) PLUS has 666.66 Edges PLUS is yellow PLUS is invalid).

Here’s another hint on that query matter (let’s say: the general case):

As a challenge modify the Class by adding connectivity data (may the dark Force be with you).

Dear DarkLord.
Can we add another input, to cull on of the faces and also output it differently. I’am going deeper into the rabbit hole- would need more time to do this on my own- time is precisely what I don’t have(don’t we all suffer from the same problem).

Mr.A

Er … to be honest … right now I suffer from broken fins (causing an instant spin-out [ the board “oversteers” so to speak] that yields some unpleasant situations).

Anyway the good news are that there’s no wind this w/e (but the bad ones are that there’s MotoGP [Forza Vale]).

Anyway … provide some test parcels, hints/rules upon how you divide them and an EXACT description of what you want to get (BTW: EXACT means … er … EXACT).

Dear Lord of Darkness,
You are pushing me into the rabbit hole(enjoying this).
I wrote some new lines into your code. Somehow I’am not able to cull the index from the list I created…why?
Kindly see the file attached.BrepFace_Split_JustAHint_V1A_edit1.gh (126.2 KB)

Er … are you doing the Vodka thing? (try Tequila):

Q: Can we Remmmmove the broken fins and add new ones?

availableFins = availableFins.Where(x=>x.IsNotBroken()).ToList();
if(!availableFins.Any()) {Print(“No honey, no party: Adios amigos”); return;}

That said when you use an index for removing something you should ALWAYS test the index against the collection size:

if(r>= collectionSize) r = collectionSize -1; (if collection is List use Count, if is Array use Length, if is bananas use BananasCount).

BTW (Avoid doing things on conn trees, just control what to get after the party):

BrepFace_Split_JustAHint_V1A_ReplaceVodkaWithTequila.gh (129.6 KB)

Ican make much sense of what you wrote(the rabbit hole gets deeper), but can we do the adjFaces and the other operations after culling the face with index(sjip) first?

took another dig at it- A new error;BrepFace_Split_JustAHint_V1A_edit2.gh (123.6 KB)

Well … certainly you can do that by restricting things in the connectivity tree Methods … but is the wrong way to go:

Now … this case of yours is very simple … but imagine some other far more complex query that requires full connectivity data (but excludes some faces because of this or that filter etc etc). Or imagine multiple queries running in // (meaning that they relay also on full connectivity data … otherwise you shoot yourself in the foot … er … hmm … many times [try it: is kinda fun]).

For instance: find the faces that are not naked (they are 3) and then sort them by area:

Or imagine the real/proper thing (a Class that contains conn info as well, that is) that at construction time is unaware of any filtering policy etc etc.

The moral of the day: ALWAYS think the forest and forget the tree.

BTW: Grace period/simple cases are over: THIS is the proper challenge for you (only for the brave, mind): read instructions, do the thing and start digging a BIG rabbit hole: the End of Days in nigh.

BrepFace_Split_JustAHint_V1B.gh (130.3 KB)

The moral of the day: to the end (and beyond)

Accepted![ need to cool off… temp +48 deg here in Delhi]

I hate heat (my limit is about 30 deg).

Other than that (and by staying to the initial images posted [Split using a cross]): Instead of asking questions (related with the index of the random MIA face) and then modify accordingly the conn Trees … just pick any face you want and get the other adjacent 2 from the FF tree: Colombus stuff etc etc.

Other than that … well … several pros hate LINQ (is slow and PLINQ is not a rocket either). But truth is that in most AEC related queries (The norm: items are few, questions are “composite”) this way is quite handy. So I would strongly recommend to take a brake and get the gist of the thing:

http://linq101.nilzorblog.com/linq101-lambda.php

Other than that paint your buildings blood red: