阶跃函数

step函数:Generate a step function by comparing two values

For element i of the return value, 0.0 is returned if x[i] < edge[i], and 1.0 is returned otherwise.

edge specifies the location of the edge of the step function.

x specify the value to be used to generate the step function.

float step(float edge, float x);

平滑阶梯函数,平滑过渡函数

smoothstep函数:Perform Hermite interpolation between two values

    genType t;  /* Or genDType t; */t = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);return t * t * (3.0 - 2.0 * t);
inverse_smoothstep = 0.5 - sin(asin(1.0 - 2.0 * x) / 3.0);

edge0` specifies the value of the lower edge of the Hermite function.

edge1 specifies the value of the upper edge of the Hermite function.

x specifies the source value for interpolation.

float smoothstep(float edge0, float edge1 float x);

atan函数

atan会返回一个介于-PI到PI的弧度值(-3.14 to 3.14)

distance函数:

p0 specifies the first of two points

p1 specifies the second of two points

distance() returns the distance between the two points p0 and p1.

float distance(float p0, float p1);
float distance(vec2 p0, vec2 p1);
// The DISTANCE from the pixel to the center
pct = distance(st,vec2(0.5));
// The LENGTH of the vector from the pixel to the center ,vec2 toCenter = vec2(0.5)-st;
pct = length(toCenter);
// The SQUARE ROOT of the vector from the pixel to the center
vec2 tC = vec2(0.5)-st;
pct = sqrt(tC.x*tC.x+tC.y*tC.y);

以上三种情况得到的是一样的结果!

length函数

x specifies a vector of which to calculate the length.

length() returns the length of the vector.

float length(float x)
float length(vec2 x)
float length(vec3 x)
float length(vec4 x)

reflect:几何函数,根据入射方向和法向求反射方向

GLSL内置数学函数部分解析相关推荐

  1. 图解+笔记-python语言-第5章:数字/5.3 内置数字工具/5.3.2 内置数学函数

    内置数学函数: pow:运算次方 abs:求绝对值 round:四舍五入保留N位小数 >>> a=1.235 >>> round(a,2) 1.24 >> ...

  2. COMSOL中内置数学函数及内置运算符

    前言 最近想通过COMSOL实现一些比较高级的操作,就对内置数学函数和内置运算符相关章节的帮助文档进行了阅读.在COMSOL中使用各类算子及运算符能够在建模时起到很大的帮助,本文将对帮助文档中的相应章 ...

  3. python内置的数学函数_Python数字和内置数学函数

    python内置的数学函数 In this section, we will be learning about Numbers and various Math functions availabl ...

  4. python中内置数学函数详解和实例应用之三角函数_初级阶段(二)

    学习目标: 利用python进行三角函数运算 学习内容: python中的三角函数合集和应用实例 转载请注明出处! 学习产出: 环境:python 3.7, 利用shell进行实例操作. Note: ...

  5. python中内置数学函数详解和实例应用之三角函数曲线_初级阶段(三)

    学习目标: 利用matplotlib 和 numpy 画三角函数曲线 学习内容: 正弦,余弦,正切,余切函数曲线 双曲正弦,双曲余弦,双曲正切,双曲余切函数曲线 反正弦,反余弦,反正切,反余切函数曲线 ...

  6. python内置数学函数库_在没有任何内置的求值函数或外部库的情况下用python解决数学问题...

    有趣的问题,这里有一个潜在的解决方案.毫无疑问,您可以使用库或lambdas等来创建一个更优雅的解决方案,就像fourtheye在他们的答案中所做的那样,但是这似乎是有效的.在 我在底部做了一些测试用 ...

  7. VBA与Excel内置的函数

    了解VBA与Excel内置的函数,能够使我们处理起任务来事半功倍.这些函数不仅使用方便,而且效率一般都比较高(有些是例外的,特别是某些工作表函数),比我们自己写的要高效的多. VBA内置的函数 VBA ...

  8. 【Matlab入门】使用内置的函数和常量

    使用内置的函数和常量 基本函数 三角函数 atan(a/b):根据正切求角度,范围为[−π2,π2{-}\frac{\pi }{2},\frac{\pi }{2}−2π​,2π​] atan2(a,b ...

  9. Python培训分享:Python内置标准异常及其解析

    本期小编为大家带来的Python培训教程是关于"Python内置标准异常及其解析"的内容,我们都知道,在Python技术运作下,总会出现一些Python无法正常处理的程序时就会发生 ...

  10. javascript内置顶层函数

    javascript 内置顶层函数 名词解释: 1.函数 2.内置:  ECMAscript 内置函数:ECMAscript 自带的函数  Number() 宿主函数: BOM    DOM   al ...

最新文章

  1. 道家遁甲式(又名道家奇门)
  2. Swift之高德地图自定义标注弹出气泡样式
  3. 导致溢出_由整数类型溢出导致的英雄联盟峡谷惨案
  4. JNI----Native本地方法接口
  5. jQuery.extend()方法
  6. 什么是G1垃圾回收算法
  7. mysql ubuntu 17.04_1、mysql 5.7 ubuntu17.04
  8. 年轻人不讲武德不仅白piao接口测试知识还白piao接口测试工具会员
  9. override(C# 参考)
  10. 25 种代码坏味道总结+优化示例
  11. 缠中说禅电子书_缠中说禅作者的可怕之处
  12. xsd文件规则和语法
  13. 苏琴与机器人白正_一段知乎的元白
  14. java 龙卷风_龙卷风在大约37000个请求后停止响应
  15. 32位浮点数转十进制
  16. Ural 1671. Anansi's Cobweb(并查集)
  17. 10.JAVA中的集合(数据结构)
  18. hbuilder支持java插件_HBuilder 第三方插件开发
  19. 【_ 記 】SpringBoot注解 (最新最全最详细)
  20. 微信恢复大师免费版靠谱吗?微信恢复大师免费版下载

热门文章

  1. web点播VOD m3u8播放识别为live流 播放几个.ts切片停止播放 排错
  2. 【模型理解】KANO模型
  3. 【寻址方式】基地址与偏移地址的详细解释
  4. SL8100 3.6V~100V降压型大功率LED恒流驱动器
  5. 不需要死记硬背,看一遍就能记住单词的意思,一起了解单词背后的有趣故事(6)
  6. 平面波超声成像 (Matlab Filed II仿真)
  7. 通过银行卡号查询银行卡类型接口
  8. 8根网线的排序和作用
  9. 适合于初学者—软路由全探索系列(二):探索群晖 VMM 虚拟机旁路由安装及设置
  10. python 处理xml