| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>Lut - Three.js Docs</title>
- <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
- <script src="../scripts/highlight.min.js"></script>
- <link type="text/css" rel="stylesheet" href="../styles/highlight-three.css">
- <link type="text/css" rel="stylesheet" href="../styles/page.css">
- </head>
- <body>
- <h1 translate="no">Lut</h1>
- <section>
- <header>
- <div class="class-description"><p>Represents a lookup table for colormaps. It is used to determine the color
- values from a range of data values.</p></div>
- <h2>Code Example</h2>
- <div translate="no"><pre><code class="language-js">const lut = new Lut( 'rainbow', 512 );
- const color = lut.getColor( 0.5 );
- </code></pre></div>
- </header>
- <article>
- <h2 class="subsection-title">Import</h2>
- <p><span translate="no">Lut</span> is an addon, and must be imported explicitly, see <a href="https://threejs.org/manual/#en/installation" target="_blank" rel="noopener">Installation#Addons</a>.</p>
- <pre><code class="language-js">import { Lut } from 'three/addons/math/Lut.js';</code></pre>
- <div class="container-overview">
- <h2>Constructor</h2>
- <h3 class="name name-method" id="Lut" translate="no">new <a href="#Lut">Lut</a><span class="signature">( colormap : <span class="param-type">'rainbow' | 'cooltowarm' | 'blackbody' | 'grayscale'</span>, count : <span class="param-type">number</span> )</span> </h3>
- <div class="method">
- <div class="description">
- <p>Constructs a new Lut.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>colormap</strong>
- </td>
- <td class="description last">
- <p>Sets a colormap from predefined list of colormaps.</p>
- <p>Default is <code>'rainbow'</code>.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>count</strong>
- </td>
- <td class="description last">
- <p>Sets the number of colors used to represent the data array.</p>
- <p>Default is <code>32</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- <h2 class="subsection-title">Properties</h2>
- <div class="member">
- <h3 class="name" id="isLut" translate="no">.<a href="#isLut">isLut</a><span class="type-signature"> : boolean</span> <span class="type-signature">(readonly) </span></h3>
- <div class="description">
- <p>This flag can be used for type testing.</p>
- <p>Default is <code>true</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="lut" translate="no">.<a href="#lut">lut</a><span class="type-signature"> : Array.<<a href="Color.html">Color</a>></span> </h3>
- <div class="description">
- <p>The lookup table for the selected color map</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="map" translate="no">.<a href="#map">map</a><span class="type-signature"> : Array.<Array.<number>></span> </h3>
- <div class="description">
- <p>The currently selected color map.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="maxV" translate="no">.<a href="#maxV">maxV</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>The maximum value to be represented with the lookup table.</p>
- <p>Default is <code>1</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="minV" translate="no">.<a href="#minV">minV</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>The minimum value to be represented with the lookup table.</p>
- <p>Default is <code>0</code>.</p>
- </div>
- </div>
- <div class="member">
- <h3 class="name" id="n" translate="no">.<a href="#n">n</a><span class="type-signature"> : number</span> </h3>
- <div class="description">
- <p>The number of colors of the current selected color map.</p>
- <p>Default is <code>32</code>.</p>
- </div>
- </div>
- <h2 class="subsection-title">Methods</h2>
- <h3 class="name name-method" id="addColorMap" translate="no">.<a href="#addColorMap">addColorMap</a><span class="signature">( name : <span class="param-type">string</span>, arrayOfColors : <span class="param-type">Array.<Array.<number>></span> )</span><span class="type-signature"> : <a href="Lut.html">Lut</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Adds a color map to this Lut instance.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>name</strong>
- </td>
- <td class="description last">
- <p>The name of the color map.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>arrayOfColors</strong>
- </td>
- <td class="description last">
- <p>An array of color values. Each value is an array
- holding a threshold and the actual color value as a hexadecimal number.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this LUT.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="copy" translate="no">.<a href="#copy">copy</a><span class="signature">( lut : <span class="param-type"><a href="Lut.html">Lut</a></span> )</span><span class="type-signature"> : <a href="Lut.html">Lut</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Copies the given lut.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>lut</strong>
- </td>
- <td class="description last">
- <p>The LUT to copy.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this LUT.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="createCanvas" translate="no">.<a href="#createCanvas">createCanvas</a><span class="signature">()</span><span class="type-signature"> : HTMLCanvasElement</span> </h3>
- <div class="method">
- <div class="description">
- <p>Creates a canvas in order to visualize the lookup table as a texture.</p>
- </div>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The created canvas.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="getColor" translate="no">.<a href="#getColor">getColor</a><span class="signature">( alpha : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Color.html">Color</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Returns an instance of Color for the given data value.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>alpha</strong>
- </td>
- <td class="description last">
- <p>The value to lookup.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The color from the LUT.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="set" translate="no">.<a href="#set">set</a><span class="signature">( value : <span class="param-type"><a href="Lut.html">Lut</a></span> )</span><span class="type-signature"> : <a href="Lut.html">Lut</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the given LUT.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>value</strong>
- </td>
- <td class="description last">
- <p>The LUT to set.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this LUT.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setColorMap" translate="no">.<a href="#setColorMap">setColorMap</a><span class="signature">( colormap : <span class="param-type">string</span>, count : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Lut.html">Lut</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Configure the lookup table for the given color map and number of colors.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>colormap</strong>
- </td>
- <td class="description last">
- <p>The name of the color map.</p>
- </td>
- </tr>
- <tr>
- <td class="name">
- <strong>count</strong>
- </td>
- <td class="description last">
- <p>The number of colors.</p>
- <p>Default is <code>32</code>.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this LUT.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setMax" translate="no">.<a href="#setMax">setMax</a><span class="signature">( max : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Lut.html">Lut</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the maximum value to be represented with this LUT.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>max</strong>
- </td>
- <td class="description last">
- <p>The maximum value to be represented with the lookup table.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this LUT.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="setMin" translate="no">.<a href="#setMin">setMin</a><span class="signature">( min : <span class="param-type">number</span> )</span><span class="type-signature"> : <a href="Lut.html">Lut</a></span> </h3>
- <div class="method">
- <div class="description">
- <p>Sets the minimum value to be represented with this LUT.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>min</strong>
- </td>
- <td class="description last">
- <p>The minimum value to be represented with the lookup table.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> A reference to this LUT.</dt>
- </dl>
- </div>
- <h3 class="name name-method" id="updateCanvas" translate="no">.<a href="#updateCanvas">updateCanvas</a><span class="signature">( canvas : <span class="param-type">HTMLCanvasElement</span> )</span><span class="type-signature"> : HTMLCanvasElement</span> </h3>
- <div class="method">
- <div class="description">
- <p>Updates the given canvas with the Lut's data.</p>
- </div>
- <table class="params">
- <tbody>
- <tr>
- <td class="name">
- <strong>canvas</strong>
- </td>
- <td class="description last">
- <p>The canvas to update.</p>
- </td>
- </tr>
- </tbody>
- </table>
- <dl class="details">
- <dt class="tag-returns"><strong>Returns:</strong> The updated canvas.</dt>
- </dl>
- </div>
- <h2 class="subsection-title">Source</h2>
- <p>
- <a href="https://github.com/mrdoob/three.js/blob/master/examples/jsm/math/Lut.js" translate="no" target="_blank" rel="noopener">examples/jsm/math/Lut.js</a>
- </p>
- </article>
- </section>
- <script src="../scripts/linenumber.js"></script>
- <script src="../scripts/page.js"></script>
- </body>
- </html>
|