## Joining points of polygon in correct order

I have a point’s array of some 2d shape(polygon). The polygon could be either crossed or convex, I don’t know it. And I want to join those points in the correct order.

My first thought was to take some point as an origin and start looking for the closest one and so on. But this approach doesn’t work for some crossed polygons, for example: on Image1, it would go from `x3` to `x5` because it is closer than to `x4`, but what I really want is to join `x1-x2-x3-x4-x5-x6`.

After some thinking, I’ve realized that my requirement `correct order` is very unclear because on Image2 red lines are in the correct order too. So let’s add the requirement that polygon lines shouldn’t at least cross.

I really confused, can someone point me in what direction I should move? Maybe it’s some famous algorithm but I just don’t know how to google it properly. Thanks.

Image1:

Image2:

## can I extend the WP_Query class to deal with ‘duplicate’ posts created by joining to wp_posts?

Based on the premise that one big database requests is better than many smaller ones, I’ve modified WP_Query for my custom post type ‘word’ and joined three tables to it. The resulting query looks more or less like this and works well.

``SELECT wp_posts.*, verbs.*, nouns.*, definitions.* FROM wp_posts   LEFT JOIN verbs ON ( wp_posts.ID = verbs.word_id )   LEFT JOIN nouns ON ( wp_posts.ID = nouns.word_id )   LEFT JOIN definitions ON ( wp_posts.ID = definitions.word_id )   WHERE 1=1   AND wp_posts.post_type = 'word'  AND (wp_posts.post_status = 'publish' OR [...] )   ORDER BY wp_posts.post_title ASC  ``

I of course now have duplicate posts for each of the words’ respective definitions and I am rolling them back up into one post per word with an array of definitions instead.

But because these results are used in different ways all around the website, I’m having to write similar logic time and time again. Here, for example, I am using the data in an AJAX response.

``    \$  query = new WP_Query( \$  args );      \$  posts = \$  query->get_posts();      if ( \$  query->post_count ) > 0 )     {         \$  prev_word = null;         foreach ( \$  posts as \$  key => &\$  row )          {             if ( !property_exists( \$  row, 'definitions' ) ) \$  row->{'definitions'} = array();              \$  definition = array(                 'definition_id' => \$  row->definition_id,                 'definition' => \$  row->definition,                 'note' => \$  row->note,             );              if ( is_object( \$  prev_word ) )             {                 if ( \$  prev_word->post_id == \$  row->post_id )                 {                     // update the previously inserted row                     \$  prev_word->definitions[] = \$  definition;                      // remove the current row                     unset( \$  row );                      continue;                 }             }              \$  row->definitions[] = \$  definition;             \$  prev_word = \$  row;         }     }      echo json_encode( array_values( \$  posts ) );     die();  ``

What I would like to do now is extend the WP_Query class to have this done automatically on construction.

``class Words_Query extends WP_Query {     function __construct( \$  args = array() )     {         \$  args = array_merge( \$  args, array(             'post_type' => 'word'         ) );          parent::__construct( \$  args );          [insert magic here?]     }      public \$  definitions = array(); } ``

I don’t have any experience with OOP though so I am asking for some help/guidance. Is something like this possible?

Will I have to update a bunch of other properties to reflect the changes…? Like \$ post_count

What other things might I need to be aware of?

Thanks

## Can I Avoid Joining The Same Table 3 Times?

I have this database schema on a Oracle 12c database :

I’m trying to answer this question :

What is the game in which Dallas Mavericks had the biggest percentage of successful 3-point shots ?

I’ve managed to answer this question with this query:

``SELECT HOME_TEAMS.TEAM_NAME                    "HOME TEAM",        AWAY_TEAMS.TEAM_NAME                    "AWAY TEAM",        GAMES.GAME_DATE                         "DATE",        TEAMS.TEAM_ID                           "GENERIC ID",        HOME_TEAMS.TEAM_ID                      "HOME_ID",        AWAY_TEAMS.TEAM_ID                      "AWAY_ID",        GAME_STATISTICS.X3POINTSHOTS_PERCENTAGE "3 POINTS PERCENTAGE" FROM GAMES_TEAMS_STATISTICS          INNER JOIN GAMES ON GAMES_TEAMS_STATISTICS.GAME_ID = GAMES.GAME_ID          INNER JOIN TEAMS ON GAMES_TEAMS_STATISTICS.TEAM_ID = TEAMS.TEAM_ID          INNER JOIN TEAMS HOME_TEAMS ON GAMES.HOME_TEAM = HOME_TEAMS.TEAM_ID          INNER JOIN TEAMS AWAY_TEAMS ON GAMES.AWAY_TEAM = AWAY_TEAMS.TEAM_ID          INNER JOIN GAME_STATISTICS ON GAMES_TEAMS_STATISTICS.STATS_ID = GAME_STATISTICS.STATS_ID WHERE TEAMS.TEAM_ACRONYM = 'DAL' ORDER BY GAME_STATISTICS.X3POINTSHOTS_PERCENTAGE DESC     FETCH FIRST 1 ROWS WITH TIES; ``

However, to answer this question , I join the teams table 3 times. Is there any way I can write this query in a more efficient way , avoiding so many joins ?

## Calculate number of triangle that can be formed by joining special nodes in a tree

Problem source : CHGORAM2 Problem : A tree is given to us and it’s nodes are marked as 1 or 0 . We need to calculate how many triplets (x,y,z) can be formed such that node x,y,z are marked as 1 and distance(x,y) = distance(y,z) = distance(z,x) .Here distance(x,y) denotes distance between node x and y.Also x,y,z need to be distinct.

I am only able to solve it using brute force . But Editorial mentions some O(n) solution which i did not understood.

## What’s the scam? Unknown users joining and leaving WhatsApp groups

I’m on a few WhatsApp groups that have signup links. Lately (last few months) I’ve noticed some very odd activity on a few of these groups: every few days I notice a number (often from a country with a poor reputation for scamming) joining, and then leaving the group, like this:

And I’m wondering, what is the scam being cooked up here? Have they got some kind of brute force bot that signs up for whatever WhatsApp groups it can find? And then does…what? Scrolls through the group member list and harvests their phone numbers? To do…exactly what with them? Send SMS spam, telling people they’ve won the \$ 16.4m Bill Gates Philanthropic Award For Owning a Phone?

If that’s the extent of the threat, then I can live with it. But is there anything else these bots could be doing that is more sinister?

## Joining a Windows 10 client as a guest VM on ubntu ( Configured with kvm ) to windows domain

I have a Ubuntu 18.04 client in my Windows domain , I don’t wanna join this machine to this domain but I have a Windows 10 as guest VM on this host(KVM installed ) that I wanna join that Virtual machine to domain , how can I do that and what is network configuration in KVM ?

## Joining Ubuntu core to Windows active directory

I have been trying to join some devices running Ubuntu core to the corporate active directory. We could get any standard procedures that worked. We tried the Ubuntu methods, but unable to do as the packages don’t install correctly in Ubuntu core.

Can anyone help on how to join Ubuntu core to windows AD domain controller

Note: I am quite new to the subject.

## Would garou tribes be alright with a kinsfolk joining the Second Inquisition?

Is there anything within lore, that might suggest as to whether different Garou groups who have them, would be alright with homid kinsfolk leaving them to try join the Second Inquisition/FIRSTLIGHT?

With how they culturally dislike vampires and view them as “Wyrm Creatures”, as well as how being part of the supernatural world means they might hear of the formation of the Inquisition, it seems like some might at least want to try – in absence of being able to take other active roles that Garou relatives can, in combatting the wyrm.

The aforementioned Garou relatives, also feeling like they could potentially serve as a “consequence”/additional danger in the world: Persistent FIRSTLIGHT solider is killed. Good. That threat is over. But now you have angry garou relative/s who are now about, wanting revenge.

But, is there anything in lore about whether the tribes would actually allow or be okay with in-the-know Kinsfolk doing this?

(Not necessarily specifically lore talking about this specific situation – but at least on something in lore that’s similar/related that could help come to a conclusion on this: like on kinsfolk leaving and what’s expected/permitted of them in tribes)

Or if they could or would object, for reasons such as this perhaps entailing them leaving behind the tribe itself and any duties they might expect of them there, or worries about them talking or being found out.

## Sharepoint Designer 2013 trouble joining lists

I am attempting to join two lists, the idea is that I want to have two different sets of permissions for different parts of a list. I know column based security is not available so I figured by having two separate lists with a single view would allow different people to view/edit different data.

My problem is when trying to perform the joined data source via sharepoint designer 2013 most tutorials explain that after selecting two lists I can pick a shared column to use for the joining. This option however does not appear to me, the lists simply “join” and when the joined data source is displayed, it displays only one of the list’s data while the columns from the other list are empty.

## Joining Two Working Formula’s

I have the following working formula

Located in K2 =IF(INDEX(Details!B18:B81,MATCH(C2,C2,0))<>C2,S30,”0″)

So I want it to only use the number in S30 if the date in C2 is not in a range of dates on the Details Page within B18:B81

Now I need to use this formula on the below cells, however, there is an additional check that needs to be done

This working formula is

Located in K3 =IF(AND(C3 < TODAY()+1, J2<>””), K2+S\$ 30, )

So I am wanting the above formula to do what it does if the date in C3 is not in the range on the Details Page within B18:B81 (The date range is either Sunday’s or days closed)

If C3 is in the range I want it to add Zero instead of the number from S30

The attached image gives you the cells referenced and for this formula, S30 is equal to 2