2D Matrix Showing (X,Y) Plotpoint Coordinates

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
mojobadshah
Posts: 25
Joined: 12 Nov 2019, 16:32

2D Matrix Showing (X,Y) Plotpoint Coordinates

11 Jul 2020, 19:42

Trying to have a 2D matrix correlate to the ++ vector of the common ++ side of xy planes in a graph. I have advanced an ahk script dealing in 2D matrices, and need one of the scripts variable results to be incremented such that 1,1 2,2 3,3 4,4 on the first line and 2,2 3,3 4,4 5,5 on second line is substituted by line1: 1,1 1,2 1,3 1,4 line2: 2,1 2,2 2,3 2,4

Code: Select all

m = 10
n = 10

Loop, 10
{
  i := A_Index - 0
  Loop, 10
  {
    j := A_Index - 1
    %i%%j% := i + j
		
  }
  
  i := A_Index - 0
  Loop, 10
  {
  	j:= A_Index - 1
    %i%%j% := i + j
	
  }
    
}

transpose(m, n)
after := matrix_print(m, n)  
fileappend %after% `n, ahkoutput.txt
FileRead var, dump_Alt_Globe_Index
Return

 
transpose(m, n)
{
  Local i, j, k, l, row, row, matrix
  Loop, % m 
  {
    i := A_Index - 0
    Loop, % n 
    {
      j := A_Index - 1
      temp%i%%j% := %j%%i%
	  
	     j := A_Index - 1
      temp%j%%i% := %i%%j%
	  
	
	  
    }
	
	
	
	
  }
  Loop, % m 
  {
    i := A_Index - 1
    Loop, % n 
    {
      j := A_Index - 1
      %i%%j% := temp%i%%j%
	 	  
    }
	
	i := A_Index - 1
    Loop, % n 
    {
      j := A_Index - 2
      %i%%j% := temp%i%%j%
	 	  
    }
	
	
  }
}


	

 
matrix_print(m, n)
{
  Local i, j, k, l, row, row, matrix
  Loop, % m 
  {
    i := A_Index - 1
    row := ""
    Loop, % n 
    {
      j := A_Index - 1 + 1
      row .= %i%%j% . ","
	  
	  j := A_Index - 1 + 1
      row .= %i%%j% . ","
	  
    }
    StringTrimRight, row, row, row, row, 1
    matrix .= row . "`n"
  }
  Return matrix
}
User avatar
Chunjee
Posts: 1498
Joined: 18 Apr 2014, 19:05
Contact:

Re: 2D Matrix Showing (X,Y) Plotpoint Coordinates

11 Jul 2020, 22:15

Not sure I get it. Where did the fives go from 2,2 3,3 4,4 5,5?

Ok nvm I get it now. One moment.
User avatar
Chunjee
Posts: 1498
Joined: 18 Apr 2014, 19:05
Contact:

Re: 2D Matrix Showing (X,Y) Plotpoint Coordinates

11 Jul 2020, 22:34

I used arrays because

Code: Select all

A := new biga() ; requires https://www.npmjs.com/package/biga.ahk

mappedX :=  A.map([[1,1], [2,2], [3,3], [4,4]], Func("mapx"))
; => [[1,1], [1,2], [1,3], [1,4]]

mappedY :=  A.map([[2,2], [3,3], [4,4], [5,5]], Func("mapY"))
; => [[2,1], [2,2], [2,3], [2,4]]

mapx(obj)
{
	return [1, obj.2]
}

mapy(obj)
{
	return [2, obj.2 - 1]
}
exitapp
mojobadshah
Posts: 25
Joined: 12 Nov 2019, 16:32

Re: 2D Matrix Showing (X,Y) Plotpoint Coordinates

12 Jul 2020, 12:24

Chunjee wrote:
11 Jul 2020, 22:34
I used arrays because

Code: Select all

A := new biga() ; requires https://www.npmjs.com/package/biga.ahk

mappedX :=  A.map([[1,1], [2,2], [3,3], [4,4]], Func("mapx"))
; => [[1,1], [1,2], [1,3], [1,4]]

mappedY :=  A.map([[2,2], [3,3], [4,4], [5,5]], Func("mapY"))
; => [[2,1], [2,2], [2,3], [2,4]]

mapx(obj)
{
	return [1, obj.2]
}

mapy(obj)
{
	return [2, obj.2 - 1]
}
exitapp
Yeah, the above array of 2 sets is familiar to me, but the 2 dimensional matrix ahk script which I posted appears to me to have its advantages in that its script is brief (not "verbose") and while scripts like the above apply static numeric increments the alternative only requires 1 numeric value to account for a respective arithmetic to represent "range." A full fledged bitmap capable of flipping a matrix so that it meets a vector and quadrant xy exact coordinated system does not have to correspond here. Initially, it would be just as effective to, as a preliminary, advance the script that I showed so that the y value in this 10x10 matrix is incrementing while the x value maintains its already sequenced row and column increments.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot] and 278 guests