Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Add math.diag

Open
#193 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp, unity

Research direction

The issue provides a C# example using float2 and float2x2 but names no implementation file or test. Start by locating existing matrix and vector math functions in Unity.Mathematics and their tests. Done means a diag operation accepts the shown float2 input and produces the illustrated 2x2 diagonal matrix.

Written by the indexing model from the issue text.

Description

It'll be great to be able to do the following:

float2 scale = float2(2f, 3f);
float2x2 transform = diag(scale);
// Yields:
// 2f 0f
// 0f 3f
Dominant language
C#
Stars
1.4k
Forks
159
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Unity-Technologies/Unity.Mathematics

All issues in Unity-Technologies/Unity.Mathematics

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.