Unity-Technologies / Unity-Technologies/Unity.Mathematics

[Feature Request] Add angle and signed angle?

Open
#84 16 comments 4 reactions 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

The greetings.

I have forked this master-branch and from this master-branch I have edited math.cs of which you can see here:

https://github.com/quakeulf/Unity.Mathematics/blob/master/src/Unity.Mathematics/math.cs

Specificially from line 98 to line 111 are my additions. I am also including them below this text so you can see in this field of text what I have proposed to add, but cannot, since I cannot seem to figure out how to do a request for pull:

        /// <summary>Returns the angle in degrees from 0 to 180 between two float3s.</summary>
        public static float angle(float3 from, float3 to)
        {
            return math.degrees(math.acos(math.dot(math.normalize(from), math.normalize(to))));
        }
        
        /// <summary>Returns the signed angle in degrees from 180 to -180 between two float3s.</summary>
        public static float anglesigned(float3 from, float3 to)
        {
            float angle = math.acos(math.dot(math.normalize(from), math.normalize(to)));
            float3 cross = math.cross(from, to);
            angle *= math.sign(math.dot(math.up(), cross));
            return math.degrees(angle);
        }

If they are already in there, let me know where. Preferably through documentation on your webcite.

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

Start with src/Unity.Mathematics/math.cs, especially lines 98-111, and read the surrounding math APIs alongside the discussion for any maintainer decision. Done means the requested angle functionality has an agreed API and is incorporated with verification appropriate to the project.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.