[add] polar function. this function calculates polar coordinates.

This commit is contained in:
yoichi kobayashi 2017-01-26 14:44:10 +09:00
parent 7552f81aa8
commit 8863f97e4c
2 changed files with 21 additions and 1 deletions

View File

@ -9,7 +9,8 @@ npm i git://github.com/ykob/glsl-util.git
```
## convertHsvToRgb and convertRgbToHsv
this is the function that convetts RGB to HSV. or is its opposite.
this function converts RGB to HSV. or is its opposite.
### Quote source
@ -29,3 +30,14 @@ http://lolengine.net/blog/2013/07/27/rgb-to-hsv-in-glsl
```
#pragma glslify: random = require(glsl-util/random);
```
## polar
this function calculates polar coordinates.
### usage
```
#pragma glslify: polar = require(glsl-util/polar);
vec3 p = polar(float radian1, float radian2, float radius);
```

8
polar.glsl Normal file
View File

@ -0,0 +1,8 @@
vec3 polar(float radian1, float radian2, float radius) {
return vec3(
cos(radian1) * cos(radian2) * radius,
sin(radian1) * radius,
cos(radian1) * sin(radian2) * radius,
)
}
#pragma glslify: export(polar)