How do I expand my simplex in Expanding Polytope Algorithm (EPA) when the origin lies on it?

I’m doing GJK + EPA in 2D for collision detection + resolution.

For GJK, I was using the vector (1,0) as my first support direction. However, if the origin happens to fall exactly on the simplex line ( quite easily happens with circles placed on an axis-aligned plane), inside EPA, it doesn’t know which direction to expand to. That is because the expansion is supposed to happen in the direction of origin. But because the origin is on the line, the vector towards origin has a length of 0. So although collision is detected in GJK, I don’t get any contact normal + penetration depth from EPA.

I’ve ‘solved’ it by randomizing the initial support direction every time. It can still miss a few times in a second but the visual result looks fine.

Is there a standard way of handling this edge case that I don’t know of? Or maybe this shouldn’t be happening at all and I’m doing something wrong?

What spells or magic items are available to detect lies?

I’m playing through Storm King’s Thunder, and came across an unusual magic item:

Gavel of the Venn Rune

The Gift of Truth feature for this item says:

Whenever a creature utters a lie while within the 30-foot-radius sphere, that creature takes 5 psychic damage and flinches visibly.

This is pretty cool, but it makes me wonder:

What spells or magic items are available to detect lies?

Which computational framework lies behind the Chinese “Social Credit System”?

BACKGROUND

The Social Credit System is a data-driven reputation system which draws on several sources to label various entities, namely businesses and individual citizens, with a trustworthiness score. One can only guess that Facebook implements similar systems, albeit for different goals. What these systems have in common is that they’re based on an ontology, i.e., a finite set of entity-relations, which fix the constraints on the correlations between the various entities to be scored. One could think of similar ontologies in, say, cybersecurity, whereby various entities (domains, IP addresses, e-mails, etc.) can be seeded with beliefs or initial scores of maliciousness which will then propagate to their neighbors according to particular rules. The same could be done with fault prevention or forensics in mechanical systems of interacting entities.

QUESTION

Conceptually speaking, is there a common framework that best represents these systems? I initially thought of Bayesian propagation, but it seems that it doesn’t easily account for

  • uncertainties in the scores,
  • loops in the ontology graphs (how does one avoid runaway “feedback”?),
  • non-linearities at the nodes (since scores can be generated at a node itself based on its attributes, regardless of its neighbors). For example: Bob is a successful surgeon, Bill is a drug addict. Therefore, Bob is less likely than Bill to commit a crime—and that’s independently of any inference from their respective environments.

Rumors, Lies and weight loss formula

It takes many practice, but once you get the hang of it, you'll be cranking out Keto Max Shred like crazy. That's where we've been these past 10 weeks and it has been great. I guess it's time for Keto Max Shred to put in an appearance. Keto Max Shred first appeared on the market in the 1940's. Another reason is the scope of Keto Max Shred products and services that are offered. It is one of the most common Keto Max Shred in order…

Rumors, Lies and weight loss formula

How to find all subarrays whose bitwise and lies in a given range?

Given an array A of integers,we are required to find subarrays ,the bitwise & of whose elements lie in a given range low to high where

low < min(A[0],A[1]....A[n-1])

and

high = min(A[0],A[1]..A[n-1])

i.e. Find all {i,j} such that low <= A[i]&A[i+1]&...&A[j] <=high

I have thought about this for a long time but can’t seem to come up with anything except the naive implementation of generating all subarrays.

Can there be an asymptotically better solution for this?

Airline lies about reasons for technical problems to avoid compensation

Our flight from Europe to South America with a European Airline was cancelled on the 4-5 hours prior to departure due to “technical problems” and we had to take the next flight 24 hours later.

Corresponding to European law, the airline would thus have to compensate us with 600 Euros each plus expenses for hotels and food.

Conveniently for the airline, they argue that those technical problems were caused by bird strike and therefore are uncontrollable (a reason that is explicitly excluded for compensation).

However, we know other passengers traveling with the same plane and the reason they got was that the plane was struck by lighting – which again is a reason that wouldn’t require them to pay.

–> After all it seems the airline is making up various reasons so they don’t have to pay.

What would be your next steps?

Would the airline give us more technical details on the problem and what they did to fix it? Basically, I want them to prove that the reason they gave me is legit.

Should we take a lawyer and sue the airline?

Could the airline also be sued for fraud if it turned out they are intentionally lying to their customers about the reasons for delayed flights?

Which programming pattern is best for checking which partition a number lies in?

I have an interval partitioned into “MECE” subintervals, and I want to check which subinterval a number lies in.

(MECE stands for “mutually exclusive & collectively exhaustive”, meaning the partitions do not overlap and they leave no gaps in between.)

First I simply used if .. else if:

;    if (0/6 <= h && h < 1/6) { rgb = [c, x, 0] } else if (1/6 <= h && h < 2/6) { rgb = [x, c, 0] } else if (2/6 <= h && h < 3/6) { rgb = [0, c, x] } else if (3/6 <= h && h < 4/6) { rgb = [0, x, c] } else if (4/6 <= h && h < 5/6) { rgb = [x, 0, c] } else if (5/6 <= h && h < 6/6) { rgb = [c, 0, x] } 

Then I tried using the ternary operator:

rgb =     (0/6 <= h && h < 1/6) ? [c, x, 0] :     (1/6 <= h && h < 2/6) ? [x, c, 0] :     (2/6 <= h && h < 3/6) ? [0, c, x] :     (3/6 <= h && h < 4/6) ? [0, x, c] :     (4/6 <= h && h < 5/6) ? [x, 0, c] :     (5/6 <= h && h < 6/6) ? [c, 0, x] : [c, x, 0] 

I also read about how object lookups are a more performant alternative to switch statements. Since I’m not checking the exact value of h, I had to improvise:

rgb = ({     [`$  {(0/6 <= h && h < 1/6)}`]: [c, x, 0],     [`$  {(1/6 <= h && h < 2/6)}`]: [x, c, 0],     [`$  {(2/6 <= h && h < 3/6)}`]: [0, c, x],     [`$  {(3/6 <= h && h < 4/6)}`]: [0, x, c],     [`$  {(4/6 <= h && h < 5/6)}`]: [x, 0, c],     [`$  {(5/6 <= h && h < 6/6)}`]: [c, 0, x], })['true'] 

The problem with object lookup is that there will be five keys of 'false', which is not good practice. So I wanted to use a similar lookup, but using ES6 native Map class:

new Map([     [[0/6, 1/6], [c, x, 0]],     [[1/6, 2/6], [x, c, 0]],     [[2/6, 3/6], [0, c, x]],     [[3/6, 4/6], [0, x, c]],     [[4/6, 5/6], [x, 0, c]],     [[5/6, 6/6], [c, 0, x]], ]).forEach((value, key) => {     if (key[0] <= h && h < key[1]) rgb = value }) 

Which is the most readable, maintainable, fastest-running way to achieve this? Are there any other options?