Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Minecraft:Distance

From SAS Gaming Wiki

Template:See also

File:Taxicab vs euclidean.png
Taxicab distance compared to Euclidean distance. The two endpoints are also 3 and 4 blocks Chebyshev distance from the starting point.

Calculators/Distance

In Minecraft:Minecraft, the Minecraft:distance between two points is the measurement of how far apart the two points are. The sides of a Minecraft:block are considered to be 1 meter (3.28084 feet or Template:Frac feet) in length. Distance in the game is measured in one of three ways, Euclidean Euclidean distance, taxicab distance, or Chebyshev distance, depending on whether geometric accuracy or calculation efficiency is required.

In the following formulas, let two points in three dimensions have Minecraft:coordinates <math>(x_1, y_1, z_1)</math> and <math>(x_2, y_2, z_2)</math> and let <math>d</math> be the distance between them.

Euclidean distance

Euclidean distance, also known as straight-line distance, measures the distance between two points using the length of the line segment between them. It is calculated via the Template:W:

<math>d = \sqrt{(x_1 - x_2)^2 + (y_1 - y_2)^2 + (z_1 - z_2)^2}</math>

Spherical distance

The set of points within a given Euclidian distance, <math>d</math>, of some point, form a sphere with radius <math>d</math> centered at that point. This sphere is also referred to as a Euclidian sphere.

Usages

Minecraft:Minecraft uses Euclidean distance calculations in cases that are relatively infrequent or when accuracy is required. This is geometrically the most accurate calculation. However, the square root calculation is processor intensive, particularly on mobile devices that may have slow processors. Too many processor-intensive operations performed during a game tick can introduce lag in the game.

Situations in which Minecraft calculates Euclidean distance:

Taxicab distance

File:MinecraftTaxicab.png
Taxicab distance as represented by Minecraft blocks rather than city streets.

Taxicab distance, also known as rectilinear distance, city block distance, Manhattan distance, and other names, is a metric in Template:Wikipedia for measuring distance, as an alternative to Euclidean distance. It eliminates the square root and squaring operations by simply calculating the absolute value (positive value) of the difference between each coordinate value and is defined as:

<math>d = \left|x_1 - x_2\right| + \left|y_1 - y_2\right| + \left|z_1 - z_2\right|</math>

Usages

Minecraft uses taxicab distance as an efficient range measurement in several elements of the game as it is a less accurate but faster calculation that can be done many times during a Minecraft:game tick. An obvious consequence of this calculation is that a taxicab "circle" drawn with a constant taxicab radius appears as a square whose vertices are in the directions of the axes (such as torch illumination), in which the taxicab radius equals the Euclidean radius only in the four cardinal directions (north, south, east, west), and the radius is shorter in all other directions. Similarly, in three dimensions, a taxicab "sphere" appears as an Template:Wikipedia.

Situations in which Minecraft calculates taxicab distance:

Chebyshev distance

Chebyshev distance, also know as the chessboard distance or maximum metric, is the maximum absolute difference between two points in one of three axes:

<math>d=\max\left(| x_1-x_2 |, | y_1-y_2 |, | z_1-z_2 |\right)</math>

A "circle" drawn with a Chebyshev-distance radius would appear as an axis-aligned square, and a "sphere" would appear as a cube.

Usages

Computationally, Chebyshev distance is roughly as efficient as taxicab distance, but it is useful for effects that need to happen in a square area or cuboid volume from a center coordinate.

Situations in which Minecraft calculates Chebyshev distance:

  • Determining whether Minecraft:farmland is hydrated by a block of Minecraft:water in range of 4 blocks.
  • A villager in Java Edition detects an Minecraft:iron golem within ±16 blocks on any axis.
  • An iron golem in Bedrock Edition spawns within ±8 blocks horizontally and ±6 blocks vertically from the village center block.
  • The horizontal range of a Minecraft:beacon, which is 20, 30, 40 or 50 blocks depending on the size of the beacon pyramid.
  • Minecraft:Phantoms in Java Edition spawn 20–34 blocks above the player, and off to the side by a Chebyshev distance of up to 10 blocks.
  • The spawning range of Minecraft:wardens from naturally generated Minecraft:sculk shriekers is ±5 blocks horizontally and ±6 blocks vertically from the shrieker.
  • Template:IN, the load level of a Minecraft:chunk decreases in a square pattern.

See also

Navigation

Template:Navbox gameplay

Minecraft:ko:거리 Minecraft:pt:Distância Minecraft:ru:Расстояние Minecraft:uk:Відстань Minecraft:zh:距离

Contents