My question is similar to this one about convective derivative. But how do I adapt it to the cylindrical coordinate? Simply change Grad to cylindrical coordinate does not produce correct results, which can be found here, because we need to include the terms with the derivative of the unit vector too.

# Tag: coordinate

## unit – Conversion between coordinate systems

I have a block system that I created for my tile-based game, but I'm having trouble translating the tile coordinate of the cursor into a coordinate in pieces. Here is my code so far:

```
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Tilemaps;
public class MapGeneration : MonoBehaviour
{
public DimensionScriptable dim;
public Tilemap ctm;
public Tilemap nctm;
public Grid grid;
public Transform target;
public int renderDistance = 1;
private Vector2Int offset;
private Dictionary
``` map;
private void Start()
{
nctm.SetTile(Vector3Int.zero, dim.tiles(3));
int seed = 1232421;
map = new Dictionary();
System.Random rng = new System.Random(seed);
offset = new Vector2Int(rng.Next(-100000, 100000), rng.Next(-100000, 100000));
}
private void Update()
{
Vector2Int centerPoint = (Vector2Int)grid.LocalToCell(target.localPosition);
centerPoint.x /= dim.chunkSize.x;
centerPoint.y /= dim.chunkSize.y;
for (int y = -renderDistance; y <= renderDistance; y++)
{
for (int x = -renderDistance; x <= renderDistance; x++)
{
Vector2Int pos = new Vector2Int(centerPoint.x + x, centerPoint.y + y);
Chunk chunk;
if (!map.TryGetValue(pos, out chunk))
{
Chunk newChunk = new Chunk(pos, dim.chunkSize, dim.tiles, ctm, nctm);
newChunk.GenerateTiles(dim.scale, dim.persistance, dim.lacunarity, dim.octaves, offset);
newChunk.RenderTiles();
map.Add(pos, newChunk);
}
else
{
chunk.RenderTiles();
}
}
}
if (Input.GetMouseButton(0))
{
Vector2Int mouseTile = (Vector2Int)grid.WorldToCell(Camera.main.ScreenToWorldPoint(Input.mousePosition));
Vector2Int mouseChunk = new Vector2Int((mouseTile.x + dim.chunkSize.y / 2) / (dim.chunkSize.x), (mouseTile.y + dim.chunkSize.y / 2) / (dim.chunkSize.y));
Chunk chunk;
//Debug.Log("Mouse: " + mouseTile);
Debug.Log("Chunk: " + mouseChunk);
if (!map.TryGetValue(mouseChunk, out chunk))
{
Debug.Log(mouseTile);
Debug.LogError("TILE NOT FOUND");
}
else
{
Vector2Int conversionVec = new Vector2Int(mouseChunk.x / 2 + dim.chunkSize.x / 2, mouseChunk.y / 2 + dim.chunkSize.y / 2);
Vector2Int convertedCoords = mouseTile + conversionVec;
//Debug.Log(new Vector2(convertedCoords.x % dim.chunkSize.x, convertedCoords.y % dim.chunkSize.y));
//Vector2Int tileInChunk = new Vector2Int((mouseTile.x + dim.chunkSize.x / 2) % (dim.chunkSize.x), (mouseTile.y + dim.chunkSize.y / 2) % (dim.chunkSize.y));
//Debug.Log("Tile: " + tileInChunk);
//Debug.Log(new Vector2Int(Mathf.Abs((mousePos.x % dim.chunkSize.x) + dim.chunkSize.x / 2), Mathf.Abs((mousePos.y % dim.chunkSize.y) + dim.chunkSize.x / 2)));
chunk.Modify(new Vector2Int(convertedCoords.x % dim.chunkSize.x, convertedCoords.y % dim.chunkSize.y), Tiles.WATER);
ctm.SetTile(new Vector3Int(mouseChunk.x * dim.chunkSize.x - dim.chunkSize.x / 2, 0, mouseChunk.y * dim.chunkSize.y - dim.chunkSize.y / 2), dim.tiles(3));
}
}
}
public void GenerateMap()
{
map = new Dictionary();
}
}

And this is my Chunk class (the static class method Noise.GenerateNoiseMap always returns a constant value and as such is not relevant to this problem)

```
using UnityEngine;
using UnityEngine.Tilemaps;
public class Chunk
{
private Vector2Int position;
public static int width;
public static int height;
private int(,) modifiedMap;
private int(,) map;
private Tilemap ctm;
private Tilemap nctm;
private Tile() tiles;
public Chunk(Vector2Int position, Vector2Int size, Tile() tiles, Tilemap colidableTileMap, Tilemap nonCollidableTilemap)
{
this.position = position;
width = size.x;
height = size.y;
map = new int(width, height);
modifiedMap = new int(width, height);
ctm = colidableTileMap;
nctm = nonCollidableTilemap;
this.tiles = tiles;
}
public void GenerateTiles(float scale, float persistance, float lacunarity, int octaves, Vector2Int mapOffset)
{
Vector2 offset = new Vector2(position.x * width + mapOffset.x, position.y * height + mapOffset.y);
float(,) heightMap = Noise.GenerateHeightMap(offset, scale, persistance, lacunarity, octaves);
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
float height = heightMap(x, y);
Tiles tileId = Tiles.STONE;
if (height < 0.25)
{
tileId = Tiles.WATER;
}
else if (height < 0.75)
{
tileId = Tiles.GRASS;
}
map(x, y) = (int)tileId;
}
}
map(0, 0) = (int) Tiles.GRASS;
}
public void RenderTiles()
{
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
if (modifiedMap(x, y) == 0)
{
if (map(x, y) == (int)Tiles.GRASS)
{
nctm.SetTile(new Vector3Int(position.x * width + x - width / 2, position.y * height + y - height / 2, 0), tiles(map(x, y)));
}
else
{
ctm.SetTile(new Vector3Int(position.x * width + x - width / 2, position.y * height + y - height / 2, 0), tiles(map(x, y)));
}
}
else
{
if (modifiedMap(x, y) == (int)Tiles.GRASS)
{
nctm.SetTile(new Vector3Int(position.x * width + x - width / 2, position.y * height + y - height / 2, 0), tiles(modifiedMap(x, y)));
}
else
{
ctm.SetTile(new Vector3Int(position.x * width + x - width / 2, position.y * height + y - height / 2, 0), tiles(modifiedMap(x, y)));
}
}
}
}
}
public void Modify(Vector2Int position, Tiles tile)
{
modifiedMap(position.x, position.y) = (int)tile;
RenderTiles();
}
}
```

## python – Tic Tac Toe using the Cartesian coordinate system

I am trying to learn the Cartesian coordinate system, starting with a basic grid of tic tac toe for simplicity, then perhaps moving on to chess. I could create the following code to get started:

```
board = ()
def new_board():
for row in range(4):
board.append(())
for column in range(4):
board(row).append('_')
def print_board():
print(board)
print(' %s | %s | %s' % (board(1)(1), board(1)(2), board(1)(3)))
print('----+---+----')
print(' %s | %s | %s' % (board(2)(1), board(2)(2), board(2)(3)))
print('----+---+----')
print(' %s | %s | %s' % (board(3)(1), board(3)(2), board(3)(3)))
new_board()
print(board)
print_board()
```

When the "table" list is printed, it gives the following information:

```
(('_', '_', '_', '_'), ('_', '_', '_', '_'), ('_', '_', '_', '_'), ('_', '_', '_', '_'))
(('_', '_', '_', '_'), ('_', '_', '_', '_'), ('_', '_', '_', '_'), ('_', '_', '_', '_'))
```

Which is good, but my problem is that for my orders to match the table (for example, table (1) (2) targeting the first row and the second column of the table), I need to have a "dummy entry" for (0), for the sublists and the entries in the sublists.

Is there a way to do this without the fictitious entries and that my card list references always match the actual card spaces?

## terminology – What is the name of a plot that displays data at each X, Y coordinate

I am creating a new plot infrastructure and I cannot understand what this type of plot should be called.

This is a fairly basic plot where you have an XY Cartesian grid and each cell in the grid represents data for this X, Y coordinate. Sometimes these cells contain continuous values which will be represented with a color gradient scale . In this case, I would call it a heat map. However, sometimes it will contain boolean data, so i will only have one color for true and one for false. It doesn't really seem like a heat map to me. It is possible that someday I will add other types of discrete values (like enumerations) where I will just have a different color for each value.

Is there a term that covers both heat maps and other heat map graphics where you have discrete values?

## How Mathematica Calculates the Gradient in the Spherical Coordinate System

**The case of the rectangular coordinate system**

I already know that the equilibrium differential equations in different elasticity coordinate systems can be calculated by the formula $ div ( sigma) + F = 0 $.

```
pdConv(f_) :=
TraditionalForm(
f /. Derivative(inds__)(g_)(vars__) :>
Apply(Defer(D(g(vars), ##)) &,
Transpose({{vars}, {inds}}) /. {{var_, 0} :>
Sequence(), {var_, 1} :> {var}}))
Thread(Div({{σ11(x, y, z), σ12(x, y, z), σ13(x,
y, z)}, {σ12(x, y, z), σ22(x, y, z), σ23(
x, y, z)}, {σ13(x, y, z), σ23(x, y,
z), σ33(x, y, z)}}, {x, y, z}) + {F1(x, y, z),
F2(x, y, z), F3(x, y, z)} == 0) // pdConv
```

The physical equations in the rectangular coordinate system are as follows:

```
{{Subscript(ε, x), Subscript(ε, xy),
Subscript(ε, xz)}, {Subscript(ε, xy),
Subscript(ε, y), Subscript(ε,
yz)}, {Subscript(ε, xz), Subscript(ε,
yz), Subscript(ε, z)}} ==
Symmetrize(
Grad({u(x, y, z), v(x, y, z), w(x, y, z)}, {x, y, z})) // Normal
```

The strain compatibility equation expressed by the stress is as follows. Due to the symmetry, there are only six independent equations.

```
Curl(#, {x, y, z}) & /@
Transpose(
Curl(#, {x, y, z}) & /@ {{e11(x, y, z), e12(x, y, z), e13(x, y, z)}, {e12(x, y, z), e22(x, y, z), e23(x, y, z)}, {e13(x, y, z), e23(x, y, z), e33(x, y, z)}}) // pdConv
```

**The case of the spherical coordinate system**

The physical equations in spherical coordinates are as follows:

```
{{εrr, εrθ, εrφ}, {εrθ, εθθ, εθφ}, {εrφ, εθφ, εφφ}} ==
Symmetrize(
Grad({ur(r, θ, ϕ), uθ(r, θ, ϕ),
uφ(r, θ, ϕ)}, {r, θ, ϕ},
"Spherical")) // Normal // pdConv
```

The differential balance equations in spherical coordinates are as follows:

```
Thread(Div({{σrr(r, θ, φ), σrθ(r, θ, φ), σrφ(r, θ, φ)}, {σrθ(r, θ, φ), σθθ(r, θ, φ), σθφ(
r, θ, φ)}, {σrφ( r, θ, φ), σθφ(r, θ, φ), σφφ(r, θ, φ)}}, {r, θ, φ}) + {Fr(r, θ, φ), Fθ(r, θ, φ), Fφ(r, θ, φ)} == 0) // pdConv
```

**Problems to be solved**

I want to know the specific algorithm of the physical equation under the specific spherical coordinate system (i.e., how to calculate `Grad({ur(r, θ, ϕ), uθ(r, θ, ϕ), uφ(r, θ, ϕ)}, {r, θ, ϕ}, "Spherical"))`

More precisely).

In addition, I also want to know how to solve the strain compatibility equation in the spherical coordinate system with Mathematica.

## magic – Is it possible to coordinate the castings this way?

Following this question, is it possible to coordinate (synchronize) the casting of spells so that if Alice the Mage launches a spell which needs more FP than she has (from her own FP , the greater the energy reserve if at stake, the greater the Powerstone / Manastone / Power Item), Bob the Younger (his apprentice and his assistant) can lend energy at the right time to prevent Alice from preventing having to use HP (with a skill penalty of -1 per HP used) to cast the spell (the penalty potentially increasing the inherent risk of casting related to critical failures)?

Of course, that's what Share Energy is for (although the cost of two points per point used by the recipient is an issue, as is the limit of 5 shared FPs) – but if you're playing under *Dungeon Fantasy / DFRPG* this spell is not available.

So, can Bob help Alice this way?

## distance from the subject – Calculation of the new coordinate of a point in the field of view of the camera after having turned the camera around the z-axis

I am trying to do a computer vision task which involves moving the camera along a scene in max 3D, the camera must move at each stage at a certain distance from its current location **(Xc, Yc, Zc)** to a new location **Xcnew = Xc + 1500** mm.

On this basis, I can calculate the dimensions (width and height) of the plane that appears on the image of the cam according to the following equation:

(Sensor dimension (mm)) / (Focal distance (mm)) = (Field dimension (mm)) / (Distance to field (mm))

therefore, if the sensor has **36** through **24** mm physical dimensions (width * height), focal distance **40** mm and the distance is **1500** mm we can see that the width and the height of the captured image of the scene is **1350** mm and **900** mm. For example, looking at the attached image **(image 1)** point size **A** (the right edge of the captured aircraft) will **(CAMx-1500, CAMy + 675, CAMz + 450)**; Point **E** is at **(CAMx-1500, CAMy, CAMz)** where all units are in mm and the cam is at **(CAMx, CAMy, CAMz)**.

my question is: if i wanted to rotate the camera around the z axis let's say **20** degrees **(as shown in picture 2)**, how can i calculate the points **A**, **B**, **VS**, **re**, and **E** coordination? I tried to apply a rotation matrix around **Z axis** **r = (cos (theta) sin (theta) 0; ((-1) * sin (theta)) cos (theta) 0; 0 0 1)**

on the coordinates of the points of origin but the results were not correct because I can check with the simulation in 3d max.

another problem is: although the cam is set to **(112 570 -613080 900)** and A of origin to **(111070 -612405 1350)** after rotation, I receive the **A to (-105083 -613460 1350)**, I guess its related to the fact that the plane is "behind the cam" where the cam is looking at the negative x direction of the world?

Global coordination is clear in **picture 2**,

should i apply a translation here? if so, should it apply to camera coordination or origin point coordination?

I am sure I am missing something here and I would appreciate it if someone could help.

Finally, please, if my question is off topic, tell me where to post it.

## macos – Position all slide titles at the same exact coordinate – Keynote

So I have about 70 slides in my main presentation.

I looked everywhere trying to position myself **all** my titles from all `70`

pages to start at the exact position of the x, y coordinates.

I couldn't find an option to do it. 😭

Result:

Right now, if I press arrows, I see that my titles are not aligned, some are too far to the left, and some are slightly shifted not in the same position because I have been the eyeball and positions each of them as best as I can on the left edge.

Is there a way to do it?

## graphics – Applescript finds the coincident X coordinate on a path for any given Y coordinate

I have two lines as shown in the screenshot below (Adobe Illustrator file). Is there a way in Illustrator using AppleScript to find the value of X for coincident points on vertical vertical lines for a given value of Y? For example if I wanted to add horizontal lines between the two vertical paths at the points shown on the screenshot …

## algebraic geometry – the injective map of the coordinate rings gives a dominant map on the affine varieties

This is one of the exercises I am fighting over: Suppose $ V $ and $ W $ are affine varieties,

Show that one card at a time $ k $-algebras $ k (W) rightarrow k (V) $ corresponds to a dominant card $ V rightarrow W $

Here's what I know so far: any polynomial mapping $ V rightarrow W $ gives the homomorphism of k-algebra $ k (W) rightarrow k (V) $, and any homomorphism of k-algebra $ k (W) rightarrow k (V) $ comes from the removal of a single polynomial mapping $ V rightarrow W $, but this problem is not only about homomorphism, but more general mapping.

In order to show that there is a dominant map, I think first of all is to establish at least one map, and I did one as follows: identify the two $ k (V) $ and $ k (W) $ through $ k (x_1, cdots, x_n) / I (V) $ and $ k (y_1, cdots, y_m) / I (W) $ respectively and let $ Phi $ to be the injective card. The simplest card to build would be $$ phi = ( Phi ((y_1)), cdots, Phi ((y_m))) $$

But the problem with this card is that we can make the domain be $ V $ but the codomain is not necessary $ W $ since $ Phi $ only gives a function of $ V $ at $ k $

Exercise is also accompanied by a seemingly useless clue:

$ phi: V rightarrow W $ given $ V rightarrow overline { phi (V)} subseteq W $

Here is a similar article that I found, but it only relates to removal, and I don't see a way to generalize to all injective mappings