physics – Proper sphere collision resolution?

I am implementing a sphere to sphere collision resolution and I am a little confused on where to start. First question, is there a standard way that games/engines do sphere to sphere collision resolution? Is there only like a couple standard ways to do it? Or does the resolution vary very heavily based on whats needed?

I want to implement this in my engine and I wrote a basic one that pushes a sphere and another sphere (so basically the one interacting can push the other) but this was just a super simple concept. How exactly can I improve this to make it more accurate? (Mind you the code isn’t optimized since I am still testing)

It seems like there is a lack of solid documentation on collision resolution in general as it’s a more niche topic. Most resources I found only concern the detection part.

bool isSphereInsideSphere(glm::vec3 sphere, float sphereRadius, glm::vec3 otherSphere, float otherSphereRadius, Entity* e1, Entity* e2)
{
    float dist = glm::sqrt((sphere.x - otherSphere.x) * (sphere.x - otherSphere.x) + (sphere.y - otherSphere.y) * (sphere.y - otherSphere.y) + (sphere.z - otherSphere.z) * (sphere.z - otherSphere.z));
    if (dist <= (sphereRadius + otherSphereRadius))
    {
        //Push code
        e1->move(-e1->xVelocity / 2, 0, -e1->zVelocity / 2);
        e2->move(e1->xVelocity / 2, 0, e1->zVelocity / 2);
    }
    return dist <= (sphereRadius + otherSphereRadius);
}

thread safety – Proper Naming For Synchronous Data Structure in API

I am attempting to build a high-level library utilizing common synchronizing structures like mutexes, semaphores, condition variables, etc. I designed and built a simple API that provides two basic behaviors:

  1. Pending on the structure will be ended if a signal is produced after the pending call was initiated.
Process A:
    event = Event()
    wait(1 second)
    event.pend()
    wait(1 second)
    event.pend()

Process B:
    event = Event()
    event.signal() -- Signal is missed and Process A does not release.
    wait(1 second)
    event.signal() -- Signal releases Process A.
    event.signal() -- Signal is missed and Process A does not release.
  1. Pending on the structure will be ended for every signal after which the first pend call was initiated.
Process A:
    event = Event()
    wait(1 second)
    tag = event.pend()
    wait(1 second)
    tag = event.pend(tag)
    tag = event.pend(tag) -- This pend will not be released unless another signal occurs.

Process B:
    event = Event()
    event.signal() -- Signal is missed and Process A does not release.
    wait(1 second)
    event.signal() -- Signal releases Process A.
    event.signal() -- Signal releases Process A when finally pends.

The code provided demonstrates a high-level look at the API. Note for simplicity the event object is the same in both processes. The idea is that an Event can be pended upon and then signaled by another process. If one desires to catch each time (use case 2), then a tag is provided indicating the last signal received. Therein each time it is, provided it is updated to the next one until it has caught up. If nothing is provided, then it behaves basically like a semaphore except any number of processes pending will be released (use case 1).

I am curious if there is proper name for this type of data structure? Or, at the very least, a potential proposal for a better named interface.

Proper way to add multiple popups to link shortener? | Proxies123.com

What is the proper way to add multiple popups from various ad companies to a link shortener script such as adlinkfly? So that when a visitor clicks the continue button they have to click 3-4 times (and get a different popup each time) before being able to continue?

When adding various popunder/popup codes into the ad section, I feel like some of the scripts can conflict with eachother as they all attempt to do the same thing and not all popups are triggering

postgresql – Proper way of restoring base backups

We have daily backups of a postgres db and it is in the form of a tarred (gz) base backup.
I need to restore this into another db of the same version. However, I am confused with the article that I am reading about doing this.
The version of the postgres DB is 8.2.4.
These are the main steps given :

rm -rf /var/lib/postgresql/10/main/*
cp -r /basebackup/* /var/lib/postgresql/10/main/
rm -rf /var/lib/postgresql/10/main/pg_wal/*

So in my case, the postgresql data directory is /usr/local/pgsql824/data. I believe this must be /var/lib/postgresql/main in the command above. I have untarred the tar.gz base backup into /usr/local/temp. So I suppose that this path is /basebackup in the command above. Please correct me if I am wrong.

Now, there comes the part of the “recovery.conf” file. These are the contents of the file as given by the article :

vim /var/lib/postgresql/10/main/recovery.conf
restore_command = 'cp /wal_archive/%f "%p"'
recovery_target_lsn = '3/72658818'

What is the purpose of the “/wal_archive” if I have already untarred contents of the base backup into /usr/local/temp ? This is what I am not sure about.

This is the link to the full article :

https://severalnines.com/database-blog/point-time-postgresql-database-restoration

I just need a clear explanation on how to restore the base backup to the new database data directory.

root access – What would be a proper way to set dnscrypt-proxy on my phone to use DoH(Dns over https) to cloudflare servers

I’m using a Mediatek phone(stock rom) running Android 5.1.1 with root privillege(using Magisk). I downloaded the latest version of dnscrypt proxy for arm devices which came in a zip extension and can be flashed using twrp. My phone’s stock rom does not have a init.d support nor does it have a resolv.conf on /etc/*. If I had to set dnscrypt proxy to use DoH through cloudflare servers, what necessary steps should I take to set it up properly. I am using Afwall+ as my primary firewall.

Is switching sub-class at runtime a proper use case for inheritance?

I’ve got a DataSource base class and a few different sub-classes. I want to be able to switch which sub-class i’m using at runtime so I’m doing the following :

// pointer for our datasource object
DataSource *data;
if (ds.equals("mqtt")) {
  data = new Data_mqtt(config,display);  // Data_mqtt is a sub-class of DataSource

} else if (ds.equals("wf")) {
  data = new Data_wf(config,display);  // sub-class of DataSource

Is this the correct use case ? Is there an implicit object cast going on here ? Everything is working fine but I’ve got a weird feeling about it (code smell?).

Doing it this way, the only methods and members that are available via the data pointer are the ones declared in the DataSource.h with all the DataSource specific stuff hidden from the user so it’s kinda of like an interface in that respect.

The proper use of the word **Presents**

I am solo developer (not professional yet). I want to deploy an app to Play Store. Suppose my name is XYZ. Am I allowed to show a splash screen when the app opens, showing XYZ PRESENTS and in the next splash screen my app name? Will there be any legal issue in that?

I want to know what are the process going on inside airport starting from entry please can you tell me proper suggestion for the same?

First i am travelling in flight from ahmedabad to hubbli airport indide india only even i don’t have passport to travell and even i don’t know what are the process going inside airport check in please can you tell me proper suggestion for the same??

set theory – Are there proper class models of ZF that are contained in their own “self-relativization” that don’t contain $L$?

Let $Gamma$ and $Delta$ be theories in the language of set theory (LST), and let $M = {x: phi(x)}$ be a class, where $phi(x)$ is some formula of LST. Let us say that $M$ is a (standard) class model of $Gamma$ in $Delta$ if and only if $Gamma vdash psi$ implies $Delta vdash psi^M$ for all sentences $psi$ of LST, where $psi^M$ denotes the relativization of $psi$ to the class $M$. I’m curious about what can be said of proper class models $M$ of ZF in ZF such that $mbox{ZF} vdash forall x (x in M rightarrow phi^M(x)$), i.e., $mbox{ZF} vdash forall x (phi(x) rightarrow phi^M(x))$.

A class $M = {x: phi(x)}$ satisfying $forall x (phi(x) rightarrow phi^M(x))$ could be said to be “contained in its self-relativization.” Using Definition I.16.5 from Kunen’s set theory book (2013), the statement $forall x (phi(x) rightarrow phi^M(x))$ (i.e., $(forall x , phi(x))^phi)$) holds if and only if $phi$ is absolute for ${x:phi(x)}$, written ${x: phi(x)} preceq_phi V$.

Examples of such proper class models of ZF satisfying this self-relativization property are $V$ and $L$ (and both satisfy the stronger condition $mbox{ZF} vdash forall x (phi(x) leftrightarrow phi^M(x)$). My questions are as follows. What are some other interesting examples and non-examples? Am I correct in thinking that is HOD a non-example? And, most importantly, is there an example that does not contain $L$? (Such an example could not be transitive, since any proper class transitive model of ZF contains $L$.) If so, is there an example not containing $L$ for which $mbox{ZF} vdash forall x (phi(x) leftrightarrow phi^M(x))$? Particularly, I’m looking for examples whose existence is equiconsistent with ZF.

As an aside, one interesting thing about such class models $M$ of ZF in ZF is that ZF cannot refute $V = M$ if ZF is consistent, for if $mbox{ZF} vdash neg forall x (phi(x))$, then $mbox{ZF} vdash neg forall x (xin M rightarrow phi^M(x))$, and therefore $mbox{ZF} nvdash forall x (x in M rightarrow phi^M(x))$, assuming ZF is consistent. This is what piqued my interest in the question.

Note that the canonical inner models $L(0^sharp)$, $L(mu)$, etc., are class models of ZF in theories whose consistency strength are well beyond that of ZF, so I don’t consider them to be candidates here, even though, as pointed out on the StackExchange, they do satisfy the self-relativization property. (I’m importing this question here from the StackExchange: see https://math.stackexchange.com/questions/3799070/classes-that-are-contained-in-their-self-relativization?noredirect=1#comment7827922_3799070.)

As a disclaimer, I’d like to note that my main areas of research are commutative algebra and number theory, I’m only now just studying formal set theory properly, from Jech’s and Kunen’s texts, and I’m still prone to some misconceptions.

mathematics – Math: determining a proper procedural vector for sine-movement

This can be achieved in multiple ways. The simplest is probably to calculate your vector as movement into the x-direction as you showed us in your question:

$$
v_x = begin{bmatrix}x\sin(x)end{bmatrix}
$$

Now you simply multiply the vector with a rotation matrix:
$$
v = begin{bmatrix}cos(alpha)&-sin(alpha)\sin(alpha)&cos(alpha)end{bmatrix} cdot s cdot v_x
$$

Here, $s$ is the movement speed and $alpha$ the angle between your x-axis and the vector pointing into the actual movement direction you want to move in.

However, it gets a little bit more complicated if you want the object to be able to change its direction. In this case, the position $p$ of your object must be updated every frame. You can do this as follows:

$$
p_{N+1} = p_N + s cdot v_d + sin(w)cdot v_{offset}
$$

$p_N$ is the current position and $p_{N+1}$ the next position. $v_d$ is your current movement direction. It must be of length 1! So always normalize this vector. $v_{offset}$ is a vector orthogonal to your movement direction. You can get it by multiplying it with a $90°$ rotation matrix. In 2d, you just need to exchange the x and y values of $v_d$ and add a $-$ to one of both values. The variable $w$ is an arbitrary value that changes over time or while moving.