## What is an efficient way to get a look-at direction from either a quaternion or a transformation matrix?

So, I have an object in my custom engine (C++), with a column-major transform in world space. I’m using a package that takes a look-at direction as an input. What’s the most efficient way to get a look-at direction from this transform? Do I extract the rotation matrix? Do I try to extract a quaternion?

## How can you modify a SUBSET-SUM instance so evaluating a set outputs either 0 or 1?

An SUBSET-SUM instance is a list of $$n$$ integers $$\{ a_1, a_2,… a_n\}$$ and a target $$W$$. To evaluate a set is to find the sum of a selection of numbers in the set. However, I want to know, is it possible to modify the instance, or SUBSET-SUM in general, where evaluating a set outputs $$0$$ if the sum equals $$W$$, and $$1$$ otherwise?

Bonus: Give a list of other NP-complete problems (other than 3SAT, where you evaluate a formula that either outputs $$0$$ or $$1$$ depending on the set of binary variables being passed into it), where evaluating an analogous instance outputs $$0$$ if it satisfies some objective related to the problem and $$1$$ otherwise.

## How to remove sublists whose difference of two elements is either 1 or 11?

I want to create a list of 3-element subsets of $$\{1,2,\cdots,12\}$$ where no two elements in each subset can have difference of 1 or 11.

The following attempt fails because it returns just a list of all subsets without restriction.

Select[Subsets[Range[12], {3}]  , (Abs[#[[1]] - #[[2]]] != 1 || Abs[#[[1]] - #[[2]]] != 11) &&    (Abs[#[[1]] - #[[3]]] != 1 || Abs[#[[1]] - #[[3]]] != 11) &&    (Abs[#[[3]] - #[[2]]] != 1 || Abs[#[[3]] - #[[2]]] != 11) &] 

# Edit

I just got the solution as follows, but can it be simplified?

Select[Subsets[Range[12], {3}]   , ! MemberQ[{1, 11}, Abs[#[[1]] - #[[2]]]] &&     ! MemberQ[{1, 11}, Abs[#[[1]] - #[[3]]]] &&     ! MemberQ[{1, 11}, Abs[#[[3]] - #[[2]]]] &] // Length 

## Understanding the proof of “DFS of undirected graph $G$, yields either tree edge or back edge” better with graph for each statement in proof

I was going through the edge classification section by $$\text{DFS}$$ algorithm on an undirected graph from the text Introduction to Algorithms by Cormen et. al. where I came across the following proof. I was having a little difficulty in understanding the steps of the proof and hence I made an attempt to understand it fully by accompanying each statement in the proof with a possible graph of the situation.

Theorem 22.10 : In a depth-first search of an un-directed graph $$G$$, every edge of $$G$$ is either a tree edge or a back edge.

Proof:

1. Let $$(u , v)$$ be an arbitrary edge of $$G$$, and suppose without loss of generality that $$d[u] < d[v]$$. Then, $$v$$ must be discovered and finished before we finish $$u$$ (while $$u$$ is gray), since $$v$$ is on $$u$$‘s adjacency list.

2. If the edge $$(u, v)$$ is explored first in the direction from $$u$$ to $$v$$ , then $$v$$ is undiscovered (white) until that time.

Figure 1 : Situation in point 2. DFS starts from ‘u’, ‘u’ is grayed and DFS then looks along the red arrow to ‘v’

1. Otherwise we would have explored this edge already in the direction from $$v$$ to $$u$$. Thus, $$(u, v)$$ becomes a tree edge.

Figure 2 : Situation in point 3. DFS starts from ‘u’, ‘u’ is grayed, then discoveres ‘w’ and ‘w’ is grayed and then again discovers ‘v’ DFS then looks along the red arrow to ‘u’ , the green pointer explains the rest

1. If $$(u, v)$$ is explored first in the direction from $$v$$ to $$u$$, then $$(u, v)$$ is a back edge, since $$u$$ is still gray at the time the edge is first explored.

Figure 3 : Situation in point 4. DFS starts from ‘u’, ‘u’ is grayed, then discoveres ‘w’ and ‘w’ is grayed and then again discovers ‘v’ DFS then looks along the red arrow to ‘u’ , ‘u’ is already grayed so the edge becomes a back edge, indicated by the green pointer

Could anyone confirm if I am on the right track or if not please rectify me.

[My question might seem similar to this or this but neither of them seemed to help me]

## What are the implementation strategies for multiple dispatch: class-based, or method-based organization, or either?

Regarding classes and methods, Practical Foundation of Programming Languages by Harper says:

Dynamic dispatch is often described in terms of a particular implementation strategy, which we will call the class-based organization. In this organization, each object is repre- sented by a vector of methods specialized to the class of that object. We may equivalently use a method-based organization in which each method branches on the class of an ob- ject to determine its behavior. Regardless of the organization used, the fundamental idea is that (a) objects are classiﬁed and (b) methods dispatch on the class of an object. The class-based and method-based organizations are interchangeable and, in fact, related by a natural duality between sum and product types. We explain this symmetry by focusing ﬁrst on the behavior of each method on each object, which is given by a dispatch matrix. From this, we derive both a class-based and a method-based organization in such a way that their equivalence is obvious.

More generally, we may dispatch on the class of multiple arguments simultaneously. We concentrate on single dispatch for the sake of simplicity.

Does “we may dispatch on the class of multiple arguments simultaneously” mean “we may dispatch on the method of multiple arguments simultaneously”

For multiple dispatch, what is its implementation strategy? Class-based organization, or method-based organization, or either? (My guess is that class-based organization doesn’t work for multiple dispatch, but only for single dispatch.)

Thanks.

## What are the pros and cons of multiclassing a Dragonborn Paladin with either Sorcerer or Warlock? and when and if to swap over [closed]

My Dragonborn Paladin is nearing the end of level 2, (Str3, Dex0, Con2, Int-1, Wis-1, Cha3, with Defensive giving AC19).

The main group I play with, he is the only Tank, unless my 10 year old daughter, joins in with her Circle of the moon Druid

She is the only child in the group and you can’t rely on her to focus on battle tactics 🙂

—————-new below ——————

My initial goal was to create a super paladin, I tend to play him as a tank with healing, saving my limited spell casting for just the right time due to limited spell slots, so I hardly ever use it. I once even died holding onto the valuable spell slots because I forgot about them.

However, once I started looking into it, I haven’t found that perfect sweet spot, that balances out the Spell Slinging Tank Front Man. All the options I’ve looked at have drawbacks that make me wonder if it is a combo that is worth pursuing

Just hoping for that splash of inspiration to make it all come together.

## the option to delete plugins is not there, I can’t download plugins either

I’m still learning how to build a website and I want to start over, I have done several times, but now I don’t have the option to delete the plugins, an when I try to install a new theme it say

## Should each and every link SER makes be sent to either GSA SEO Indexer or Indexing Service via API?

I am, as usual, trying to refine my efforts. Recently, I’ve been making some headway in this regard.
My big question I’ve been wanting to ask: Does every link SER makes require indexing?
I presently use GSA SEO Indexer, but not on EVERY project. Am I wasting efforts in not using either this program or an external indexer? Could I be getting more out of my linking with SER if I did index EVERY link?
Thanks, kindly, for any info…!

## Is it bad UX for a form to be presented in different formats (either in a modal or separate page), depending on context?

I’m designing an internal tool in which a user, at certain points, will need to fill out a fairly detailed form in order to add a piece of content to our user-facing platform.

However, the challenge I’m facing is that the form is available at different points in the user’s journey, and I’m wondering if I can format the presentation of the form differently (either as a modal or a separate page) depending on where the user is and what they’re doing, to cater to separate use cases. Namely, I’d like to present it within a modal when the user is on a page where they’ll be engaged with a different, priority task, but needs to quickly fill out the form to create a piece of content, and then resume with the main task.

But elsewhere in the tool, I’d like to present the form on a separate page when the user is on the page where all those content pieces live – so that when the user clicks a “+New Content” CTA, they’ll be taken to a separate page where they’ll fill out the form.

Ultimately, I’m trying to cater to these separate use cases with these different interactions, but is the resulting inconsistency bad? Trying to understand the tradeoff here.

I hope this all makes sense, thanks for taking a look!