2015-04-18 14:41:34 +00:00
|
|
|
## Distance
|
|
|
|
Calculate the distance between two points
|
|
|
|
|
|
|
|
### Declaration
|
|
|
|
```glsl
|
|
|
|
float distance(float p0, float p1)
|
|
|
|
float distance(vec2 p0, vec2 p1)
|
|
|
|
float distance(vec3 p0, vec3 p1)
|
|
|
|
float distance(vec4 p0, vec4 p1)
|
|
|
|
```
|
|
|
|
|
|
|
|
### Parameters
|
|
|
|
```p0``` specifies the first of two points
|
|
|
|
|
|
|
|
```p1``` specifies the second of two points
|
|
|
|
|
|
|
|
### Description
|
|
|
|
```distance()``` returns the distance between the two points ```p0``` and ```p1```.
|
|
|
|
|
|
|
|
<div class="codeAndCanvas" data="../07/circle-making.frag"></div>
|
|
|
|
|
|
|
|
### See Also
|
|
|
|
|
2016-04-06 15:44:45 +00:00
|
|
|
[length()](/glossary/?search=length), [normalize()](/glossary/?search=normalize), [Chapter 07: Shapes](/07/)
|