Proposal to add a vector projection function

Open
#166 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

The issue does not name a file or test. Start by locating the DirectXMath vector API and its existing vector-operation conventions, then review how additions are validated. Done means the proposed vector projection operation is accepted as part of the library with appropriate coverage.

Written by the indexing model from the issue text.

Description

proposal simplemath

Sometimes I need to project a vector on another vector, as described here. It seems that DirectXMath does not offer a function to do this out of the box which is why I came up with the following implementation:

inline XMVECTOR ProjectVectorToVector(XMVECTOR v1, XMVECTOR v2)
{
  return XMVectorMultiply(XMVectorDivide(XMVector3Dot(v1, v2), XMVector3Dot(v2, v2)), v2);
}

Admittedly, such a function isn't hard to implement but to me, it seems like such a common geometric operation that I think it makes sense to add this to DirectXMath itself.

Dominant language
C++
Stars
1.8k
Forks
262
Avg merge
20h 57m
Merged PRs (30d)
4

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 microsoft/DirectXMath

All issues in microsoft/DirectXMath

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.