## In Unity how do I easily snap modular building pieces to the grid without overlaps or gaps?

I’m new to Unity and purchased a set of modular building pieces from the asset store. I’m trying to arrange pieces of wall. The pieces are 5 x 5 x 0.5, so I’ve set my world grid size to 5 units and am using align to grid to make them line up nicely. I’m running into an issue when I try to make a corner. When I align the pieces to the grid, there is some gap and overlap, as seen in this picture:

I then tried to manually move the end piece inwards, which resulted in this:

That looks slightly better, but needed a manual adjustment so I don’t think doing this everywhere scales very well, and plus there is some kind of visual/lighting artifact where the pieces overlap (hard to see in the screenshot but very obvious when I move around in game mode). Then I tried resetting that end piece back to the grid and pushing the two side pieces inwards, which resulted in this:

This looks good and has no overlap, but required a bit of manual adjustment and brought the sides off of the grid.

Assuming a set of wall pieces that are 5x5x0.5, how can I configure my grid and snap settings so that everything fits together nicely?

## Upper bound on the average number of overlaps for an interval within a set of intervals

Let $$\mathcal{I}$$ be a set of intervals with cardinality $$L$$, where each interval $$I_i \in \mathcal{I}$$ is of the form $$[a_i, b_i]$$ and $$a_i, b_i$$ are pairwise distinct non-negative integers bounded by a constant $$C$$ i.e. $$0 \leq a_i < b_i \leq C$$. We say a pair of intervals $$I_i, I_j \in \mathcal{I}$$ overlap if the length of overlap is $$> 0$$.

Define a function $$F(i)$$ which computes the number of intervals in $$\mathcal{I} \backslash I_i$$ that interval $$I_i$$ overlaps with. $$$$F(i) = \sum_{j=1, j \neq i}^{L} Overlap(I_i, I_j)$$$$ where the function $$Overlap(I_i, I_j)$$ is an indicator function which returns 1 if $$I_i, I_j$$ overlap, else it returns 0.

The average number of overlaps for the intervals in $$\mathcal{I}$$, denoted by $$Avg(\mathcal{I})$$ is given by $$Avg(\mathcal{I}) = \dfrac{\sum_{i=1}^{L}F(i)}{L}$$.

The question is, suppose we are allowed to choose the intervals in the set $$\mathcal{I}$$ with the following additional conditions:

1. For any $$t \in [0, C]$$, we have at most $$M$$ (and $$M < L$$) intervals in $$\mathcal{I}$$ such that $$t$$ is contained within those $$M$$ intervals. Stated differently, at most $$M$$ intervals overlap at any point in time.
2. Any interval in $$\mathcal{I}$$ overlaps with at most $$K$$ other intervals, and $$M < K < L$$.

then, what is an upper bound on $$Avg(\mathcal{I})$$ for any choice of the intervals in $$\mathcal{I}$$ satisfying 1, 2?

In case you are wondering, this problem is of interest to me in order to be able to study the run-time of a scheduling algorithm.

I am unable to come up with a non-trivial upper bound for $$Avg(\mathcal{I})$$ and would be interested to know if the problem I stated has been studied. I am also open to ideas on how one may be able to obtain a tight upper bound for $$Avg(\mathcal{I})$$.

## What happens if the Daylight spell overlaps with the Hunger of Hadar spell?

The hunger of Hadar spell states:

You open a gateway to the dark between the stars, a region infested with unknown horrors. A 20-foot-radius sphere of blackness and bitter cold appears, centered on a point with range and lasting for the duration. This void is filled with a cacophony of soft whispers and slurping noises that can be heard up to 30 feet away. No light, magical or otherwise, can illuminate the area, and creatures fully within the area are blinded.

The void creates a warp in the fabric of space, and the area is difficult terrain. Any creature that starts its turn in the area takes 2d6 cold damage. Any creature that ends its turn in the area must succeed on a Dexterity saving throw or take 2d6 acid damage as milky, otherwordly tentacles rub against it.

And the daylight spell states:

A 60-foot-radius sphere of light spreads out from a point you choose within range. The sphere is bright light and sheds dim light for an additional 60 feet.

If you chose a point on an object you are holding or one that isn’t being worn or carried, the light shines from the object and moves with it. Completely covering the affected object with an opaque object, such as a bowl or a helm, blocks the light.

If any of this spell’s area overlaps with an area of darkness created by a spell of 3rd level or lower, the spell that created the darkness is dispelled.

Which of these spells is more specific and wins out over the other? What happens if their areas overlap?

## Is it possible for DHCP in one network interface to assign a local IP address that overlaps with the subnet of another interface?

iface eth0 inet dhcp  iface eth1 inet static   address 192.168.1.1   netmask 255.255.255.000 

Is it possible for a host to connect to eth0 and get assigned an address that is part of eth1‘s subnet domain (anything from 192.168.1.2 to 192.168.1.255)?

What averse consequences will this have in practice and is the expected (mis-)behavior deterministic?

Is there something that can be done to prevent this while leaving the static and dhcp methods unchanged? I couldn’t find anything on the man page.

## Set of maximum overlaps

Assume I have a list of $$N$$ regions $$\{S_i\}, i \in [1,N]$$ which may or may not overlap.

I also have a boolean function $$F(S_{i_1},\dots,S_{i_k})$$ (with $$2 \le k \le N$$) which tests whether all regions $$S_{i_k}$$ overlap, that is if they contain a common element.

I want to build the unique smallest (i.e. of smallest cardinal) set $$L$$ of sets of overlapping surfaces with the constraint that each surface must appear in at least one set.

The problem is to identify the algorithm that builds $$L$$ using the least expected number of calls to the function $$F$$ for a random distribution of overlaps between the surfaces $$\{S_i\}$$ (i.e. with a flat prior).

To fix ideas, here is a graphical representation of the problem for 5 regions (but please answer the abstract problem, not the particular realisation below):

Maximum overlap problem representation for five regions

In that example, the solution set $$L$$ is:

$$\{ \{S_1, S_2, S_3\},\; \{S_3, S_4\},\; \{S_5\} \}$$

And here are some examples of the output of the function $$F$$:

$$F(S_1, S_2)=\rm{True}$$

$$F(S_1, S_3)=\rm{True}$$

$$F(S_1, S_2, S_3)=\rm{True}$$

$$F(S_1, S_2, S_3, S_4)=\rm{False}$$

$$F(S_2, S_4)=\rm{False}$$

$$F(S_4, S_5)=\rm{False}$$

$$F(S_i)=\rm{True}, \forall i$$

etc…

## Algorithm for detecting overlaps

This is a real-world application, not a student assignment.

Suppose a list of events of that have startTime and endTime, and some overlap information. In pseudocode:

class Event {     Time startTime;     Time endTime;     bool overlapsStart;     bool overlapsEnd; } 

Events are considered overlaping if and only if their times intersect, but it’s not considered overlap if some event just “touches” another (starts exactly when some other finishes).

There are two types of event: NormalEvent and EmptyEvent.

What I want?

For each event in the list, I want to:

1) Remove all EmptyEvents that overlap another event of any type. In special, if some EmptyEvent overlaps another EmptyEvent, only one needs to be removed, so that the overlap ceases.

2) The NormalEvents are first ordered by startTime, and then their booleans are set:

• overlapsStart is true if the event overlaps some event that comes before it.

• overlapsEnd is true if the event overlaps some event that comes after it.

A trivial example:

event1 = 6:00AM ➜ 8:00AM  

and

event2 = 7:00AM ➜ 9:00AM 

then:

event1.overlapsStart == false event1.overlapsEnd == true  event2.overlapsStart == true event2.overlapsEnd == false 

Another example:

Now, this is what happens if some event “contains” another:

event1 = 6:00AM ➜ 9:00AM  

and

event2 = 7:00AM ➜ 8:00AM 

then, first event1 is put before event2, since it starts before. Then:

event1.overlapsStart == false event1.overlapsEnd == true  event2.overlapsStart == true event2.overlapsEnd == false 

Naive implementation: I could analyze each event in turn, one by one, looking at all other events. That’s easy, however this is too slow for a large number of events.

My question: What’s an efficient way of solving this?

## How two avoid label of 2 layer in layer group overlaps in geoserver?

I have been create 2 layer with a text label of each other. When I add that 2 layer in a layer group, I see that 2 label of 2 layer overlaps like in image bellow: 2 label overlap of 2 layer

## Covering lemmas in Hochman’s “On self-similar sets with overlaps and inverse theorems for entropy”

I am confused about the covering lemmas in the captioned work and really hope to get some ideas here.

Firstly it is lemma 3.7. (Image of Lemma 3.7) (for convenience here is the lemma of this lemma (Image of Lemma 3.6))

I do not understand the ”$$\supseteq$$” in the line ”$$J’\cap(J’-\ell)\supseteq \cdots$$”. Also I am wondering if the following provides a counter-example of this line and this lemma:

Let $$n=12$$, $$I=\{0,1,2,3,4,5,6,7,8\}$$, $$m=3$$. Then $$I’=\{0,4,8\}$$ by the construction in Lemma 3.6. Let $$J=\{0,2,4,6,8,10,12\}$$, $$\delta=0.5$$. Then for all $$i\in I$$, $$|[i,i+3]\cap J|=2\geq(1-\delta)m$$. Take $$\ell=1$$. Then for all $$J’\subseteq J$$, we have $$J’\cap(J’-\ell)\subseteq J\cap(J-\ell)=\emptyset$$, $$\bigcup_{i\in I’} J\cap[i,i+2]=\{0,2,4,6,8,10\}$$, and $$(1-\delta-\frac{\ell}{m})|I|=(\frac{1}{2}-\frac{1}{3})\cdot 9 >0$$.

Secondly, it is lemma 3.8.(Excerpt for Lemma 3.8), which I am not sure how the marked inequality is obtained.

Since subsequent results depends on these lemmas and this paper is already acknowledged in the field, I think there should be an answer for resolving my confusion.

Thanks for help!

## Are there any canonical correlations or known overlaps between D&D settings’ various timelines that could be used to determine when they correspond?

D&D canon has demonstrated numerous times that the various campaign settings are in fact, connected to each other. Powerful beings from Greyhawk, Forgotten Realms, and even Athas have found ways into other campaign settings in the D&D stable of worlds. (Even Earth is included in the list of alternate Primes visited, interestingly enough.)

Irrespective of the means used to cross from one campaign setting world to the other, are there any solid timeline references, correlations, or overlaps (specific dates or even a range of dates) where it can be demonstrated what year (or range of years) a cross-setting traveler would end up in when moving from any given setting to any other given setting?

For example, it has been demonstrated that both Elminster and Mordenkainen have traveled to each other’s home Prime, as well as to Earth (apparently during the 70’s – 80’s). This provides a basic frame of reference, however they both lived rather long lives, and thus only provides a common range of dates that overlap in Oerth and Abeir-Toril; namely the date range of the span of their lives, or at least after they both reached a certain level of power.

I am open to timelines from any edition of Dungeons and Dragons, and all official campaign settings in the D&D stable (Spelljammer, Maztica, Mystara, Al-Qadim, Ravenloft, Planescape, Greyhawk, Forgotten Realms, Birthright, Athas, Dragonlance, Red Steel, Odyssey, Lankhmar, Conan, and so forth). Also, as the presence of our modern Earth is explicitly included in D&D canon, using Earth-based cross-references to multiple campaign settings in order to establish a linkage is also acceptable. I would prefer to avoid time travel, unless said reference manages to establish a firm date link.

Thank you. I’m sure this will not necessarily be easy to research.

## Find overlaps in ranges pairwise

I’ve wrote a function which take in a list of ranges (the ranges being tuples) and then returns a list of dictionaries which are a summary of how these ranges overlap with each other

There’s not a lot of context to this to take into consideration, I was just aiming to find the overlaps pairwise from a list of ranges. The comments are mostly there for this post. The average amount of ranges I had in mind when developing this was 10.

I’m hoping to get this reviewed mostly just to get other peoples opinions on the function. Another way to do this would be to compare all the ranges individually against each other but I didn’t like the idea of that.

Terms:

• encapsulated: These ranges are within this range.

• higherLinked: These ranges overlap, and are more to the right of this range.

• lowerLinked: These ranges overlap, and are more to the left of this range.

• matches: Ranges match each other.

Code:

import collections  # Return a list of dicts. # Each dict is is a overlap summary of an individual range within the range list parameter. def do_ranges_overlap_pairwise(rangeTupleList):     sortedRangeTupleList = sorted(rangeTupleList, key=lambda elem: elem[0])     rangeDict = collections.OrderedDict()     overLapDictList = []      def getPartnerKey(key):         if "A" in key:             return key.replace("A", "B")         elif "B" in key:             return key.replace("B", "A")      # Creating an ordered dict and then sorting it by value.     for iteration, rangeTuple in enumerate(sortedRangeTupleList):         sortedRangeTuple = sorted(rangeTuple)         rangeDict["{}A".format(iteration)] = sortedRangeTuple[0]         rangeDict["{}B".format(iteration)] = sortedRangeTuple[1]      sortedRangeDict = collections.OrderedDict(sorted(rangeDict.items(), key=lambda t: t[1]))     keyList = list(sortedRangeDict.keys())  # Ordered list of the keys      # Loop A keys, find the range inbetween itself and it's B pair.     for key in keyList:         if "A" in key:             keyB = getPartnerKey(key)             lowerOverlapIndex = (keyList.index(key) + 1)             higherOverlapIndex = keyList.index(keyB)             overLapRange = keyList[lowerOverlapIndex:higherOverlapIndex]              overlapDict = {                 "range": (sortedRangeDict[key], sortedRangeDict[keyB]),                 "hasOverlaps": len(overLapRange) > 0,                 "encapsulated": [],                 "higherLinked": [],                 "lowerLinked": [],                 "matches": []             }              # Sort the overlapped key into a list based on it's nature.             for overlapKey in overLapRange:                 partnerKey = getPartnerKey(overlapKey)                  if sorted((sortedRangeDict[overlapKey], sortedRangeDict[partnerKey])) == sorted((sortedRangeDict[key], sortedRangeDict[keyB])):                     overlapDict["matches"].append(sorted((sortedRangeDict[overlapKey], sortedRangeDict[partnerKey])))                  elif "A" in overlapKey and partnerKey in overLapRange:                     overlapDict["encapsulated"].append((sortedRangeDict[overlapKey], sortedRangeDict[partnerKey]))                  elif "A" in overlapKey and partnerKey not in overLapRange:                     overlapDict["higherLinked"].append((sortedRangeDict[overlapKey], sortedRangeDict[partnerKey]))                  elif "B" in overlapKey and partnerKey not in overLapRange:                     overlapDict["lowerLinked"].append((sortedRangeDict[partnerKey], sortedRangeDict[overlapKey]))              overLapDictList.append(overlapDict)      return overLapDictList 

Example function call:

import pprint pp = pprint.PrettyPrinter(indent=4) pp.pprint(do_ranges_overlap_pairwise([(2, 4), (3, 8), (5, 6), (1, 10), (9, 10), (9, 10)])) 

Example output:

[   {   'encapsulated': [(2, 4), (3, 8), (5, 6)],         'hasOverlaps': True,         'higherLinked': [(9, 10), (9, 10)],         'lowerLinked': [],         'matches': [],         'range': (1, 10)},     {   'encapsulated': [],         'hasOverlaps': True,         'higherLinked': [(3, 8)],         'lowerLinked': [],         'matches': [],         'range': (2, 4)},     {   'encapsulated': [(5, 6)],         'hasOverlaps': True,         'higherLinked': [],         'lowerLinked': [(2, 4)],         'matches': [],         'range': (3, 8)},     {   'encapsulated': [],         'hasOverlaps': False,         'higherLinked': [],         'lowerLinked': [],         'matches': [],         'range': (5, 6)},     {   'encapsulated': [],         'hasOverlaps': True,         'higherLinked': [],         'lowerLinked': [(1, 10)],         'matches': [[9, 10]],         'range': (9, 10)},     {   'encapsulated': [],         'hasOverlaps': True,         'higherLinked': [],         'lowerLinked': [(1, 10)],         'matches': [[9, 10]],         'range': (9, 10)}] 

Timing

10 ranges: real    0m0.045s user    0m0.032s sys 0m0.010s   100 ranges: real    0m0.143s user    0m0.122s sys 0m0.015s   250 ranges: real    0m0.682s user    0m0.625s sys 0m0.046s   500 ranges: real    0m2.812s user    0m2.636s sys 0m0.145s   1000 ranges: real    0m13.607s user    0m13.033s sys 0m0.492s