Verse Library verse

01 Snippet

Implements matrix construction, copying, and identity operations for mathematical calculations.

extracted-snippets/community/snippets/bO9r/fortnite-matrices/01-snippet.verse

# Source URL: https://dev.epicgames.com/community/snippets/bO9r/fortnite-matrices
# Local doc:  epic-docs/community/snippets/bO9r/fortnite-matrices.md
  # Module for matrices
  Matrices<public> := module:
  using { Arrays }
  using { Comparisons }
  using { /UnrealEngine.com/Temporary }
  # Float Matrices
  Matrix<public> := class<concrete>:
  Rows<public>:int=0
  Cols<public>:int=0
  Rep<public>:[][]float=array{}
  <# MATRIX CONSTRUCTION #>
  # Construct matrix
  ConstructMatrix<public><constructor>(InRep:[][]float)<decides><transacts>:=Matrix:
  let:
  var InRows:int = InRep.Length
  var InCols:int = if (ColOne:=InRep[0].Length, ColOne > 0):
  ColOne
  else:
  0
  block:
  for (Row:=0..InRows-1):
  InRep[Row].Length = InCols
  Rows:=InRows
  Cols:=InCols
  Rep:=InRep
  # Construct matrix from integers
  ConstructMatrixFromInts<public><constructor>(InRep:[][]int)<decides><transacts>:=Matrix:
  let:

Sign in free to read the full source 🌴

This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.

Sign in with Discord

Comments

    Sign in to vote, comment, or suggest an edit. Sign in