Calculates the distance between two points.
The version of dist() with four parameters calculates distance in two dimensions.
The version of dist() with six parameters calculates distance in three dimensions.
Use p5.Vector.dist() to calculate the distance between two p5.Vector objects.
示例
语法
dist(x1, y1, x2, y2)
dist(x1, y1, z1, x2, y2, z2)
参数
x1
Number:
x-coordinate of the first point.
y1
Number:
y-coordinate of the first point.
x2
Number:
x-coordinate of the second point.
y2
Number:
y-coordinate of the second point.
z1
Number:
z-coordinate of the first point.
z2
Number:
z-coordinate of the second point.
返回值
Number: distance between the two points.
This page is generated from the comments in src/math/calculation.js . Please feel free to edit it and submit a pull request!