Expose max_axis_index and max_axis_index for Vector2(i)
Some cleanup with Vector3(i)'s methods so that it is consistent with Vector2, for example it returns enums internally (GDScript still gets ints).
This commit is contained in:
parent
543462eb29
commit
24f57886d0
18 changed files with 119 additions and 78 deletions
|
@ -30,8 +30,8 @@ void _split_leaf_sort_groups_simple(int &num_a, int &num_b, uint16_t *group_a, u
|
|||
|
||||
int order[Point::AXIS_COUNT];
|
||||
|
||||
order[0] = size.min_axis();
|
||||
order[Point::AXIS_COUNT - 1] = size.max_axis();
|
||||
order[0] = size.min_axis_index();
|
||||
order[Point::AXIS_COUNT - 1] = size.max_axis_index();
|
||||
|
||||
static_assert(Point::AXIS_COUNT <= 3);
|
||||
if (Point::AXIS_COUNT == 3) {
|
||||
|
|
|
@ -606,9 +606,9 @@ private:
|
|||
PagedAllocator<Face> face_pool;
|
||||
LocalVector<Vertex *> original_vertices;
|
||||
int32_t merge_stamp = 0;
|
||||
int32_t min_axis = 0;
|
||||
int32_t med_axis = 0;
|
||||
int32_t max_axis = 0;
|
||||
Vector3::Axis min_axis = Vector3::Axis::AXIS_X;
|
||||
Vector3::Axis med_axis = Vector3::Axis::AXIS_X;
|
||||
Vector3::Axis max_axis = Vector3::Axis::AXIS_X;
|
||||
int32_t used_edge_pairs = 0;
|
||||
int32_t max_used_edge_pairs = 0;
|
||||
|
||||
|
@ -1585,12 +1585,12 @@ void ConvexHullInternal::compute(const Vector3 *p_coords, int32_t p_count) {
|
|||
}
|
||||
|
||||
Vector3 s = aabb.size;
|
||||
max_axis = s.max_axis();
|
||||
min_axis = s.min_axis();
|
||||
max_axis = s.max_axis_index();
|
||||
min_axis = s.min_axis_index();
|
||||
if (min_axis == max_axis) {
|
||||
min_axis = (max_axis + 1) % 3;
|
||||
min_axis = Vector3::Axis((max_axis + 1) % 3);
|
||||
}
|
||||
med_axis = 3 - max_axis - min_axis;
|
||||
med_axis = Vector3::Axis(3 - max_axis - min_axis);
|
||||
|
||||
s /= real_t(10216);
|
||||
if (((med_axis + 1) % 3) != max_axis) {
|
||||
|
|
|
@ -70,12 +70,12 @@ struct Vector2 {
|
|||
x = y = p_value;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ int min_axis() const {
|
||||
return x < y ? 0 : 1;
|
||||
_FORCE_INLINE_ Vector2::Axis min_axis_index() const {
|
||||
return x < y ? Vector2::AXIS_X : Vector2::AXIS_Y;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ int max_axis() const {
|
||||
return x < y ? 1 : 0;
|
||||
_FORCE_INLINE_ Vector2::Axis max_axis_index() const {
|
||||
return x < y ? Vector2::AXIS_Y : Vector2::AXIS_X;
|
||||
}
|
||||
|
||||
void normalize();
|
||||
|
@ -301,12 +301,12 @@ struct Vector2i {
|
|||
return p_idx ? y : x;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ int min_axis() const {
|
||||
return x < y ? 0 : 1;
|
||||
_FORCE_INLINE_ Vector2i::Axis min_axis_index() const {
|
||||
return x < y ? Vector2i::AXIS_X : Vector2i::AXIS_Y;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ int max_axis() const {
|
||||
return x < y ? 1 : 0;
|
||||
_FORCE_INLINE_ Vector2i::Axis max_axis_index() const {
|
||||
return x < y ? Vector2i::AXIS_Y : Vector2i::AXIS_X;
|
||||
}
|
||||
|
||||
Vector2i min(const Vector2i &p_vector2i) const {
|
||||
|
|
|
@ -71,12 +71,12 @@ struct Vector3 {
|
|||
x = y = z = p_value;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ int min_axis() const {
|
||||
return x < y ? (x < z ? 0 : 2) : (y < z ? 1 : 2);
|
||||
_FORCE_INLINE_ Vector3::Axis min_axis_index() const {
|
||||
return x < y ? (x < z ? Vector3::AXIS_X : Vector3::AXIS_Z) : (y < z ? Vector3::AXIS_Y : Vector3::AXIS_Z);
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ int max_axis() const {
|
||||
return x < y ? (y < z ? 2 : 1) : (x < z ? 2 : 0);
|
||||
_FORCE_INLINE_ Vector3::Axis max_axis_index() const {
|
||||
return x < y ? (y < z ? Vector3::AXIS_Z : Vector3::AXIS_Y) : (x < z ? Vector3::AXIS_Z : Vector3::AXIS_X);
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ real_t length() const;
|
||||
|
|
|
@ -40,12 +40,12 @@ int32_t Vector3i::get_axis(const int p_axis) const {
|
|||
return operator[](p_axis);
|
||||
}
|
||||
|
||||
int Vector3i::min_axis() const {
|
||||
return x < y ? (x < z ? 0 : 2) : (y < z ? 1 : 2);
|
||||
Vector3i::Axis Vector3i::min_axis_index() const {
|
||||
return x < y ? (x < z ? Vector3i::AXIS_X : Vector3i::AXIS_Z) : (y < z ? Vector3i::AXIS_Y : Vector3i::AXIS_Z);
|
||||
}
|
||||
|
||||
int Vector3i::max_axis() const {
|
||||
return x < y ? (y < z ? 2 : 1) : (x < z ? 2 : 0);
|
||||
Vector3i::Axis Vector3i::max_axis_index() const {
|
||||
return x < y ? (y < z ? Vector3i::AXIS_Z : Vector3i::AXIS_Y) : (x < z ? Vector3i::AXIS_Z : Vector3i::AXIS_X);
|
||||
}
|
||||
|
||||
Vector3i Vector3i::clamp(const Vector3i &p_min, const Vector3i &p_max) const {
|
||||
|
|
|
@ -62,8 +62,8 @@ struct Vector3i {
|
|||
void set_axis(const int p_axis, const int32_t p_value);
|
||||
int32_t get_axis(const int p_axis) const;
|
||||
|
||||
int min_axis() const;
|
||||
int max_axis() const;
|
||||
Vector3i::Axis min_axis_index() const;
|
||||
Vector3i::Axis max_axis_index() const;
|
||||
|
||||
_FORCE_INLINE_ void zero();
|
||||
|
||||
|
|
|
@ -87,7 +87,10 @@ struct VariantCaster<const T &> {
|
|||
// Object enum casts must go here
|
||||
VARIANT_ENUM_CAST(Object::ConnectFlags);
|
||||
|
||||
VARIANT_ENUM_CAST(Vector2::Axis);
|
||||
VARIANT_ENUM_CAST(Vector2i::Axis);
|
||||
VARIANT_ENUM_CAST(Vector3::Axis);
|
||||
VARIANT_ENUM_CAST(Vector3i::Axis);
|
||||
VARIANT_ENUM_CAST(Basis::EulerOrder);
|
||||
|
||||
VARIANT_ENUM_CAST(Error);
|
||||
|
|
|
@ -1486,6 +1486,8 @@ static void _register_variant_builtin_methods() {
|
|||
bind_method(Vector2, lerp, sarray("to", "weight"), varray());
|
||||
bind_method(Vector2, slerp, sarray("to", "weight"), varray());
|
||||
bind_method(Vector2, cubic_interpolate, sarray("b", "pre_a", "post_b", "weight"), varray());
|
||||
bind_method(Vector2, max_axis_index, sarray(), varray());
|
||||
bind_method(Vector2, min_axis_index, sarray(), varray());
|
||||
bind_method(Vector2, move_toward, sarray("to", "delta"), varray());
|
||||
bind_method(Vector2, rotated, sarray("phi"), varray());
|
||||
bind_method(Vector2, orthogonal, sarray(), varray());
|
||||
|
@ -1508,6 +1510,8 @@ static void _register_variant_builtin_methods() {
|
|||
/* Vector2i */
|
||||
|
||||
bind_method(Vector2i, aspect, sarray(), varray());
|
||||
bind_method(Vector2i, max_axis_index, sarray(), varray());
|
||||
bind_method(Vector2i, min_axis_index, sarray(), varray());
|
||||
bind_method(Vector2i, sign, sarray(), varray());
|
||||
bind_method(Vector2i, abs, sarray(), varray());
|
||||
bind_method(Vector2i, clamp, sarray("min", "max"), varray());
|
||||
|
@ -1547,8 +1551,8 @@ static void _register_variant_builtin_methods() {
|
|||
|
||||
/* Vector3 */
|
||||
|
||||
bind_method(Vector3, min_axis, sarray(), varray());
|
||||
bind_method(Vector3, max_axis, sarray(), varray());
|
||||
bind_method(Vector3, min_axis_index, sarray(), varray());
|
||||
bind_method(Vector3, max_axis_index, sarray(), varray());
|
||||
bind_method(Vector3, angle_to, sarray("to"), varray());
|
||||
bind_method(Vector3, signed_angle_to, sarray("to", "axis"), varray());
|
||||
bind_method(Vector3, direction_to, sarray("to"), varray());
|
||||
|
@ -1587,8 +1591,8 @@ static void _register_variant_builtin_methods() {
|
|||
|
||||
/* Vector3i */
|
||||
|
||||
bind_method(Vector3i, min_axis, sarray(), varray());
|
||||
bind_method(Vector3i, max_axis, sarray(), varray());
|
||||
bind_method(Vector3i, min_axis_index, sarray(), varray());
|
||||
bind_method(Vector3i, max_axis_index, sarray(), varray());
|
||||
bind_method(Vector3i, sign, sarray(), varray());
|
||||
bind_method(Vector3i, abs, sarray(), varray());
|
||||
bind_method(Vector3i, clamp, sarray("min", "max"), varray());
|
||||
|
|
|
@ -753,8 +753,14 @@ VARIANT_ACCESSOR_NUMBER(uint32_t)
|
|||
VARIANT_ACCESSOR_NUMBER(int64_t)
|
||||
VARIANT_ACCESSOR_NUMBER(uint64_t)
|
||||
VARIANT_ACCESSOR_NUMBER(char32_t)
|
||||
|
||||
// Bind enums to allow using them as return types.
|
||||
VARIANT_ACCESSOR_NUMBER(Error)
|
||||
VARIANT_ACCESSOR_NUMBER(Side)
|
||||
VARIANT_ACCESSOR_NUMBER(Vector2::Axis)
|
||||
VARIANT_ACCESSOR_NUMBER(Vector2i::Axis)
|
||||
VARIANT_ACCESSOR_NUMBER(Vector3::Axis)
|
||||
VARIANT_ACCESSOR_NUMBER(Vector3i::Axis)
|
||||
|
||||
template <>
|
||||
struct VariantInternalAccessor<Basis::EulerOrder> {
|
||||
|
@ -1020,6 +1026,10 @@ INITIALIZER_INT(int64_t)
|
|||
INITIALIZER_INT(char32_t)
|
||||
INITIALIZER_INT(Error)
|
||||
INITIALIZER_INT(ObjectID)
|
||||
INITIALIZER_INT(Vector2::Axis)
|
||||
INITIALIZER_INT(Vector2i::Axis)
|
||||
INITIALIZER_INT(Vector3::Axis)
|
||||
INITIALIZER_INT(Vector3i::Axis)
|
||||
|
||||
template <>
|
||||
struct VariantInitializer<double> {
|
||||
|
|
|
@ -214,6 +214,18 @@
|
|||
Returns the vector with a maximum length by limiting its length to [code]length[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="max_axis_index" qualifiers="const">
|
||||
<return type="int" />
|
||||
<description>
|
||||
Returns the axis of the vector's highest value. See [code]AXIS_*[/code] constants. If all components are equal, this method returns [constant AXIS_X].
|
||||
</description>
|
||||
</method>
|
||||
<method name="min_axis_index" qualifiers="const">
|
||||
<return type="int" />
|
||||
<description>
|
||||
Returns the axis of the vector's lowest value. See [code]AXIS_*[/code] constants. If all components are equal, this method returns [constant AXIS_Y].
|
||||
</description>
|
||||
</method>
|
||||
<method name="move_toward" qualifiers="const">
|
||||
<return type="Vector2" />
|
||||
<argument index="0" name="to" type="Vector2" />
|
||||
|
@ -315,10 +327,10 @@
|
|||
</members>
|
||||
<constants>
|
||||
<constant name="AXIS_X" value="0">
|
||||
Enumerated value for the X axis.
|
||||
Enumerated value for the X axis. Returned by [method max_axis_index] and [method min_axis_index].
|
||||
</constant>
|
||||
<constant name="AXIS_Y" value="1">
|
||||
Enumerated value for the Y axis.
|
||||
Enumerated value for the Y axis. Returned by [method max_axis_index] and [method min_axis_index].
|
||||
</constant>
|
||||
<constant name="ZERO" value="Vector2(0, 0)">
|
||||
Zero vector, a vector with all components set to [code]0[/code].
|
||||
|
|
|
@ -64,6 +64,18 @@
|
|||
Returns a new vector with all components clamped between the components of [code]min[/code] and [code]max[/code], by running [method @GlobalScope.clamp] on each component.
|
||||
</description>
|
||||
</method>
|
||||
<method name="max_axis_index" qualifiers="const">
|
||||
<return type="int" />
|
||||
<description>
|
||||
Returns the axis of the vector's highest value. See [code]AXIS_*[/code] constants. If all components are equal, this method returns [constant AXIS_X].
|
||||
</description>
|
||||
</method>
|
||||
<method name="min_axis_index" qualifiers="const">
|
||||
<return type="int" />
|
||||
<description>
|
||||
Returns the axis of the vector's lowest value. See [code]AXIS_*[/code] constants. If all components are equal, this method returns [constant AXIS_Y].
|
||||
</description>
|
||||
</method>
|
||||
<method name="sign" qualifiers="const">
|
||||
<return type="Vector2i" />
|
||||
<description>
|
||||
|
@ -81,10 +93,10 @@
|
|||
</members>
|
||||
<constants>
|
||||
<constant name="AXIS_X" value="0">
|
||||
Enumerated value for the X axis.
|
||||
Enumerated value for the X axis. Returned by [method max_axis_index] and [method min_axis_index].
|
||||
</constant>
|
||||
<constant name="AXIS_Y" value="1">
|
||||
Enumerated value for the Y axis.
|
||||
Enumerated value for the Y axis. Returned by [method max_axis_index] and [method min_axis_index].
|
||||
</constant>
|
||||
<constant name="ZERO" value="Vector2i(0, 0)">
|
||||
Zero vector, a vector with all components set to [code]0[/code].
|
||||
|
|
|
@ -184,16 +184,16 @@
|
|||
Returns the vector with a maximum length by limiting its length to [code]length[/code].
|
||||
</description>
|
||||
</method>
|
||||
<method name="max_axis" qualifiers="const">
|
||||
<method name="max_axis_index" qualifiers="const">
|
||||
<return type="int" />
|
||||
<description>
|
||||
Returns the axis of the vector's largest value. See [code]AXIS_*[/code] constants. If all components are equal, this method returns [constant AXIS_X].
|
||||
Returns the axis of the vector's highest value. See [code]AXIS_*[/code] constants. If all components are equal, this method returns [constant AXIS_X].
|
||||
</description>
|
||||
</method>
|
||||
<method name="min_axis" qualifiers="const">
|
||||
<method name="min_axis_index" qualifiers="const">
|
||||
<return type="int" />
|
||||
<description>
|
||||
Returns the axis of the vector's smallest value. See [code]AXIS_*[/code] constants. If all components are equal, this method returns [constant AXIS_Z].
|
||||
Returns the axis of the vector's lowest value. See [code]AXIS_*[/code] constants. If all components are equal, this method returns [constant AXIS_Z].
|
||||
</description>
|
||||
</method>
|
||||
<method name="move_toward" qualifiers="const">
|
||||
|
@ -321,13 +321,13 @@
|
|||
</members>
|
||||
<constants>
|
||||
<constant name="AXIS_X" value="0">
|
||||
Enumerated value for the X axis. Returned by [method max_axis] and [method min_axis].
|
||||
Enumerated value for the X axis. Returned by [method max_axis_index] and [method min_axis_index].
|
||||
</constant>
|
||||
<constant name="AXIS_Y" value="1">
|
||||
Enumerated value for the Y axis. Returned by [method max_axis] and [method min_axis].
|
||||
Enumerated value for the Y axis. Returned by [method max_axis_index] and [method min_axis_index].
|
||||
</constant>
|
||||
<constant name="AXIS_Z" value="2">
|
||||
Enumerated value for the Z axis. Returned by [method max_axis] and [method min_axis].
|
||||
Enumerated value for the Z axis. Returned by [method max_axis_index] and [method min_axis_index].
|
||||
</constant>
|
||||
<constant name="ZERO" value="Vector3(0, 0, 0)">
|
||||
Zero vector, a vector with all components set to [code]0[/code].
|
||||
|
|
|
@ -58,16 +58,16 @@
|
|||
Returns a new vector with all components clamped between the components of [code]min[/code] and [code]max[/code], by running [method @GlobalScope.clamp] on each component.
|
||||
</description>
|
||||
</method>
|
||||
<method name="max_axis" qualifiers="const">
|
||||
<method name="max_axis_index" qualifiers="const">
|
||||
<return type="int" />
|
||||
<description>
|
||||
Returns the axis of the vector's largest value. See [code]AXIS_*[/code] constants. If all components are equal, this method returns [constant AXIS_X].
|
||||
Returns the axis of the vector's highest value. See [code]AXIS_*[/code] constants. If all components are equal, this method returns [constant AXIS_X].
|
||||
</description>
|
||||
</method>
|
||||
<method name="min_axis" qualifiers="const">
|
||||
<method name="min_axis_index" qualifiers="const">
|
||||
<return type="int" />
|
||||
<description>
|
||||
Returns the axis of the vector's smallest value. See [code]AXIS_*[/code] constants. If all components are equal, this method returns [constant AXIS_Z].
|
||||
Returns the axis of the vector's lowest value. See [code]AXIS_*[/code] constants. If all components are equal, this method returns [constant AXIS_Z].
|
||||
</description>
|
||||
</method>
|
||||
<method name="sign" qualifiers="const">
|
||||
|
@ -90,13 +90,13 @@
|
|||
</members>
|
||||
<constants>
|
||||
<constant name="AXIS_X" value="0">
|
||||
Enumerated value for the X axis.
|
||||
Enumerated value for the X axis. Returned by [method max_axis_index] and [method min_axis_index].
|
||||
</constant>
|
||||
<constant name="AXIS_Y" value="1">
|
||||
Enumerated value for the Y axis.
|
||||
Enumerated value for the Y axis. Returned by [method max_axis_index] and [method min_axis_index].
|
||||
</constant>
|
||||
<constant name="AXIS_Z" value="2">
|
||||
Enumerated value for the Z axis.
|
||||
Enumerated value for the Z axis. Returned by [method max_axis_index] and [method min_axis_index].
|
||||
</constant>
|
||||
<constant name="ZERO" value="Vector3i(0, 0, 0)">
|
||||
Zero vector, a vector with all components set to [code]0[/code].
|
||||
|
|
|
@ -3786,7 +3786,7 @@ void TileMapEditor::forward_canvas_draw_over_viewport(Control *p_overlay) {
|
|||
}
|
||||
|
||||
// Draw the warning icon.
|
||||
int min_axis = missing_tile_texture->get_size().min_axis();
|
||||
Vector2::Axis min_axis = missing_tile_texture->get_size().min_axis_index();
|
||||
Vector2 icon_size;
|
||||
icon_size[min_axis] = tile_set->get_tile_size()[min_axis] / 3;
|
||||
icon_size[(min_axis + 1) % 2] = (icon_size[min_axis] * missing_tile_texture->get_size()[(min_axis + 1) % 2] / missing_tile_texture->get_size()[min_axis]);
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Godot
|
|||
{
|
||||
/// <summary>
|
||||
/// Enumerated index values for the axes.
|
||||
/// Returned by <see cref="MaxAxis"/> and <see cref="MinAxis"/>.
|
||||
/// Returned by <see cref="MaxAxisIndex"/> and <see cref="MinAxisIndex"/>.
|
||||
/// </summary>
|
||||
public enum Axis
|
||||
{
|
||||
|
@ -365,21 +365,21 @@ namespace Godot
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the axis of the vector's largest value. See <see cref="Axis"/>.
|
||||
/// Returns the axis of the vector's highest value. See <see cref="Axis"/>.
|
||||
/// If both components are equal, this method returns <see cref="Axis.X"/>.
|
||||
/// </summary>
|
||||
/// <returns>The index of the largest axis.</returns>
|
||||
public Axis MaxAxis()
|
||||
/// <returns>The index of the highest axis.</returns>
|
||||
public Axis MaxAxisIndex()
|
||||
{
|
||||
return x < y ? Axis.Y : Axis.X;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the axis of the vector's smallest value. See <see cref="Axis"/>.
|
||||
/// Returns the axis of the vector's lowest value. See <see cref="Axis"/>.
|
||||
/// If both components are equal, this method returns <see cref="Axis.Y"/>.
|
||||
/// </summary>
|
||||
/// <returns>The index of the smallest axis.</returns>
|
||||
public Axis MinAxis()
|
||||
/// <returns>The index of the lowest axis.</returns>
|
||||
public Axis MinAxisIndex()
|
||||
{
|
||||
return x < y ? Axis.X : Axis.Y;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Godot
|
|||
{
|
||||
/// <summary>
|
||||
/// Enumerated index values for the axes.
|
||||
/// Returned by <see cref="MaxAxis"/> and <see cref="MinAxis"/>.
|
||||
/// Returned by <see cref="MaxAxisIndex"/> and <see cref="MinAxisIndex"/>.
|
||||
/// </summary>
|
||||
public enum Axis
|
||||
{
|
||||
|
@ -218,21 +218,21 @@ namespace Godot
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the axis of the vector's largest value. See <see cref="Axis"/>.
|
||||
/// Returns the axis of the vector's highest value. See <see cref="Axis"/>.
|
||||
/// If both components are equal, this method returns <see cref="Axis.X"/>.
|
||||
/// </summary>
|
||||
/// <returns>The index of the largest axis.</returns>
|
||||
public Axis MaxAxis()
|
||||
/// <returns>The index of the highest axis.</returns>
|
||||
public Axis MaxAxisIndex()
|
||||
{
|
||||
return x < y ? Axis.Y : Axis.X;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the axis of the vector's smallest value. See <see cref="Axis"/>.
|
||||
/// Returns the axis of the vector's lowest value. See <see cref="Axis"/>.
|
||||
/// If both components are equal, this method returns <see cref="Axis.Y"/>.
|
||||
/// </summary>
|
||||
/// <returns>The index of the smallest axis.</returns>
|
||||
public Axis MinAxis()
|
||||
/// <returns>The index of the lowest axis.</returns>
|
||||
public Axis MinAxisIndex()
|
||||
{
|
||||
return x < y ? Axis.X : Axis.Y;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Godot
|
|||
{
|
||||
/// <summary>
|
||||
/// Enumerated index values for the axes.
|
||||
/// Returned by <see cref="MaxAxis"/> and <see cref="MinAxis"/>.
|
||||
/// Returned by <see cref="MaxAxisIndex"/> and <see cref="MinAxisIndex"/>.
|
||||
/// </summary>
|
||||
public enum Axis
|
||||
{
|
||||
|
@ -364,21 +364,21 @@ namespace Godot
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the axis of the vector's largest value. See <see cref="Axis"/>.
|
||||
/// Returns the axis of the vector's highest value. See <see cref="Axis"/>.
|
||||
/// If all components are equal, this method returns <see cref="Axis.X"/>.
|
||||
/// </summary>
|
||||
/// <returns>The index of the largest axis.</returns>
|
||||
public Axis MaxAxis()
|
||||
/// <returns>The index of the highest axis.</returns>
|
||||
public Axis MaxAxisIndex()
|
||||
{
|
||||
return x < y ? (y < z ? Axis.Z : Axis.Y) : (x < z ? Axis.Z : Axis.X);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the axis of the vector's smallest value. See <see cref="Axis"/>.
|
||||
/// Returns the axis of the vector's lowest value. See <see cref="Axis"/>.
|
||||
/// If all components are equal, this method returns <see cref="Axis.Z"/>.
|
||||
/// </summary>
|
||||
/// <returns>The index of the smallest axis.</returns>
|
||||
public Axis MinAxis()
|
||||
/// <returns>The index of the lowest axis.</returns>
|
||||
public Axis MinAxisIndex()
|
||||
{
|
||||
return x < y ? (x < z ? Axis.X : Axis.Z) : (y < z ? Axis.Y : Axis.Z);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Godot
|
|||
{
|
||||
/// <summary>
|
||||
/// Enumerated index values for the axes.
|
||||
/// Returned by <see cref="MaxAxis"/> and <see cref="MinAxis"/>.
|
||||
/// Returned by <see cref="MaxAxisIndex"/> and <see cref="MinAxisIndex"/>.
|
||||
/// </summary>
|
||||
public enum Axis
|
||||
{
|
||||
|
@ -186,21 +186,21 @@ namespace Godot
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the axis of the vector's largest value. See <see cref="Axis"/>.
|
||||
/// Returns the axis of the vector's highest value. See <see cref="Axis"/>.
|
||||
/// If all components are equal, this method returns <see cref="Axis.X"/>.
|
||||
/// </summary>
|
||||
/// <returns>The index of the largest axis.</returns>
|
||||
public Axis MaxAxis()
|
||||
/// <returns>The index of the highest axis.</returns>
|
||||
public Axis MaxAxisIndex()
|
||||
{
|
||||
return x < y ? (y < z ? Axis.Z : Axis.Y) : (x < z ? Axis.Z : Axis.X);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the axis of the vector's smallest value. See <see cref="Axis"/>.
|
||||
/// Returns the axis of the vector's lowest value. See <see cref="Axis"/>.
|
||||
/// If all components are equal, this method returns <see cref="Axis.Z"/>.
|
||||
/// </summary>
|
||||
/// <returns>The index of the smallest axis.</returns>
|
||||
public Axis MinAxis()
|
||||
/// <returns>The index of the lowest axis.</returns>
|
||||
public Axis MinAxisIndex()
|
||||
{
|
||||
return x < y ? (x < z ? Axis.X : Axis.Z) : (y < z ? Axis.Y : Axis.Z);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue