请输入您要查询的百科知识:

 

词条 Clamping (graphics)
释义

  1. Uses

  2. References

{{Refimprove|date=December 2009}}

In computer graphics, clamping is the process of limiting a position to an area. Unlike wrapping, clamping merely moves the point to the nearest available value.

To put clamping into perspective, pseudocode for clamping is as follows:

 '''function''' clamp(x, min, max):     '''if''' (x < min) '''then'''         x = min;     '''else if''' (x > max) '''then'''         x = max;     '''return''' x; '''end''' clamp
Pseudocode (clamping):

Uses

In general, clamping is used to restrict a value to a given range. For example, in OpenGL the glClearColor function takes four GLfloat values which are then 'clamped' to the range .[1]

One of the many uses of clamping in computer graphics is the placing of a detail inside a polygon—for example, a bullet hole on a wall. It can also be used with wrapping to create a variety of effects.

References

1. ^{{Cite web|url=https://www.khronos.org/registry/OpenGL-Refpages/gl4/|title=OpenGL 4 Reference Pages|website=www.khronos.org|access-date=2018-10-31}}
{{DEFAULTSORT:Clamping (Graphics)}}{{Compu-graphics-stub}}

2 : Computer graphics algorithms|Articles with example pseudocode

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/17 6:09:59