Unity-Technologies / Unity-Technologies/Unity.Mathematics

Add math.diag

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

Nobody has claimed this yet.

Dominant language
C#
Stars
1.4k
Forks
159
PR merge metrics
No merged PRs in 30d

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

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.

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.