Document the Vec3d class (#2341)

* Document the Vec3d class

* oops

* reverseSubtract -> relativize

* Update mappings/net/minecraft/util/math/Vec3d.mapping

* Update mappings/net/minecraft/util/math/Vec3d.mapping

Co-authored-by: liach <7806504+liach@users.noreply.github.com>

* Update mappings/net/minecraft/util/math/Vec3d.mapping

Co-authored-by: liach <7806504+liach@users.noreply.github.com>

* Update mappings/net/minecraft/util/math/Vec3d.mapping

Co-authored-by: liach <7806504+liach@users.noreply.github.com>

* Fix typo

* Fix doc (squared distance)

Co-authored-by: liach <7806504+liach@users.noreply.github.com>
This commit is contained in:
enbrain 2021-04-24 18:15:45 +09:00 committed by GitHub
parent 90d97a00af
commit 7ad5228217
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 136 additions and 6 deletions

View File

@ -1,4 +1,7 @@
CLASS net/minecraft/class_2374 net/minecraft/util/math/Position
METHOD method_10214 getY ()D
COMMENT Returns the Y coordinate.
METHOD method_10215 getZ ()D
COMMENT Returns the Z coordinate.
METHOD method_10216 getX ()D
COMMENT Returns the X coordinate.

View File

@ -1,81 +1,208 @@
CLASS net/minecraft/class_243 net/minecraft/util/math/Vec3d
COMMENT An immutable vector composed of 3 doubles.
COMMENT
COMMENT <p>This vector class is used for representing position, velocity,
COMMENT rotation, color, etc.
COMMENT
COMMENT <p>This vector has proper {@link #hashCode()} and {@link #equals(Object)}
COMMENT implementations and can be used as a map key.
COMMENT
COMMENT @see Vec3i
COMMENT @see Vec3f
FIELD field_1350 z D
COMMENT The Z coordinate of this vector.
FIELD field_1351 y D
COMMENT The Y coordinate of this vector.
FIELD field_1352 x D
COMMENT The X coordinate of this vector.
FIELD field_1353 ZERO Lnet/minecraft/class_243;
COMMENT The zero vector (0, 0, 0).
METHOD <init> (DDD)V
COMMENT Creates a vector of the given coordinates.
ARG 1 x
ARG 3 y
ARG 5 z
METHOD <init> (Lnet/minecraft/class_1160;)V
COMMENT Copies the given vector.
ARG 1 vec
METHOD equals (Ljava/lang/Object;)Z
ARG 1 o
METHOD method_1019 add (Lnet/minecraft/class_243;)Lnet/minecraft/class_243;
COMMENT Returns the sum of this vector and the given vector.
COMMENT
COMMENT @see #add(double, double, double)
ARG 1 vec
METHOD method_1020 subtract (Lnet/minecraft/class_243;)Lnet/minecraft/class_243;
COMMENT Subtracts the given vector from this vector.
COMMENT
COMMENT @see #subtract(double, double, double)
COMMENT @see #relativize(Vec3d)
COMMENT @return the difference between this vector and the given vector
ARG 1 vec
METHOD method_1021 multiply (D)Lnet/minecraft/class_243;
ARG 1 mult
COMMENT Return a vector whose coordinates are the coordinates of this vector
COMMENT each multiplied by the given scalar value.
COMMENT
COMMENT @see #multiply(Vec3d)
COMMENT @see #multiply(double, double, double)
ARG 1 value
METHOD method_1022 distanceTo (Lnet/minecraft/class_243;)D
COMMENT Returns the distance between this vector and the given vector.
COMMENT
COMMENT @see #squaredDistanceTo(Vec3d)
ARG 1 vec
METHOD method_1023 subtract (DDD)Lnet/minecraft/class_243;
COMMENT Subtracts the given vector from this vector.
COMMENT
COMMENT @see #relativize(Vec3d)
COMMENT @return the difference between this vector and the given vector
ARG 1 x
ARG 3 y
ARG 5 z
METHOD method_1024 rotateY (F)Lnet/minecraft/class_243;
COMMENT Rotates this vector by the given angle counterclockwise around the Y axis.
ARG 1 angle
COMMENT the angle in radians
METHOD method_1025 squaredDistanceTo (Lnet/minecraft/class_243;)D
COMMENT Returns the squared distance between this vector and the given vector.
COMMENT
COMMENT <p>Can be used for fast comparison between distances.
COMMENT
COMMENT @see #squaredDistanceTo(double, double, double)
COMMENT @see #distanceTo(Vec3d)
ARG 1 vec
METHOD method_1026 dotProduct (Lnet/minecraft/class_243;)D
COMMENT Returns the dot product of this vector and the given vector.
ARG 1 vec
METHOD method_1027 lengthSquared ()D
COMMENT Returns the squared length of this vector.
COMMENT
COMMENT <p>Can be used for fast comparison between lengths.
COMMENT
COMMENT @see #length()
METHOD method_1028 squaredDistanceTo (DDD)D
COMMENT Returns the squared distance between this vector and the given vector.
COMMENT
COMMENT <p>Can be used for fast comparison between distances.
COMMENT
COMMENT @see #squaredDistanceTo(Vec3d)
COMMENT @see #distanceTo(Vec3d)
ARG 1 x
ARG 3 y
ARG 5 z
METHOD method_1029 normalize ()Lnet/minecraft/class_243;
COMMENT Normalizes this vector.
COMMENT
COMMENT <p>Normalized vector is a vector with the same direction but with
COMMENT length 1. Each coordinate of normalized vector has value between 0
COMMENT and 1.
COMMENT
COMMENT @return the normalized vector of this vector
METHOD method_1030 fromPolar (FF)Lnet/minecraft/class_243;
COMMENT Converts pitch and yaw into a direction vector.
COMMENT
COMMENT @see #fromPolar(Vec2f)
ARG 0 pitch
ARG 1 yaw
METHOD method_1031 add (DDD)Lnet/minecraft/class_243;
COMMENT Returns the sum of this vector and the given vector.
COMMENT
COMMENT @see #add(Vec3d)
ARG 1 x
ARG 3 y
ARG 5 z
METHOD method_1032 floorAlongAxes (Ljava/util/EnumSet;)Lnet/minecraft/class_243;
COMMENT Applies the floor function to the coordinates chosen by the given axes.
ARG 1 axes
METHOD method_1033 length ()D
COMMENT Returns the length of this vector.
COMMENT
COMMENT <p>The length of a vector is equivalent to the distance between that
COMMENT vector and the {@linkplain #ZERO} vector.
COMMENT
COMMENT @see #lengthSquared()
METHOD method_1034 fromPolar (Lnet/minecraft/class_241;)Lnet/minecraft/class_243;
COMMENT Converts pitch and yaw into a direction vector.
COMMENT
COMMENT @see #fromPolar(float, float)
ARG 0 polar
METHOD method_1035 reverseSubtract (Lnet/minecraft/class_243;)Lnet/minecraft/class_243;
COMMENT the vector composed of pitch and yaw
METHOD method_1035 relativize (Lnet/minecraft/class_243;)Lnet/minecraft/class_243;
COMMENT Subtracts this vector from the given vector.
COMMENT
COMMENT @see #subtract(Vec3d)
COMMENT @return the difference between the given vector and this vector
ARG 1 vec
METHOD method_1036 crossProduct (Lnet/minecraft/class_243;)Lnet/minecraft/class_243;
COMMENT Returns the cross product of this vector and the given vector.
ARG 1 vec
METHOD method_1037 rotateX (F)Lnet/minecraft/class_243;
COMMENT Rotates this vector by the given angle counterclockwise around the X axis.
ARG 1 angle
COMMENT the angle in radians
METHOD method_18043 getComponentAlongAxis (Lnet/minecraft/class_2350$class_2351;)D
COMMENT Returns the coordinate chosen by the given axis.
ARG 1 axis
METHOD method_18805 multiply (DDD)Lnet/minecraft/class_243;
ARG 1 multX
ARG 3 multY
ARG 5 multZ
COMMENT Returns a vector whose coordinates are the product of each pair of
COMMENT coordinates in this vector and the given vector.
COMMENT
COMMENT @see #multiply(Vec3d)
COMMENT @see #multiply(double)
ARG 1 x
ARG 3 y
ARG 5 z
METHOD method_18806 multiply (Lnet/minecraft/class_243;)Lnet/minecraft/class_243;
ARG 1 mult
COMMENT Returns a vector whose coordinates are the product of each pair of
COMMENT coordinates in this vector and the given vector.
COMMENT
COMMENT @see #multiply(double, double, double)
COMMENT @see #multiply(double)
ARG 1 vec
METHOD method_22882 negate ()Lnet/minecraft/class_243;
COMMENT Creates a vector with the same length but with the opposite direction.
METHOD method_24457 unpackRgb (I)Lnet/minecraft/class_243;
COMMENT Converts a packed RGB color into a vector of (red, green, blue).
COMMENT
COMMENT @return the vector representing the given color; each coordinate has
COMMENT value between 0 and 1
ARG 0 rgb
COMMENT the color in the 0xRRGGBB format
METHOD method_24802 isInRange (Lnet/minecraft/class_2374;D)Z
COMMENT Checks if the distance between this vector and the given position is
COMMENT less than {@code radius}.
ARG 1 pos
ARG 2 radius
METHOD method_24953 ofCenter (Lnet/minecraft/class_2382;)Lnet/minecraft/class_243;
COMMENT Creates a vector representing the center of the given block position.
ARG 0 vec
METHOD method_24954 of (Lnet/minecraft/class_2382;)Lnet/minecraft/class_243;
COMMENT Copies the given vector.
ARG 0 vec
METHOD method_24955 ofBottomCenter (Lnet/minecraft/class_2382;)Lnet/minecraft/class_243;
COMMENT Creates a vector representing the bottom center of the given block
COMMENT position.
COMMENT
COMMENT <p>The bottom center of a block position {@code pos} is
COMMENT {@code (pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5)}.
COMMENT
COMMENT @see #ofCenter(Vec3i)
ARG 0 vec
METHOD method_26410 ofCenter (Lnet/minecraft/class_2382;D)Lnet/minecraft/class_243;
COMMENT Creates a vector representing the center of the given block position but
COMMENT with the given offset for the Y coordinate.
COMMENT
COMMENT @return a vector of {@code (vec.getX() + 0.5, vec.getY() + deltaY,
COMMENT vec.getZ() + 0.5)}
ARG 0 vec
ARG 1 deltaY
METHOD method_31033 rotateZ (F)Lnet/minecraft/class_243;
COMMENT Rotates this vector by the given angle counterclockwise around the Z axis.
ARG 1 angle
COMMENT the angle in radians
METHOD method_35590 lerp (Lnet/minecraft/class_243;D)Lnet/minecraft/class_243;
COMMENT Performs linear interpolation from this vector to the given vector.
ARG 1 to
COMMENT the vector to interpolate to
ARG 2 delta
COMMENT the interpolation coefficient in the range between 0 and 1