Wrapping (graphics)
In computer graphics, wrapping is the process of limiting a position to an area.[src] A good example of wrapping is wallpaper, a single pattern repeated indefinitely over a wall.[src] Wrapping is used in 3D computer graphics to repeat a texture over a polygon, eliminating the need for large textures or multiple polygons.[src] To wrap a position x to an area of width w, calculate the value x' = x \text{ mod } w .[src]
In computer graphics, wrapping is the process of limiting a position to an area.[src] A good example of wrapping is wallpaper, a single pattern repeated indefinitely over a wall.[src] Wrapping is used in 3D computer graphics to repeat a texture over a polygon, eliminating the need for large textures or multiple polygons.[src] To wrap a position x to an area of width w, calculate the value x' = x \text{ mod } w .[src] ==Implementation== For computational purposes the wrapped value x of x can be expressed as x' = x - \lfloor (x - x_{\text{min}}) / (x_{\text{max}} - x_{\text{min}}) \rfloor \cdot (x_{\text{max}} - x_{\text{min}}) where x_{\text{max}} is the highest value in the range, and x_{\text{min}} is the lowest value in the range.[src] Pseudocode for wrapping of a value to a range other than 0–1 is function wrap(X, Min, Max: Real): Real; X := X - Int((X - Min) / (Max - Min)) * (Max - Min); if X < 0 then // This corrects the problem caused by using Int instead of Floor X := X + Max - Min; return X; Pseudocode for wrapping of a value to a range of 0–1 is function wrap(X: Real): Real; X := X - Int(X); if X < 0 then X := X + 1; return X; Pseudocode for wrapping of a value to a range of 0–1 without branching is, function wrap(X: Real): Real; return ((X mod 1.0) + 1.0) mod 1.0; ==References==[src]
10 sentences · 10 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Wrapping (graphics)." encyclopegia.org, 2026, https://encyclopegia.org/wiki/wrapping-graphics. Accessed 06 December 2026.
Chicago
"Wrapping (graphics)." encyclopegia.org. Accessed December 6, 2026. https://encyclopegia.org/wiki/wrapping-graphics.
APA
encyclopegia.org. (2026). Wrapping (graphics). Retrieved December 6, 2026, from https://encyclopegia.org/wiki/wrapping-graphics
Accessed December 6, 2026 · CC BY-SA 4.0 · citation page · JSON