Created
December 11, 2019 15:45
-
-
Save CapitanLiteral/e5ca035a19cce6d482599bcdc91d0a4b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public static class VectorExtensions | |
{ | |
// 2 component combinations | |
public static Vector4 XY__(this Vector2 aVec, float aZ = 0, float aW = 0) { return new Vector4(aVec.x, aVec.y, aZ, aW); } | |
public static Vector4 XY__(this Vector3 aVec, float aZ = 0, float aW = 0) { return new Vector4(aVec.x, aVec.y, aZ, aW); } | |
public static Vector4 XY__(this Vector4 aVec, float aZ = 0, float aW = 0) { return new Vector4(aVec.x, aVec.y, aZ, aW); } | |
public static Vector4 X_Y_(this Vector2 aVec, float aY = 0, float aW = 0) { return new Vector4(aVec.x, aY, aVec.y, aW); } | |
public static Vector4 X_Y_(this Vector3 aVec, float aY = 0, float aW = 0) { return new Vector4(aVec.x, aY, aVec.y, aW); } | |
public static Vector4 X_Y_(this Vector4 aVec, float aY = 0, float aW = 0) { return new Vector4(aVec.x, aY, aVec.y, aW); } | |
public static Vector4 X__Y(this Vector2 aVec, float aY = 0, float aZ = 0) { return new Vector4(aVec.x, aY, aZ, aVec.y); } | |
public static Vector4 X__Y(this Vector3 aVec, float aY = 0, float aZ = 0) { return new Vector4(aVec.x, aY, aZ, aVec.y); } | |
public static Vector4 X__Y(this Vector4 aVec, float aY = 0, float aZ = 0) { return new Vector4(aVec.x, aY, aZ, aVec.y); } | |
public static Vector4 _XY_(this Vector2 aVec, float aX = 0, float aW = 0) { return new Vector4(aX, aVec.x, aVec.y, aW); } | |
public static Vector4 _XY_(this Vector3 aVec, float aX = 0, float aW = 0) { return new Vector4(aX, aVec.x, aVec.y, aW); } | |
public static Vector4 _XY_(this Vector4 aVec, float aX = 0, float aW = 0) { return new Vector4(aX, aVec.x, aVec.y, aW); } | |
public static Vector4 _X_Y(this Vector2 aVec, float aX = 0, float aZ = 0) { return new Vector4(aX, aVec.x, aZ, aVec.y); } | |
public static Vector4 _X_Y(this Vector3 aVec, float aX = 0, float aZ = 0) { return new Vector4(aX, aVec.x, aZ, aVec.y); } | |
public static Vector4 _X_Y(this Vector4 aVec, float aX = 0, float aZ = 0) { return new Vector4(aX, aVec.x, aZ, aVec.y); } | |
public static Vector4 __XY(this Vector2 aVec, float aX = 0, float aY = 0) { return new Vector4(aX, aY, aVec.x, aVec.y); } | |
public static Vector4 __XY(this Vector3 aVec, float aX = 0, float aY = 0) { return new Vector4(aX, aY, aVec.x, aVec.y); } | |
public static Vector4 __XY(this Vector4 aVec, float aX = 0, float aY = 0) { return new Vector4(aX, aY, aVec.x, aVec.y); } | |
// 3 component combinations | |
public static Vector4 XYZ_(this Vector3 aVec, float aW = 0) { return new Vector4(aVec.x, aVec.y, aVec.z, aW); } | |
public static Vector4 XYZ_(this Vector4 aVec, float aW = 0) { return new Vector4(aVec.x, aVec.y, aVec.z, aW); } | |
public static Vector4 XY_Z(this Vector3 aVec, float aZ = 0) { return new Vector4(aVec.x, aVec.y, aZ, aVec.z); } | |
public static Vector4 XY_Z(this Vector4 aVec, float aZ = 0) { return new Vector4(aVec.x, aVec.y, aZ, aVec.z); } | |
public static Vector4 X_YZ(this Vector3 aVec, float aY = 0) { return new Vector4(aVec.x, aY, aVec.y, aVec.z); } | |
public static Vector4 X_YZ(this Vector4 aVec, float aY = 0) { return new Vector4(aVec.x, aY, aVec.y, aVec.z); } | |
public static Vector4 _XYZ(this Vector3 aVec, float aX = 0) { return new Vector4(aX, aVec.x, aVec.y, aVec.z); } | |
public static Vector4 _XYZ(this Vector4 aVec, float aX = 0) { return new Vector4(aX, aVec.x, aVec.y, aVec.z); } | |
// 4 component permutations | |
public static Vector4 XYWZ(this Vector4 aVec) { return new Vector4(aVec.x, aVec.y, aVec.w, aVec.z); } | |
public static Vector4 XZYW(this Vector4 aVec) { return new Vector4(aVec.x, aVec.z, aVec.y, aVec.w); } | |
public static Vector4 XZWY(this Vector4 aVec) { return new Vector4(aVec.x, aVec.z, aVec.w, aVec.y); } | |
public static Vector4 XWYZ(this Vector4 aVec) { return new Vector4(aVec.x, aVec.w, aVec.y, aVec.z); } | |
public static Vector4 XWZY(this Vector4 aVec) { return new Vector4(aVec.x, aVec.w, aVec.z, aVec.y); } | |
public static Vector4 YXZW(this Vector4 aVec) { return new Vector4(aVec.y, aVec.x, aVec.z, aVec.w); } | |
public static Vector4 YXWZ(this Vector4 aVec) { return new Vector4(aVec.y, aVec.x, aVec.w, aVec.z); } | |
public static Vector4 ZXYW(this Vector4 aVec) { return new Vector4(aVec.z, aVec.x, aVec.y, aVec.w); } | |
public static Vector4 ZXWY(this Vector4 aVec) { return new Vector4(aVec.z, aVec.x, aVec.w, aVec.y); } | |
public static Vector4 WXYZ(this Vector4 aVec) { return new Vector4(aVec.w, aVec.x, aVec.y, aVec.z); } | |
public static Vector4 WXZY(this Vector4 aVec) { return new Vector4(aVec.w, aVec.x, aVec.z, aVec.y); } | |
public static Vector4 YZXW(this Vector4 aVec) { return new Vector4(aVec.y, aVec.z, aVec.x, aVec.w); } | |
public static Vector4 YWXZ(this Vector4 aVec) { return new Vector4(aVec.y, aVec.w, aVec.x, aVec.z); } | |
public static Vector4 ZYXW(this Vector4 aVec) { return new Vector4(aVec.z, aVec.y, aVec.x, aVec.w); } | |
public static Vector4 ZWXY(this Vector4 aVec) { return new Vector4(aVec.z, aVec.w, aVec.x, aVec.y); } | |
public static Vector4 WYXZ(this Vector4 aVec) { return new Vector4(aVec.w, aVec.y, aVec.x, aVec.z); } | |
public static Vector4 WZXY(this Vector4 aVec) { return new Vector4(aVec.w, aVec.z, aVec.x, aVec.y); } | |
public static Vector4 YZWX(this Vector4 aVec) { return new Vector4(aVec.y, aVec.z, aVec.w, aVec.x); } | |
public static Vector4 YWZX(this Vector4 aVec) { return new Vector4(aVec.y, aVec.w, aVec.z, aVec.x); } | |
public static Vector4 ZYWX(this Vector4 aVec) { return new Vector4(aVec.z, aVec.y, aVec.w, aVec.x); } | |
public static Vector4 ZWYX(this Vector4 aVec) { return new Vector4(aVec.z, aVec.w, aVec.y, aVec.x); } | |
public static Vector4 WYZX(this Vector4 aVec) { return new Vector4(aVec.w, aVec.y, aVec.z, aVec.x); } | |
public static Vector4 WZYX(this Vector4 aVec) { return new Vector4(aVec.w, aVec.z, aVec.y, aVec.x); } | |
// 4 component combinations | |
public static Vector4 XXXX(this Vector4 aVec) { return new Vector4(aVec.x, aVec.x, aVec.x, aVec.x); } | |
public static Vector4 YYYY(this Vector4 aVec) { return new Vector4(aVec.y, aVec.y, aVec.y, aVec.y); } | |
public static Vector4 ZZZZ(this Vector4 aVec) { return new Vector4(aVec.z, aVec.z, aVec.z, aVec.z); } | |
public static Vector4 WWWW(this Vector4 aVec) { return new Vector4(aVec.w, aVec.w, aVec.w, aVec.w); } | |
public static Vector4 XYXY(this Vector4 aVec) { return new Vector4(aVec.x, aVec.y, aVec.x, aVec.y); } | |
public static Vector4 XXYY(this Vector4 aVec) { return new Vector4(aVec.x, aVec.x, aVec.x, aVec.x); } | |
//Other | |
public static Vector4 XYZW(this Vector2 aVec, float x) { return new Vector4(x, x, x, x); } | |
public static Vector4 XYZW(this Vector3 aVec, float x) { return new Vector4(x, x, x, x); } | |
public static Vector4 XYZW(this Vector4 aVec, float x) { return new Vector4(x, x, x, x); } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment