Correct way to set up camera buffer [DirectX]

I would like to play with two different implementation of particle system in my project (ok, actually not mine, but I am working on it). I copied the particle system successfully, however, faced the camera buffer initialization problem, highlight this code:

bool ParticleShader::Render(Direct3DManager* direct, ParticleSystem* particlesystem, Camera* camera) {     bool result;      result = SetShaderParameters(direct->GetDeviceContext(), camera, direct->GetWorldMatrix(), camera->GetViewMatrix(), direct->GetProjectionMatrix(), particlesystem->GetTexture());     if (!result)         return false;      RenderShader(direct->GetDeviceContext(), particlesystem->GetVertexCount(), particlesystem->GetInstaceCount(), particlesystem->GetIndexCount());     return true; } 

If I just call SetShaderParameters with the same args, there is a bug obviously: particle system scene sticks to the camera (originally, it looks like this).

I checked the params in debug mode and found out that the difference is in the World matrix. The DXUT CFirstPersonCamera is used in my project and it changed the World matrix while moving around the scene whereas in the original particle system project it’s constant (identity matrix). I even checked my assumption and hardcoded it, but got another bug.

I understand that there is a difference between DXUT camera and the default project camera at the ideological level. Nevertheless, I am a newbie in Graphic it’s too difficult to realize how to change the code in a proper way.

Thank you in advance

Which is the correct length for a sailing ship, 100 ft. or 80 ft.?

Ghosts of Saltmarsh provides both stat blocks and deck plans for the several kinds of ships listed in the Dungeon Master’s Guide. The stat blocks include, among other things, ship sizes expressed as "X ft. by Y ft." Deck plans, meanwhile, are presented as maps on a standard grid of 5-foot squares.

However, the deck plans don’t all match up with the ship sizes stated in the stat blocks. The sailing ship, in particular, is listed in its stat block as having a size of "100 ft. by 20 ft." But its deck plan clearly shows only 16 squares, or 80 ft., from bow to stern.

It is tempting to try to resolve this discrepancy by supposing that a ship, like a creature, might control a space larger than its actual physical size. (See PHB p. 191.) The typical medium humanoid, after all, isn’t 5 ft. wide; it’s smaller than the space it controls. However, that supposition is undermined by the galley, which is listed as "130 ft. by 20 ft." and yet measures 27 squares, or 135 ft., from bow to stern. It is difficult to imagine how a ship could be larger than the space it controls — and so the whole notion that ship size is about controlled space rather than actual size appears to break down.

What, then, is the actual length of a sailing ship? Is it 100 ft. as its stat block states, or 80 ft. as shown in its deck plan, or something else?

The descriptions of the Swashbuckler rogue’s Rakish Audacity feature in XGTE and SCAG disagree. Which is correct?

In the Sword Coast Adventurer’s Guide (p. 136), the second paragraph of the Swashbuckler rogue’s Rakish Audacity feature description reads:

In addition, you don’t need advantage on your attack roll to use your Sneak Attack if no creature other than your target is within 5 feet of you. All the other rules for the Sneak Attack class feature still apply to you.

However, in Xanathar’s Guide to Everything (p. 47), which reprints the Swashbuckler rogue subclass, the description of the Rakish Audacity feature reads:

You also gain an additional way to use your Sneak Attack; you don’t need advantage on the attack roll to use your Sneak Attack against a creature if you are within 5 feet of it, no other creatures are within 5 feet of you, and you don’t have disadvantage on the attack roll. All the other rules for Sneak Attack still apply to you.

I can’t find any acknowledgement of the text change either; I’d imagine that one or the other would have been subject to errata that makes them have the same wording.

Which wording is correct? I’m assuming SCAG since it was printed later, but would like a source.

Additionally, does the SCAG wording mean that the ability can be used with range attacks? I assume that RAI it should not, but I’m having a hard time interpreting "if no creature other than your target is within 5 feet" as meaning that the target must be within 5 feet.

How can i find wrong word in search box and replace with correct word

I have a search form and Many site users search for the wrong words, I want to replace these wrong words with the right ones so that users can get results faster.

I have been searching for this for several days but unfortunately I did not find any results.

I’m looking for a way if a user types wrong words like this

i love axqple i love vaple i love aple i love applle i love aplle 

Replace the wrong text with Apple.

I have already checked things like the this tutorial and this topic but have not reached a conclusion

I also looked at these cases:

function str replace

find word in variable and replace with another

search string for specific word and replace it

And many more…

Given this explanation, does anyone have a solution, educational content or any tips

Thanks for any help

wp_remove_object_terms correct way to call child of parent taxonomy in woocommerce

In Woocommerce I am currently able to assigned and unassign a product taxonomy from a product by calling the following.

// to assign wp_add_object_terms ( $  product_id,'in-stock', 'product_cat' );  //to unassign wp_remove_object_terms ( $  product_id,'in-stock', 'product_cat' );  

However how would one achieve this with a child of the parent taxonomy.

Do I need to call the parent and then the childs tag_ID ? Maybe something like below. Can someone clarify how I should correctly format ‘pa_stock&tag_ID=27’ please.

wp_remove_object_terms ( $  product_id,'in-stock', 'pa_stock&tag_ID=27' );  

Just to clarify pa_stock represents the parent taxonomy, tag_ID 27 represents the child taxonomy.

Pathfinding algorithm isn’t finding correct route

I am attempting an online coding challenge wherein I am to implement a pathfinding algorithm that finds the shortest path between two points on a 2D grid. The code that is submitted is tested against a number of test cases that I, unfortunately, am unable to see, but it will however tell me if my answer for shortest distance is correct or not. My implementation of the A* algorithm returns a correct answer on 2/3 test cases and I cannot seem to figure out what scenario might create an incorrect answer on the third?

I have tried several of my own test cases and have gotten correct answers for all of those and at this point am feeling a little bit lost. There must be something small in my code that I am not seeing that is causing this third case to fail.

More details

  • The grid is w by h and contains only 1’s (passable) and 0’s (impassable) with every edge having a cost of 1 and the pathway cannot move diagonally It all starts with the FindPath function which is to return the length of the shortest path, or -1 if no path is available
  • pOutBuffer is used to contain the path taken from beginning to end (excluding the starting point). If multiple paths are available then any will be accepted. So it isnt looking for one path in particular
  • I know the issue is not the result of time or memory inefficiency. I has to be either the distance returned is incorrect, or the values in pOutBuffer are incorrect.

Any help would be greatly appreciated as I am just about out of ideas as to what could possibly be wrong here. Thank you.

#include <set> #include <vector> #include <tuple> #include <queue> #include <unordered_map>  inline int PositionToIndex(const int x, const int y, const int w, const int h) {     return x >= 0 && y >= 0 && x < w  && y < h? x + y * w : -1; }  inline std::pair<int, int> IndexToPosition(const int i, const int w) {     return std::make_pair<int, int>(i % w, i / w); }  inline int Heuristic(const int xa, const int ya, const int xb, const int yb) {     return std::abs(xa - xb) + std::abs(ya - yb); }  class Map { public:     const unsigned char* mapData;     int width, height;      const std::vector<std::pair<int, int>> directions = { {1,0}, {0,1}, {-1,0}, {0,-1} };      Map(const unsigned char* pMap, const int nMapWidth, const int nMapHeight)     {         mapData = pMap;         width = nMapWidth;         height = nMapHeight;     }      inline bool IsWithinBounds(const int x, const int y)      {         return x >= 0 && y >= 0 && x < width && y < height;     }      inline bool IsPassable(const int i)     {         return mapData[i] == char(1);     }       std::vector<int> GetNeighbours(const int i)     {         std::vector<int> ret;          int x, y, neighbourIndex;         std::tie(x, y) = IndexToPosition(i, width);          for (auto pair : directions)         {             neighbourIndex = PositionToIndex(x + pair.first, y + pair.second, width, height);             if (neighbourIndex >= 0 && IsWithinBounds(x + pair.first, y + pair.second) && IsPassable(neighbourIndex))                 ret.push_back(neighbourIndex);         }          return ret;     } };  int FindPath(const int nStartX, const int nStartY,     const int nTargetX, const int nTargetY,     const unsigned char* pMap, const int nMapWidth, const int nMapHeight,     int* pOutBuffer, const int nOutBufferSize) {     int ret = -1;      // create the map     Map map(pMap, nMapWidth, nMapHeight);      // get start and end indecies     int targetIndex = PositionToIndex(nTargetX, nTargetY, nMapWidth, nMapHeight);     int startIndex = PositionToIndex(nStartX, nStartY, nMapWidth, nMapHeight);          // if start and end are same exit     if (targetIndex == startIndex) return 0;          std::unordered_map<int, int> pathway = { {startIndex, startIndex} };     std::unordered_map<int, int> distances = { {startIndex, 0} };      // queue for indecies to process     typedef std::pair<int, int> WeightedLocation;     std::priority_queue<WeightedLocation, std::vector<WeightedLocation>, std::greater<WeightedLocation>> queue;      queue.emplace(0, startIndex);          while (!queue.empty())     {         int currentWeight, currentIndex;         std::tie(currentWeight, currentIndex) = queue.top();         queue.pop();          if (currentIndex == targetIndex)             break;          int newDistance = distances[currentIndex] + 1;         for (int n : map.GetNeighbours(currentIndex))         {             if (distances.find(n) == distances.end() || newDistance < distances[n])             {                 distances[n] = newDistance;                  int weight = newDistance + Heuristic(n % nMapWidth, n / nMapWidth, nTargetX, nTargetY);                 queue.emplace(weight, n);                 pathway[n] = currentIndex;             }         }     }      if (pathway.find(targetIndex) != pathway.end())     {         int current = targetIndex;          while (current != startIndex)         {             int outIndex = distances[current] - 1;             pOutBuffer[distances[current] - 1] = current;             current = pathway[current];         }         ret = distances[targetIndex];     }          return ret; } 

Is the megaraptor’s fortitude saving throw correct?

I’m trying to understand if this is an error or is there something I’m missing?

According to the System reference document a megaraptor Fort save is +10. https://www.d20srd.org/srd/monsters/dinosaur.htm#megaraptor

As an 8 hit dice animal its base save is +6 because Fort is a Good save for it and it gains a +5 bonus on its Fort save due to its Con of 21, therefore its total Fort save bonus should be +11.

Edit: I also checked the D&D 3.5 Monster Manual errata and I notice the megaraptor is amended however nothing I can find resolves this particular issue.

What is the correct interpretation of the Gambling Results table in Xanathar’s Guide to Everything?

In Xanathar’s Guide to Everything, one of the downtime options provided in “Downtime, Revised” allows a character to gamble during their downtime to earn extra money.

Gambling

Games of chance are a way to make a fortune—and perhaps a better way to lose one.

[…]

Gambling Results
\begin{array}{|l|l|} \hline \text{Result} & \text{Value} \ \hline \text{0 Successes} & \text{Lose all the money you bet, and accrue a debt equal to that amount.} \ \hline \text{1 Success} & \text{Lose half the money you bet.} \ \hline \text{2 Successes} & \text{Gain the amount you bet plus half again more.} \ \hline \text{3 Successes} & \text{Gain double the amount you bet.} \ \hline \end{array}

—Xanathar’s Guide to Everything, pg. 130

So if I place a bet of 100gp and make my checks against this table, how much would I have, for each category?

How can I correct this code to get an answer?

I need to calculate matrix m1 according to following algorithm. Then, I have to put it in the differential equation. However, matrix m1 is complex and therefore the differential equation does not work.
How can I correct this code to get an answer?

 m = {{0, WP[t], WP[t], WP[t], 0}, {WP[t], -FSR, 0, 0, -WS[t]}, {WP[t],  0, 0, 0, WS[t]}, {WP[t], 0, 0, FSR, -WS[t]}, {0, -WS[t],   WS[t], -WS[t], 0}};   q = Eigenvectors[m]; qq1 = Normalize[q[[1]]]; qq2 = Normalize[q[[2]]]; qq3 = Normalize[q[[3]]]; qq4 = Normalize[q[[4]]]; qq5 = Normalize[q[[5]]];   Ali1 = {{D[qq1, t][[1]], 0, 0, 0, 0}, {D[qq1, t][[2]], 0, 0, 0,    0}, {D[qq1, t][[3]], 0, 0, 0, 0}, {D[qq1, t][[4]], 0, 0, 0,    0}, {D[qq1, t][[5]], 0, 0, 0, 0}};  Vali1 = ConjugateTranspose[Ali1];  Kazi1 = Ali1.Vali1;   Ali2 = {{D[qq2, t][[1]], 0, 0, 0, 0}, {D[qq2, t][[2]], 0, 0, 0,    0}, {D[qq2, t][[3]], 0, 0, 0, 0}, {D[qq2, t][[4]], 0, 0, 0,    0}, {D[qq2, t][[5]], 0, 0, 0, 0}}; Vali2 = ConjugateTranspose[Ali2]; Kazi2 = Ali2.Vali2;  Ali3 = {{D[qq3, t][[1]], 0, 0, 0, 0}, {D[qq3, t][[2]], 0, 0, 0,  0}, {D[qq3, t][[3]], 0, 0, 0, 0}, {D[qq3, t][[4]], 0, 0, 0,  0}, {D[qq3, t][[5]], 0, 0, 0, 0}}; Vali3 = ConjugateTranspose[Ali3]; Kazi3 = Ali3.Vali3;  Ali4 = {{D[qq4, t][[1]], 0, 0, 0, 0}, {D[qq4, t][[2]], 0, 0, 0,  0}, {D[qq4, t][[3]], 0, 0, 0, 0}, {D[qq4, t][[4]], 0, 0, 0,  0}, {D[qq4, t][[5]], 0, 0, 0, 0}}; Vali4 = ConjugateTranspose[Ali4]; Kazi4 = Ali4.Vali4;   Ali5 = {{D[qq5, t][[1]], 0, 0, 0, 0}, {D[qq5, t][[2]], 0, 0, 0,   0}, {D[qq5, t][[3]], 0, 0, 0, 0}, {D[qq5, t][[4]], 0, 0, 0,    0}, {D[qq5, t][[5]], 0, 0, 0, 0}};  Vali5 = ConjugateTranspose[Ali5];  Kazi5 = Ali5.Vali5;   m1 = Kazi1 + Kazi2 + Kazi3 + Kazi4 + Kazi5;   sol1 = NDSolve[{D[c[t], t] == (m1).c[t],  c[0] == {1, 0, 0, 0, 0}}, c, {t, 0, 2 tf}];   ans = Evaluate[c[t] /. sol1[[1]]][[5]];  ans1 = Abs[ans]^2;  Plot[ans1, {t, 0, 2 tf}, Frame -> True]  

Hi friends, I need to calculate matrix m1 according to following algorithm. Then, I have to put it in the differential equation. However, matrix m1 is complex and therefore the differential equation does not work.
How can I correct this code to get an answer?