Design Pattern – How should I integrate the history tracing routine into the routine?

Suppose I write code to operate a machine that resembles a 3D printer, and I have a routine like:

machine.moveTo (x1, y1);
machine.alignByCamera ();
machine.heatUp ();
machine.extrude (Quantity1);
machine.moveTo (x2, y2);
machine.extrude (Quantity2);

I would like to add a new optional feature to track the process flow. Suppose I want to maintain the temperature, take pictures of the camera, and coordinate the values ​​after alignment. My new code looks like this:

machine.moveTo (x1, y1);
historyTracker.takeInitialPhoto ();

historyTracker.recordLocationBeforeAligment (machine.x, machine.y);
machine.alignByCamera ();
historyTracker.recordLocationAfterAlignment (machine.x, machine.y);

historyTracker.recordTemperatureBeforeHeatup (machine.temperature);
machine.heatUp ();
historyTracker.recordTemperatureAfterHeatup (machine.temperature);

machine.extrude (Quantity1);
machine.moveTo (x2, y2);
machine.extrude (Quantity2);
historyTracker.takeFinalPhoto ();

As you can see, code gets a lot uglier. I have not even made it optional. Let's make it optional:

machine.moveTo (x1, y1);
if (historyEnabled)
historyTracker.takeInitialPhoto ();

if (historyEnabled)
historyTracker.recordLocationBeforeAligment (machine.x, machine.y);
machine.alignByCamera ();
if (historyEnabled)
historyTracker.recordLocationAfterAlignment (machine.x, machine.y);

if (historyEnabled)
historyTracker.recordTemperatureBeforeHeatup (machine.temperature);
machine.heatUp ();
if (historyEnabled)
historyTracker.recordTemperatureAfterHeatup (machine.temperature);

machine.extrude (Quantity1);
machine.moveTo (x2, y2);
machine.extrude (Quantity2);
if (historyEnabled)
historyTracker.takeFinalPhoto ();

So my question is, how can I decouple the history record function from the routine itself, if possible. How else can I improve my code? Is there a better way (design pattern maybe) to address this problem.

nvidia – How do ray tracing triangles work with RTX internally?

Raytracing a huge bunch of triangles in a naive way (ie testing each ray against each triangle) would be enormously slow. This is why raytracers use optimizations to significantly reduce the number of required Ray Triangle tests. The most common optimization is to organize the triangles in a tree-like data structure, such as a kd tree.

How does Nvidia's RTX technology do it internally? In my understanding (please correct me if I'm wrong) it actually uses a tree data structure for the raytracing of the triangles. My question is which part of the rendering pipeline will perform this structure of the tree data structure. Is it done on the application page?

But more importantly, and this is the heart of my question: how are network deformations handled? (In other words, triangles that change the shape and / or their relative position within the same mesh object.)

I understand that a tree data structure works wonders when a triangle mesh is raytracing … as long as the mesh is completely rigid and does not deform. As the mesh deforms (triangles change their shape and / or position relative to each other), the entire tree must be recreated (since the changed triangles may well end up in completely different locations in the tree).

RTX demos and above all BF5 show animated human figures (for example, their clothing is deformed by wind), which are shown in Raytrace reflections. How is this achieved? Are the tree data structures recalculated for each frame, or is this done differently?

Direct3d12 – Directx Ray Tracing Dxr Support Application Issue

I have a question. I have old source code that was created in Visual Studio 2003. It does not allow me to compile DirectX12 code in Visual Studio 2003. So my focus was on using my old game I created and updating it to support DXR ray tracing, but my question is, it's better to encode my Dxr support into a "DLL" and just plain use a runtime link to call any function "executable" when executing the game process, or simply code it into the application itself Execute it. Because I really do not want to rewrite all of my code in Visual Studio 2017, to be honest, there are several lines of code "over 10,000". Yes, any advice is greatly appreciated.

3d – Can you create a 2D surface approaching a particular mesh, and then do a special ray tracing function for it?

For example, let's say we're trying to make a bullet shine. There are two possibilities. The first is to construct a mesh of triangles that approximates the sphere and perform ray tracing. The more triangles we have, the more expensive this calculation becomes, because we have to call it that rayTriangleIntersect () once for each triangle. However, for the special case of a sphere, there is a better way: we can use one raySphereIntersect () Function, created by solving the equation of the ray with the equation of a sphere, x ^ 2 + y ^ 2 + z ^ 2 = R ^ 2, This only requires one call and is thus much cheaper.

My question is: Can the same optimization be applied to different shapes? That is, there is a technique to create a surface that approaches a particular mesh so that we can implement a specialized one rayIntersection () Function for this surface?

Plotting – Tracing the existing curve with star symbol

b1 = {1.8743,1.8784,1.88248,1.89049,1.89828,1.90587,1.91327,1.96335,2.03035,2.12536,2.23701,2.30098,2.34255,2.37175,2.3934,2.42334,2.44307,2.48725,2.51208,2.5173,2.52799,2.53164,2.53348,2.53533 2,53625,2,53745,2,53793,2,53894,2,53909,2,53543};
ks1 = {0.01, 1, 2, 4, 6, 8, 10, 25, 50, 100, 200, 300, 400, 500, 600, 800, 1000, 2000, 4000, 5000, 10000, 15000, 20000, 30,000, 40,000, 70,000, 100,000, 1 * 10 ^ 6,1. * 10 ^ 8,1. * 10 ^ 12};
data1 = Transpose[{ks1, b1}];
s1 = ListLogLinearPlot[data1, Joined -> True, 
  PlotStyle -> {Black, Thickness[0.01]}, AxesStyle -> Black,
PlotRange -> All]

How do you put a star symbol on the same drawing that follows the curve? I know we can do this with the plot marker, but I want the track to be tracked equally from start to finish. With my data points, I do not get the tracking right. How do you achieve this?

Is SQL Server Profiler Different From SQL Tracing?

Some of your previous answers have not been well received and you run the risk of being blocked from answering.

Please note the following notes exactly:

  • Please be sure answer the question, Enter details and share your research!

But avoid

  • Ask for help, clarification or answering other answers.
  • Make statements based on opinions; secure them with references or personal experiences.

For more information, see our tips for writing great answers.