Exact collision time of two axis-aligned bounding boxes

I am trying to calculate the exact collision time of two axis-aligned bounding boxes (aabb) as fast as possible (in the sense of CPU time).

  • I have all the required information (aabb min, max, center, etc., velocity vector, and so on)
  • My aabbs are not rotating, so they have linear velocity
  • The aabbs can be both moving, only one of them might be moving, or they both might be steady

My current approach creates lines from one of the boxes’ corners and checks the collision among the planes of the other box (you can see the algorithm below); however it takes 6 times longer than I can afford. So, I am trying to find a faster algorithm; however, I couldn’t have managed, yet.

My current “slow” algorithm:

  1. Add velocity of Aaabb to Baabb and assume Aaabb is steady and Baabb is moving
  2. Calculate the corner positions of Baabb
  3. For each corner of Baabb, perform the line-plane intersection with Aaabb’s each 6 planes (I use the line-intersection formulate (algebraic form) on Wikipedia) to check if there is an intersection.
  4. If a corner of Baabb intersects with a plane of Aaabb, verify the intersection point is behind the other 5 planes of Aaabb
  5. Keep the smallest value of d and return

search – WordPress, fetching users with an exact match in a string of comma separated values in user_meta

I have data saved in user_meta -> areapref field. It is basically a string of comma delimited post IDs (e.g. 2, 37, 200, 300 etc.)

I need to check if the user has a particular ID in this field. If so… do stuff.

I can check if an ID is in areapref using LIKE. But I believe this has an issue. If one location is ID=10, and another is ID=100 – both will match with 1, or 10? Or am I misunderstanding LIKE. I fear CONTAIN would have the same issue.

I need to know how to get a list of users who have an ‘exact match’ within the areapref string? So search for ID 2, will return only 2, NOT 22, or 20, 200 etc.
I’ve spent hours going through stackexchange/overflow/wp codex and cannot find an answer… though I am dense!

Here’s enough code I hope to show what I’m currently doing… any ideas greatly appreciated.

function ds_notify_new_event( $post_ID ){
$url = get_permalink( $post_ID );
$event = get_the_title( $post_ID );
$localeID = get_post_field( 'location_id', $post_ID);
global $wpdb;
$locale = $wpdb->get_var( $wpdb->prepare(
" SELECT post_id FROM {$wpdb->prefix}em_locations WHERE ID = %d ",
$localeID ) );

$args = array(
        'role'    => 'subscriber',
        'meta_query' => array(
                array( 'key' => 'areapref', 'value' => $locale, 'compare' => 'LIKE' ),
                // just checks usr is ok with email
                array( 'key' => 'notify', 'value' => 'yes', 'compare' => '=' ) 
            ),
        'fields' => array( 'display_name', 'user_email' )
    );
// retrieve users to notify about the new post
$users = get_users( $args );

// do stuff with users

I know I am baka but please help me this is non exact equation and I am unable to to find which rule to apply to solve it

Thanks for contributing an answer to MathOverflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.

To learn more, see our tips on writing great answers.

dg.differential geometry – Hodge decomposition seems to say harmonic and exact is zero (and possibly (harmonic and co-exact) and (exact and co-exact))

(asked on maths se. no answers.)

Part of Hodge Decomposition Theorem says that for a compact oriented Riemannian (smooth) $m$−manifold $(M,g)$ (I think M need not be connected, but you may assume connected if need be or you want) and for a smooth $k$-form $omega$, i.e. $omega in Omega^k(M)$

A. $omega$ decomposes into exact, co-exact and harmonic: $omega =$ (respectively) $omega_d oplus omega_delta oplus omega_Delta $$in Omega^k(M) = B^kM bigoplus mathscr H^k(M,g) bigoplus image(delta_{k+1})$

B. $omega$ is zero if $omega$ is at least 2 of the ff: harmonic, exact, co-exact. Specifically:

  • B.1. ‘harmonic and exact is zero’

  • B.2. ‘harmonic and co-exact is zero’

  • B.3. ‘exact and co-exact is zero’

C. I think (B.1) is equivalent to the injectivity of the map $phi: mathscr H^k(M,g) := ker(Delta_k) to$$ H^k_{dR}M := frac{Z^kM}{B^kM}$, which maps a harmonic form to its de rham cohomology class, $phi(omega)=(omega):=omega + B^kM$ (or ‘$omegabmod B^kM$‘).

Proof: $phi$ is the restriction of $Phi:Z^kM to H^k_{dR}M$ (from closed $k$-forms) to harmonic $k$-forms. Then $ker(phi) = ker(Phi) cap Domain(phi) = B^kM cap mathscr H^k(M,g) = $$image(d_{k-1}) cap ker(Delta_k)$. QED

  • C.1. Note on notation: I personally would like to have $phi$ and $Phi$ to have subscripts $k$ since their domains and ranges depend on $k$, but I’m omitting the subscript $k$ because I’m following notation in the following powerpoint.

  1. What exactly is going on in slide 46? This is part of proving that $phi$ is injective.
  • 1.1. What I think: Here, Ryan Vaughn seems to conclude, for the decomposition of harmonic $omega = omega_d oplus omega_delta oplus omega_Delta$, that $omega_{Delta}$ is zero because $omega_{Delta}$ is exact and because of (B.1). However, I really don’t think decomposition is necessary because the other components of $omega$ will obviously be zero.

  • 1.2. I assume that the decomposition itself (I mean without the ‘orthonormal’ part) doesn’t rely on (B.1) (or (B.2)-(B.3)), otherwise I think this would be circular. I’m guessing that (B.1) (or (B.2)-(B.3)) is used in the ‘ortho(normal)’ part of the decomposition theorem. Thus, it makes sense to talk about $omega = omega_d oplus omega_delta oplus omega_Delta$ even if we don’t know (B.1) (or (B.2)-(B.3)).

  1. How does Ryan Vaughn prove (B.1), if Ryan Vaughn did? Otherwise, how does one prove (B.1) (of course without assuming the full Hodge Decomposition Theorem; soooo of course proving (B.1) is part of proving Hodge Decomposition Theorem)?

What I tried so far:

2.1 – I think the following is somehow relevant, if true:

a smooth $k$-form is harmonic if and only if closed and co-closed, i.e. $ker (Delta_k) = $$ ker(d_k) cap ker(delta_k) = Z^kM cap ker(delta_k)$

2.2 – If true: It seems ‘harmonic and exact’ is equivalent to ‘co-closed and exact’. Please explain how to show ‘co-closed and exact is zero’.

probability or statistics – Computation of 1- and 2-sided p-values for Fisher’s Exact test for 2×2 table based on Monte Carlo

I am looking for code to compute the 1- and 2-sided p-value for Fisher’s Exact test for 2×2 tables based on Monte Carlo (bootstrap simulations).

For larger 2×2 crosstabulation tables, the exact p-value can often not be computed due to the large amount of computations.

Asymptotically p-values are often quite inaccurate.

Therefore, I would like to compute the p-values based on Monte Carlo.

ag.algebraic geometry – When splitting of short exact sequence preserves the kernels

This is a problem that I thought at first it is obvious but it became less clear the more I thought about it. Assume we have a finitely generated algebra $A$ over a field $k$. A short exact sequence of projective $A$-modules $l_1:0rightarrow P_1 rightarrow P_2 rightarrow P_3 rightarrow 0$. Let’s assume we can lift this short exact sequence to their generators, i.e. let $F_i$ be the free module that surjects onto $P_i$ and assume there is a short exact sequence $l_2: 0rightarrow F_1 rightarrow F_2 rightarrow F_3 rightarrow 0$ that surjects onto $l_1$. Furthermore assume that all morphisms in $l_2$ are given by matrices in $M_{ntimes m}(k)$ for suitable values of $m$ and $n$. This implies that we can choose splitting morphisms for $l_2$ that are also in $M_{ntimes m}(k)$. My question: is there a such a choice of a splitting for $l_2$ that induces a splitting on $l_1$? This is equivalent to asking whether such a splitting will map the kernels of $F_irightarrow P_i$ to each other. (If answer depends on $A$ for what $A$‘s this can be true?)

phpmyadmin – Entering Exact Values into a Table Using SQL

I am needing to insert particular values into a table I am working on with SQL (see function below):

INSERT INTO Table Name (…) VALUES(…);

The values that are going to be stored inside this table are values that involve another programming language that have a lot of weird symbols involving a single backslash, *, dollar signs, etc.

How can I insert values precisely as they are inside this table?

For instance, when I type ‘2’ it needs to return 2 inside the table instead of just 2. I am unable to manually enter the two backslashes to get 2. This is because I am receiving an input from another user via HTML and sending it to my table with PHP. The issue I am having is that there are these special characters with SQL which are being entered in not the way I intend them to as values.

Is there a way to type these values in exactly with a certain string function that is called beforehand? Other ways of doing this would be greatly appreciated!

sql server – Performance impact of Extended Events sessions looking at the exact same event type

I have created an extended events session that watches the module_start event type and filters down based on the object_name: equal_i_sql_unicode_string)((object_name))

The purpose of this session is to simply record basic information whenever a proc in the filter list is called so that I can answer developers questions with 99.9% guarantee whether or not a proc is still called in production. The idea is to run this for ~1 month 24/7 (yes it doesn’t account for things that are ran annually, but it is what it is).

The issue I am running into is that the list of procs the developer gave me is about 90 or so long and the filter list of an EE session is limited to 3,000 characters. The only idea I have come up with in order to increase the rate at which we can track the procs is to have 2 separate EE sessions that are identical except the filter predicates are different.

I am not asking “how much of a CPU impact will this be”, but more or less is their any concern with running 2 of the same EE sessions with different filter predicates? It is odd to me that Microsoft would limit the filter list to 3,000 characters when ‘more filtering == better performance’ because the way EE is built into the engine it is very optimized unlike a trace that acts more like a proxy than a “trigger based off an event”.

Is it safe to assume that whatever the performance impact of running 1 session is I can multiply it by 2 or is their further concerns I am not considering?