Wrapping (graphics)


Wrapping (graphics)

In computer graphics, wrapping is the process of limiting a position to an area. A good example of wrapping is wallpaper, a single pattern repeated indefinitely over a wall. Wrapping is used in 3D computer graphics to repeat a texture over a polygon, eliminating the need for large textures or multiple polygons.

To wrap a position "x" to an area of width "w", calculate the value x' equiv x pmod{w}.

Implementation

For computational purposes the wrapped value "x"' of "x" can be expressed as

:x' = x - lfloor (x - x_{min}) / (x_{max} - x_{min}) floor * (x_{max} - x_{min})

where x_{max} is the highest value in the range, and x_{min} is the lowest value in the range.

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;

ee also

*Clamping


Wikimedia Foundation. 2010.

Look at other dictionaries:

  • Wrapping — *Wrapping (overflow), a variable that exceeds its maximum value in computing *Wrapping (graphics), the process of limiting a position to an area in computer graphics *Wrapping paper, paper used for wrapping a gift *Word wrapping, a feature… …   Wikipedia

  • Texel (graphics) — A texel, or texture element (also texture pixel ) is the fundamental unit of texture space [Andrew Glassner, An Introduction to Ray Tracing , San Francisco: Morgan ndash;Kaufmann, 1989] , used in computer graphics. Textures are represented by… …   Wikipedia

  • Clamping (graphics) — 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: function clamp(X, Min …   Wikipedia

  • Texture mapping — Texture maps redirects here. For the 2003 ambient album, see Texture Maps: The Lost Pieces Vol. 3. 1 = 3D model without textures 2 = 3D model with textures Texture mapping is a method for adding detail, surface texture (a bitmap or raster image) …   Wikipedia

  • OpenGL — Original author(s) Silicon Graphics Developer(s) Khronos Group Stable release 4.2 …   Wikipedia

  • Comparison of OpenGL and Direct3D — Direct3D and OpenGL are competing application programming interfaces (APIs) which can be used in applications to render 2D and 3D computer graphics, taking advantage of hardware acceleration when available. Modern graphics processing unit (GPUs)… …   Wikipedia

  • HSL and HSV — Fig. 1. HSL (a–d) and HSV (e–h). Above (a, e): cut away 3D models of each. Below: two dimensional plots showing two of a model’s three parameters at once, holding the other constant: cylindrical shells (b, f) of constant saturation, in this case… …   Wikipedia

  • WinG — In computing, WinG (pronounced Win Gee ) was an API to provide faster graphics performance on Windows 3.1. WinG included API calls such as CreateDIBSection() , SetDIBColorTable() , BitBlt() , and StretchBlt() . WinG out of the box support (i.e.… …   Wikipedia

  • List of widget toolkits — Low level widget toolkits= Integrated in the operating system* The Mac OS toolbox, or Macintosh APIs, formerly located in ROM, but in new world Macs, on disk. A cleaned up version for Mac OS X is called Carbon. * The Windows API used in Microsoft …   Wikipedia

  • Adobe Photoshop — Photoshop redirects here. For other uses, see Photoshop (disambiguation). Adobe Photoshop Adobe Photoshop CS5 x64 running on …   Wikipedia