# Tag: degrees

## macbook pro – Is 80-90 degrees celsius hot for MBP 2019 CPU temperature

I just converted to apple and bought the latest 16inch MBP with a 6 cores core i7 processor and 16GB of RAM.

I am noticing that it gets hot easily, on idle the temperature is around ~45 degrees celsius and when I have chrome and terminal installing something it can go up to 95 degrees and then goes back to about 50.

I only had the laptop for about a week now, is this normal or should I return it?

Also, I am checking the temperature using istat

## rendering – How to render a field of view of over 180 degrees?

In most 3D renderings, a view frustum is used.

This has the problem, that things get stretched out towards the edges.

At “normal” fov (field of view) of about 60 degrees, the effect is not very noticeable, unless compared side by side (example) but at a higher fov of something like 120 degrees it’s really noticeable by making things near the edge look way larger/closer (example).

A fov of anything near or over 180 degrees breaks the rendering completely.

So far, I couldn’t find anything on how to render in such a way that fixes this or even how it’s called.

The ultimate goal would be to be able to render up to 360 degrees (ignoring the hardware needed, to display it) without any distortion, relative to other parts of the image.

So, how would I approach rendering that? Is there already some open source software, I can take a look at?

## rendering – How to render a field of view of over 180 degrees?

In most 3D renderings, a view frustum is used.

This has the problem, that things get stretched out towards the edges.

At “normal” fov (field of view) of about 60 degrees, the effect is not very noticeable, unless compared side by side (example) but at a higher fov of something like 120 degrees it’s really noticeable by making things near the edge look way larger/closer (example).

A fov of anything near or over 180 degrees breaks the rendering completely.

So far, I couldn’t find anything on how to render in such a way that fixes this or even how it’s called.

The ultimate goal would be to be able to render up to 360 degrees (ignoring the hardware needed, to display it) without any distortion, relative to other parts of the image.

So, how would I approach rendering that? Is there already some open source software, I can take a look at?

## c# – Rotating a matrix by 90 degrees

I’m going through books and various questions to improve my algorithm knowledge. I solved each NxN matrix first by hand and applied that process to build the code from that. I have done my best to break each task into its own step and keep them encapsulated. Below is the class followed by its accompanying unit tests. Having finished most of a unit testing book I also followed Test Driven Design (TDD) to write the tests before implementing the logic so I would know I’d achieved the correct answer.

Is there anything I can improve on my logic or naming to make readability clearer?

```
public class Question7
{
public void RotateImage(ref uint(,) img, RotationDirection direction)
{
int elementsPerRow = ElementsPerRow(img);
int inflectionPoint = (elementsPerRow - 1) / 2;
for (int rowIndex = 0; rowIndex <= inflectionPoint; rowIndex++)
{
int lastColumnIndexToEdit = elementsPerRow - 1 - rowIndex;
for (int columnIndex = rowIndex; columnIndex < lastColumnIndexToEdit; columnIndex++)
{
if (direction == RotationDirection.Clockwise)
{
RotateClockwise(ref img, new Indices(rowIndex, columnIndex), elementsPerRow);
}
else
{
RotateCounterClockwise(ref img, new Indices(rowIndex, columnIndex), elementsPerRow);
}
}
}
}
private int ElementsPerRow(uint(,) img)
{
for (int i = 1; i * i <= img.Length; i++)
{
if (i * i == img.Length)
{
return i;
}
}
return -1;
}
private void RotateClockwise(ref uint(,) img, Indices topLeft, int elementsPerRow)
{
int lastIndex = elementsPerRow - 1;
Indices topRight = new Indices(topLeft.Column, lastIndex - topLeft.Row);
Indices botRight = new Indices(lastIndex - topLeft.Row, lastIndex - topLeft.Column);
Indices botLeft = new Indices(lastIndex - topLeft.Column, topLeft.Row);
uint toInsert = img(topLeft.Row, topLeft.Column);
//Insert into TopRight
uint justStored = img(topRight.Row, topRight.Column);
img(topRight.Row, topRight.Column) = toInsert;
toInsert = justStored;
//Insert into BotRight
justStored = img(botRight.Row, botRight.Column);
img(botRight.Row, botRight.Column) = toInsert;
toInsert = justStored;
//Insert into BotLeft
justStored = img(botLeft.Row, botLeft.Column);
img(botLeft.Row, botLeft.Column) = toInsert;
toInsert = justStored;
//Insert into TopLeft
img(topLeft.Row, topLeft.Column) = toInsert;
}
private void RotateCounterClockwise(ref uint(,) img, Indices topLeft, int elementsPerRow)
{
int lastIndex = elementsPerRow - 1;
Indices topRight = new Indices(topLeft.Column, lastIndex - topLeft.Row);
Indices botRight = new Indices(lastIndex - topLeft.Row, lastIndex - topLeft.Column);
Indices botLeft = new Indices(lastIndex - topLeft.Column, topLeft.Row);
uint toInsert = img(topLeft.Row, topLeft.Column);
//Insert into TopRight
uint justStored = img(botLeft.Row, botLeft.Column);
img(botLeft.Row, botLeft.Column) = toInsert;
toInsert = justStored;
//Insert into BotRight
justStored = img(botRight.Row, botRight.Column);
img(botRight.Row, botRight.Column) = toInsert;
toInsert = justStored;
//Insert into BotLeft
justStored = img(topRight.Row, topRight.Column);
img(topRight.Row, topRight.Column) = toInsert;
toInsert = justStored;
//Insert into TopLeft
img(topLeft.Row, topLeft.Column) = toInsert;
}
}
struct Indices
{
public int Row { get; }
public int Column { get; }
public Indices(int rowIndex, int columnIndex)
{
Row = rowIndex;
Column = columnIndex;
}
}
public enum RotationDirection
{
Clockwise = 0,
CounterClockwise = 1
}
```

I’m including the 4 most helpful tests to ensure I was producing correct results.

```
(Fact)
public void A_2x2_matrix_rotated_clockwise()
{
uint(,) expected = new uint(2, 2){ { 30, 10 }, { 40, 20 } };
uint(,) img = new uint(2, 2) { { 10, 20 }, { 30, 40 } };
var sut = new Question7();
sut.RotateImage(ref img, RotationDirection.Clockwise);
Assert.Equal(expected, img);
}
(Fact)
public void A_2x2_matrix_rotated_counterclockwise()
{
uint(,) expected = new uint(2, 2) { { 20, 40 }, { 10, 30 } };
uint(,) img = new uint(2, 2) { { 10, 20 }, { 30, 40 } };
var sut = new Question7();
sut.RotateImage(ref img, RotationDirection.CounterClockwise);
Assert.Equal(expected, img);
}
(Fact)
public void A_5x5_matrix_rotated_clockwise()
{
uint(,) expected = new uint(5, 5) { { 210, 160, 110, 60, 10 },
{ 220, 170, 120, 70, 20 },
{ 230, 180, 130, 80, 30 },
{ 240, 190, 140, 90, 40 },
{ 250, 200, 150, 100, 50 } };
uint(,) img = new uint(5, 5) { { 10, 20, 30, 40, 50},
{ 60, 70, 80, 90, 100 },
{ 110, 120, 130, 140, 150 },
{ 160, 170, 180, 190, 200 },
{ 210, 220, 230 , 240, 250 } };
var sut = new Question7();
sut.RotateImage(ref img, RotationDirection.Clockwise);
Assert.Equal(expected, img);
}
(Fact)
public void A_5x5_matrix_rotated_counterclockwise()
{
uint(,) expected = new uint(5, 5) { { 50, 100, 150, 200, 250 },
{ 40, 90, 140, 190, 240 },
{ 30, 80, 130, 180, 230 },
{ 20, 70, 120, 170, 220 },
{ 10, 60, 110, 160, 210 } };
uint(,) img = new uint(5, 5) { { 10, 20, 30, 40, 50},
{ 60, 70, 80, 90, 100 },
{ 110, 120, 130, 140, 150 },
{ 160, 170, 180, 190, 200 },
{ 210, 220, 230 , 240, 250 } };
var sut = new Question7();
sut.RotateImage(ref img, RotationDirection.CounterClockwise);
Assert.Equal(expected, img);
}
```

Once confident in the rotation, I continued and implemented a method to generate an NxN matrix.

```
public uint(,) GenererateNxNMatrix(int N, uint startValue, uint stepValue)
{
var img = new uint(N, N);
int row = 0;
int column = 0;
int counter = 0;
int totalElements = N * N;
for (uint i = startValue; counter < totalElements; i+= stepValue)
{
img(row, column) = i;
counter++;
if (counter % N == 0)
{
column = 0;
row++;
}
else
{
column++;
}
}
return img;
}
```

Along its accompanying unit test.

```
(Fact)
public void Generate_3x3_matrix()
{
var expected = new uint(,) { { 1, 3, 5 }, { 7, 9, 11 }, { 13, 15, 17 } };
var sut = new Question7();
var actual = sut.GenererateNxNMatrix(3, 1, 2);
Assert.Equal(expected, actual);
}
```

Lastly I created method to generate a matrix that is already rotated.

```
public uint(,) GenerateRotatedNxNMatrix(int N, RotationDirection rotationDirection, uint startValue, uint stepValue)
{
if (rotationDirection == RotationDirection.Clockwise)
{
return GenerateClockwiseRotatedNxNMatrix(N, startValue, stepValue);
}
else
{
return GenerateCounterClockwiseRotatedNxNMatrix(N, startValue, stepValue);
}
}
public uint(,) GenerateClockwiseRotatedNxNMatrix(int N, uint startValue, uint stepValue)
{
int row = 0;
int column = N - 1;
uint(,) img = new uint(N, N);
for (uint i = startValue; i <= N * N; i += stepValue)
{
img(row, column) = i;
if (i % N == 0)
{
row = 0;
column--;
}
else
{
row++;
}
}
return img;
}
public uint(,) GenerateCounterClockwiseRotatedNxNMatrix(int N, uint startValue, uint stepValue)
{
int row = N - 1;
int column = 0;
uint(,) img = new uint(N, N);
for (uint i = startValue; i <= N * N; i += stepValue)
{
img(row, column) = i;
if (i % N == 0)
{
row = N - 1;
column++;
}
else
{
row--;
}
}
return img;
}
```

With its accompanying unit tests.

```
(Fact)
public void Generate_3x3_matrix_rotated_clockwise()
{
var expected = new uint(,) { { 7, 4, 1 }, { 8, 5, 2 }, { 9, 6, 3 } };
var sut = new Question7();
var actual = sut.GenerateRotatedNxNMatrix(3, RotationDirection.Clockwise, 1, 1);
Assert.Equal(expected, actual);
}
(Fact)
public void Generate_3x3_matrix_rotated_counterclockwise()
{
var expected = new uint(,) { { 3, 6, 9 }, { 2, 5, 8 }, { 1, 4, 7 } };
var sut = new Question7();
var actual = sut.GenerateRotatedNxNMatrix(3, RotationDirection.CounterClockwise, 1, 1);
Assert.Equal(expected, actual);
}
(Theory)
(InlineData(3, RotationDirection.Clockwise, 1, 1))
(InlineData(7, RotationDirection.Clockwise, 1, 1))
(InlineData(99, RotationDirection.Clockwise, 1, 1))
public void Rotated_matrix_matches_matrix_that_was_generated_already_rotated(int N, RotationDirection rotationDirection, uint startValue, uint stepValue)
{
var expected = new Question7().GenerateRotatedNxNMatrix(N, rotationDirection, startValue, stepValue);
var img = new Question7().GenererateNxNMatrix(N, startValue, stepValue);
var sut = new Question7();
sut.RotateImage(ref img, rotationDirection);
Assert.Equal(expected, img);
}
```
```

## c# – Is it possible to work out rotate in degrees per second based on this rotate logic?

I have this code to rotate an object towards another at a given speed.

```
/// <summary>
/// Rotate towards the target.
/// </summary>
/// <param name="lookPosition"></param>
private void RotateTowardsTarget(Vector3 lookPosition)
{
// Determine which direction to rotate towards
Vector3 targetDirection = lookPosition - transform.position;
// The step size is equal to speed times frame time.
float singleStep = weaponRotationSpeed * Time.deltaTime;
// Rotate the forward vector towards the target direction by one step
Vector3 newDirection =
Vector3.RotateTowards(turretYRotation.transform.forward, targetDirection, singleStep, 0.0f);
// Draw a ray pointing at our target in
//Debug.DrawRay(turretYRotation.transform.position, newDirection, Color.red, 3);
newDirection.y = 0;
// Calculate a rotation a step closer to the target and applies rotation to this object
turretYRotation.transform.rotation = Quaternion.LookRotation(newDirection);
}
```

And I’d like to convert this to a “Degrees per second” to give the user useful feedback on how quickly it rotates. Is there a formulae I can apply to work it out?

## beginner – Rotating Matrix in Python with a For loop (90 degrees)

So the image of a matrix can be transformed, for the rows and columns to this rule:

The Values in the first row of the original matrix become the values of the last column of the image matrix. The Values in the second row of the original matrix become the values of the second last column of the image matrix …. and so on …until the values in the last row of the original matrix become the values of the first column of the image matrix.

As a diagram, the left hand matrix is the original and the right hand matrix is its image.

```
(('a', 'b', 'c'), (('g', 'd', 'a'),
('d', 'e', 'f'), ('h', 'e', 'b'),
('g', 'h', 'i') ) ('i', 'f', 'c') )
```

Assume the following already exist in Python:

matrix: a 3 x 3 list of lists representing a matrix of numbers (similar to the examples above)

image: a list the same size as matrix, containing only empty sub-lists (for storing the matrix image)

indexes: a list containing the integers 0, 1 and 2 (i.e., valid index positions of both matrix, and image)

Complete the following code to return the image of matrix according to the above rule.

```
for row in indexes:
for ____ in ____:
image(row).append(matrix(____) (____))
```

The options are:

row

col

0

1

2

len(indexes)

indexes

2 – col

2 – row

col – 2

row – 2

len(matrix)

Any of the options can be used above in any of the blank spots. My gut after my times of learning python tells me that I should try to answer the question as such:

```
for row in indexes:
for col in indexes:
image(row).append(matrix(col)(row))
```

What i think will happen is that it’ll take all the values, and switch em out for row -> column and column -> row. Am i somewhat correct or completely off?

## lens design – Why are flatbed-scanned images warped when compared to itself scanned & rotated 90 degrees?

This has been absolutely baffling me. I scanned an image both vertically and horizontally on the flatbed of my HP Color LaserJet Pro MFP M277dw using Windows Fax and Scan. I then used Gimp to rotate one of the images 90 degrees, to overlay it above the other image.

But then, the image appears to have been stretched by the flatbed!

Not giving up, I tried on another scanner, the Epson Stylus C88+, and got the same results! Is there an inherent flaw with most flatbed scanners? Why does it seem to skew out the image when compared to its horizontal counterpart?

In the 3rd image below, if I lined up the “**A**“, the “**D**” gets misaligned. The graphing paper also shows the effects of a horizontal scan.

Why does this happen? Are there any scanners that don’t do this? Is it dependent on the angle that light is reaching the photo-sensors?

Finally, can this multi-angle scanner invention have anything at all to do with this effect?

## Write complex number in standard form. 5 cis 210 degrees

Write complex number in standard form.

5 cis 210 degrees.

Need help on this i tried and got the wrong answer resulting in -5 root 3/2+ 5i/2

## ag.algebraic geometry – Degrees of syzygies of points in $mathbb P^2$

Let $X$ be a collection of points in $mathbb P^2$ over the complex numbers. Let $I_X$ be the defining ideal. I am interested in knowing when:

The syzygies of $I_X$ contains no linear forms. Since we are in $mathbb P^2$, this just says that the Hilbert-Burch matrix contains no (non-zero) linear entries. $(*)$

One obvious case when this happens is when we take two general curves $F,G$ of degrees $a,bgeq 2$ and let $X=V(F)cap V(G)$. Then the syzygies is just the Kozsul relation and has degrees $a,b$. I don’t know further examples and would like to know if there are interesting geometric conditions that would imply $(*)$.

One obvious necessary condition is that the generators of $I_X$ have degree at least $2n-2$, where $n$ is the number of generators.

Also, perhaps if you fix the degree $d$ of $X$, then $(*)$ defines a closed subscheme (? I am not sure about this) of the Hilbert scheme $mathbb P^{2(d)}$. If so, then knowing it’s dimension would be nice.