Questions tagged [diagonal]

Diagonal means either a diagonal matrix (usually a square matrix) in which the entries outside the main diagonal are all zero. The diagonal entries themselves may or may not be zero. Or, the values of the diagonal matrix.

Since a lot of things in programming is based on matrices doing thing horizontal or vertical is often easier then doing it diagonal. Questions dealing with these difficulties should be tagged diagonal.

Diagonal matrices occur in many areas of linear algebra. Because of the simple description of the matrix operation and eigenvalues/eigenvectors, it is always desirable to represent a given matrix or linear map by a diagonal matrix.

You probably want to add more specific tags about the technology you are using. Areas where the tag ´diagonal´ becomes relevant often drawing and animation.

584 questions
0
votes
1 answer

D3 diagonal using coordinates instead of objects

I am looking for a way to create a line like the one you get using d3.svg.diagonal but instead of using source and target objects, use coordinates. I tried fiddling with the projection function but no success. Here is a fiddle I found with it being…
PCoelho
  • 7,850
  • 11
  • 31
  • 36
0
votes
6 answers

How to replace non-diagonal elements in a matrix?

More specifically, I want all elements other than the diagonal ones (X_11, X_22, X_33,...,X_jj) to be zero. E.g. I want: [1 4 5 2 3 5 3 9 8] to be: [1 0 0 0 3 0 0 0 8] Is this possible? Sorry I'm a complete noob at this..
user2412028
  • 41
  • 1
  • 3
0
votes
1 answer

Determining diagonals in a matrix

I have a square matrix, and , if I select two random elements in it, I am interested to determine two cases: If the two elements are situated on a diagonal parallel with the main diagonal If the two elements are situated on a diagonal parallel with…
user2399378
  • 829
  • 2
  • 10
  • 23
0
votes
1 answer

Create a pseudo diagonal mask with css and scroll animation

I am struggling to create an effect that as the scroll is done, a diagonal will appear and reveal the contents inside it, but giving the idea that the content is flowing normally ... In the image below I think you can better understand: css…
Bruno Serra
  • 43
  • 3
  • 8
0
votes
1 answer

Replace the diagonal of matrix

I am interesting to replace the diagonal of matrix D to 1,2,3,4. This is matrix D: A=[1,2,3,4,2,3,4,5; 3,4,5,6,4,5,6,7]; D=[A;A]; D=[D D]; % size of matrix [4x16] %
cenging
  • 3
  • 1
  • 2
0
votes
2 answers

Make line became spatial diagonal of a cube in Three.js

I want to create a cube and a line, and make this line became the spatial diagonal of this cube. Using trigonometry, I know that the angle formed by a line with no rotation and the spatial diagonal is 54.73561031724535. But in a 3D engine system, I…
0
votes
2 answers

Find the data set which fulfill certain conditions

I have the data as shown in below: for a=1:2 for b=1:2 for c=1:2 for d=1:2 m{a,b}{c,d}=zeros(3,3); end end end end m{1,1}{1,1}=[6 1 4;3 7 2;1 5 6]; %pass m{1,1}{1,2}=[3 5 4;9 2…
Tony YEe
  • 235
  • 1
  • 3
  • 13
0
votes
1 answer

Why does diag exhibit inconsistent behavior in octave

Can someone explain what's going on here? octave:1> t = eye(3) t = Diagonal Matrix 1 0 0 0 1 0 0 0 1 octave:2> diag(t(3,:)) ans = Diagonal Matrix 0 0 0 0 0 0 0 0 1 octave:3> diag(t(2,:)) ans…
dspyz
  • 5,280
  • 2
  • 25
  • 63
0
votes
2 answers

Given a Matrix 3x3 How can I traverse through the longest diagonal only?

Given a Matrix 3x3 How can I traverse through the longest diagonal only? Take this example: 1 2 3 4 5 6 7 8 9 I want to traverse through 1,5,9
0
votes
1 answer

looping a diagonal animation

I'm trying to get my spaceship to fly left and down diagonally but I can't get it to reset to do the same loop again, any help would be cool. $(document).ready(function() { setTimeout("spaceship1()",400); }); function spaceship1(){ …
Ben
  • 1
  • 3
0
votes
2 answers

hoverstate on diagonal jquery grid

I'm trying to create this grid: I've made some html generated with jQuery and rotated that with jQuery.rotate. Now my div's are overlapping each other causing a problem to my hover state. Couldn't find any question that looks like this, has…
Jacob Francke
  • 425
  • 6
  • 23
-1
votes
2 answers

how to make a diagonal border (top and left)

image description here I need to make a div like this. I made it in clip-path, but the problem is that I have to insert the content into div (some text) that came out of div barrier, if anyone has a solution how to get a diagonal border (top, left),…
Uros
  • 1
  • 3
-1
votes
1 answer

Matrix with the diagonal set to 0, and the rest of the elements set from 1 to n (in C)

Firstly, a number N has to be input, and the matrix is of NxN dimensions then. The diagonal of the matrix has to be all 0, the elements of the matrix above the diagonal have to be from 1 to N diagonally, and the elements under the diagonal need to…
user19676724
-1
votes
1 answer

What is an alternative to retrieving diagonal elements without looping or calling np.diag()?

I have a 4x4 array, A1, and need to retrieve its diagonal elements without looping or calling np.diag(). What's a way of doing so? Appreciate your help! A1 = np.array([ [1, 4, 6, 8],[2, 5, 7, 10],[3, 6, 9, 13], [11, 12, 16, 0]])
wowzer
  • 25
  • 5
-1
votes
1 answer

diagonal check for connect 4

this is my first time asking a question. I am trying to make a connect 4 python game with the height of the table that can be modified by the players but I am having problems with checking the diagonals since the height can changed. Anyone can help…