// Copyright (c) Xenko contributors (https://xenko.com) and Silicon Studio Corp. (https://www.siliconstudio.co.jp)
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.
namespace math
{
///
/// Extensions methods of the vector classes.
///
public static class VectorExtensions
{
///
/// Return the Y/X components of the vector in the inverse order.
///
/// the input vector
public static Vec2 YX(this Vec2 vector)
{
return new Vec2(vector.Y, vector.X);
}
///
/// Return the X/Y components of the vector.
///
/// the input vector
public static Vec2 XY(this Vec3 vector)
{
return new Vec2(vector.X, vector.Y);
}
///
/// Return the X/Z components of the vector.
///
/// the input vector
public static Vec2 XZ(this Vec3 vector)
{
return new Vec2(vector.X, vector.Z);
}
///
/// Return the Y/Z components of the vector.
///
/// the input vector
public static Vec2 YZ(this Vec3 vector)
{
return new Vec2(vector.Y, vector.Z);
}
///
/// Return the X/Y components of the vector.
///
/// the input vector
public static Vec2 XY(this Vec4 vector)
{
return new Vec2(vector.X, vector.Y);
}
///
/// Return the X/Y/Z components of the vector.
///
/// the input vector
public static Vec3 XYZ(this Vec4 vector)
{
return new Vec3(vector.X, vector.Y, vector.Z);
}
}
}