Elements icon indicating copy to clipboard operation
Elements copied to clipboard

Build perpendicular vector

Open julillosamaral opened this issue 5 years ago • 2 comments

Is your feature request related to a problem? Please describe. Vector element should have a way already defined of build a perpendicular vector to it.

Describe the solution you'd like A proposed snippet is provided

private static Vector3 perpendicularVector(Vector3 v, bool IsClockWise) {
   var angle = IsClockWise ? 90 : 270;
   var t = new Transform(new Vector3(0,0,0), angle);
   return t.OfVector(v);
}

Describe alternatives you've considered The vector built could have a dimension of 1 but it's not necessary, there's already a function for that.

Additional context It's a useful function that could be always available

julillosamaral avatar Apr 21 '20 18:04 julillosamaral

I would argue for consistency's sake this should generally be done with a cross product rather than thought of rotationally?

andrewheumann avatar Apr 22 '20 18:04 andrewheumann

For that we would need two vectors, which one are you thinking as the second one? (0,0,0)?

julillosamaral avatar Apr 22 '20 19:04 julillosamaral

I think I'm going to close this because to @andrewheumann's point, this should be done with cross products and there are an infinite number of perpendicular vectors to a vector. It requires the user to know what they want to do in a given situation.

ikeough avatar Apr 14 '23 23:04 ikeough