There is functionality to access GPS data in Unity 3D. So, is there any way to use that functionality to calculate distance traveled by player/user in real-world?

# Tag: calculate

## How do i calculate a hold monster spell vs saving throw

I am new at being a DM so I just want to make sure I am doing it correctly.

## How do I calculate a line segment that is a certain number of degrees from another line segment?

I have a line segment that is at an arbitrary angle in 3D space. I want to (in code) draw another line that shares an end point with the first line and has an angle of X degrees between them. The second line will partially overlap the first in the XZ plane.

## How to calculate Sum of a function over a list

`tlist = Table[i, {i, 1, 10}]`

tlist:{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}

`f = E^(-((2 t)/T));`

`Sum[f, {t, {tlist[[i]], {i, 1, 8}}}]`

How to calculate Sum of a function over a list?

One way to do this is by defining `f[t_]:= E^(-((2 t)/T));`

Is there a way to do it in any other manner. Because I have to do this for various functions with a higher level of complexity.

## calculate the flux of a vector field through a surface

How to calculate the flux of a vector field through a surface in mathematica? I’ve this field:

`F = (x, x^2 * y, y^2 * z) `

and this surface:

`S = { (x,y,z) ∈ R^3 | 2 * Sqrt[x^2+y^2] <= z <= 1 + x^2 + y^2} `

So, I’m trying:

`region = ImplicitRegion[2 * Sqrt[x^2+y^2] <= z <= 1 + x^2 + y^2, {x, y, z}]; Integrate[#, {x,y,z} ∈ region]& /@ ({x, x^2 * y, y^2 * z} . {x, y, z}) `

I expect Pi/30 as a result, but it comes out "Infinity"…

## For TCG-Opal drives, which password is used to calculate KEK?

SEDs use a password to generate KEK by a KDF algorithm. The KEK is then used to encrypt the MEK (where MEK is internally generated in the drive). But TCG-Opal drives have 9 locking-ranges and each of these ranges use its own MEK (say MEK1 – MEK9). There are also 4 Admins and 8 Users, each has its own password (PIN). Which of these passwords are used to generate the KEK, or are there multiple KEKs ? The TCG core spec and the Opal SSC spec don’t detail the relation of a password to the MEK of any locking-range.

## How to calculate the size of the page table of a process?

Consider a system with A bytes of physical RAM, and B bytes of virtual address space per process. Pages and frames are C bytes in size. Every page table entry is P bytes in size. Calculate the size of the page table of a process?

## How can I calculate the distribution of 3d6, keep and rerolling any 1s and 2s, once?

The way my DM wants to try is roll 3d6 and reroll any 1’s or 2’s once. If you roll a 2 and the reroll ends up being a 1 you have to take the 1.

## How to calculate this kind of double definite integral directly

Let $ D=\left\{(x, y) \mid x^{2}+y^{2} \leq \sqrt{2}, x \geq 0, y \geq 0\right\}$ , $ \left[1+x^{2}+y^{2}\right]$ represents the largest integer not greater than $ 1+x^{2}+y^{2}$ , now I want to calculate this double integral $ \iint_{D} x y\left[1+x^{2}+y^{2}\right] d x d y$ .

`reg = ImplicitRegion[x^2 + y^2 <= Sqrt[2] && x >= 0 && y >= 0, {x, y}]; Integrate[x*y*Round[1 + x^2 + y^2], {x, y} ∈ reg] `

But the result I calculated using the above method is not correct, the answer is $ \frac{3}{8}$ , what should I do to directly calculate this double integral (without using the technique of turning double integral into iterated integral)?

## Calculate the area of the shape created by multiple paths

I’m trying to write an algorithm to calculate the area created by multiple paths that can be overlapping or not. Here is an example:

**Basics**

- 4 separate paths (A,B,C,D) which are a collection of vertices (A1,A2,…)
- Area desired is represented by green

**Edge Cases**

- As shown with B, a path might have segments that don’t contribute to a filled shape
- As shown with C, a path might be completely enclosed by other paths and therefore should basically be ignored.
- As shown with D, paths may create independent shapes
- As shown with A and B, it should be a union of all the shapes

My first question is if an algorithm for this already exists. If it does, it would save me a lot of effort :). I tried searching around but I don’t even know how to describe this problem concisely.

Assuming one doesn’t exist for this exact purpose I have to move on to figuring it out myself. I’m assuming the right data structure for the job is a graph. I’m thinking I will add points for each intersection (highlighted in red) as I insert paths into the graph.

Then "all I need" is an algorithm for tracing around the outside of each shape because calculating the area of those irregular polygons will be simple. Does something like that already exist? My primary hangups when I think about how to do this are:

- What vertex do I "start" at?
- How do I account for multiple shapes (D as well as A,B,C)?
- How do I account for the parts of shapes like formed by A1,A5,A5 where I’ll be visiting that intersection point multiple times?

I’m not necessarily looking for a complete solution, I’d love thoughts on if you think I’m approaching this the best way so far and if you have any ideas/suggestions on how to achieve this.

Thanks in advance!