1
0

Lut.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. <h1>[name]</h1>
  11. <p class="desc">
  12. Represents a lookup table for colormaps. It is used to determine the color values from a range of data values.
  13. </p>
  14. <h2>Import</h2>
  15. <p>
  16. [name] is an add-on, and must be imported explicitly.
  17. See [link:#manual/introduction/Installation Installation / Addons].
  18. </p>
  19. <code>
  20. import { Lut } from 'three/addons/math/Lut.js';
  21. </code>
  22. <h2>Code Example</h2>
  23. <code>
  24. const lut = new Lut( 'rainbow', 512 );
  25. const color = lut.getColor( 0.5 );
  26. </code>
  27. <h2>Constructor</h2>
  28. <h3>[name]( [param:String colormap], [param:Number count] )</h3>
  29. <p>
  30. colormap - Sets a colormap from predefined colormaps. Available colormaps are: `rainbow`, `cooltowarm`, `blackbody`, `grayscale`. Default is `rainbow`.<br />
  31. count - Sets the number of colors used to represent the data array. Default is `32`.
  32. </p>
  33. <h2>Properties</h2>
  34. <h3>[property:Array lut]</h3>
  35. <p>
  36. The lookup table for the selected color map represented as an array of [page:Color]s.
  37. </p>
  38. <h3>[property:Array map]</h3>
  39. <p>
  40. The currently selected color map. Default is the `rainbow` color map.
  41. </p>
  42. <h3>[property:Number minV]</h3>
  43. <p>
  44. The minimum value to be represented with the lookup table. Default is *0*.
  45. </p>
  46. <h3>[property:Number maxV]</h3>
  47. <p>
  48. The maximum value to be represented with the lookup table. Default is *1*.
  49. </p>
  50. <h3>[property:Number n]</h3>
  51. <p>
  52. The number of colors of the current selected color map. Default is `32`.
  53. </p>
  54. <h2>Methods</h2>
  55. <h3>[method:this copy]( [param:Lut lut] ) [param:Lut this]</h3>
  56. <p>
  57. color — Lut to copy.
  58. </p>
  59. <p>
  60. Copies the given lut.
  61. </p>
  62. <h3>[method:this addColorMap]( [param:String name], [param:Array arrayOfColors] )</h3>
  63. <p>
  64. name — The name of the color map.<br />
  65. arrayOfColors — An array of color values. Each value is an array holding a threshold and the actual color value as a hexadecimal number.
  66. </p>
  67. <p>
  68. Adds a color map to this [name] instance.
  69. </p>
  70. <h3>[method:HTMLCanvasElement createCanvas]()</h3>
  71. <p>
  72. Creates a canvas in order to visualize the lookup table as a texture.
  73. </p>
  74. <h3>[method:Color getColor]( [param:Number alpha] )</h3>
  75. <p>
  76. value -- the data value to be displayed as a color.
  77. </p>
  78. <p>
  79. Returns an instance of [page:Color] for the given data value.
  80. </p>
  81. <h3>[method:this setColorMap]( [param:String colormap], [param:Number count] )</h3>
  82. <p>
  83. colormap — The name of the color map.<br />
  84. count — The number of colors. Default is `32`.
  85. </p>
  86. <p>
  87. Configure the lookup table for the given color map and number of colors.
  88. </p>
  89. <h3>[method:this setMin]( [param:Number minV] )</h3>
  90. <p>
  91. minV — The minimum value to be represented with the lookup table
  92. </p>
  93. <p>
  94. Sets this Lut with the minimum value to be represented.
  95. </p>
  96. <h3>[method:this setMax]( [param:Number maxV] )</h3>
  97. <p>
  98. maxV — The maximum value to be represented with the lookup table.
  99. </p>
  100. <p>
  101. Sets this Lut with the maximum value to be represented.
  102. </p>
  103. <h3>[method:HTMLCanvasElement updateCanvas]( [param:HTMLCanvasElement canvas] )</h3>
  104. <p>
  105. Updates the canvas with the [name]'s data.
  106. </p>
  107. <h2>Source</h2>
  108. <p>
  109. [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/math/Lut.js examples/jsm/math/Lut.js]
  110. </p>
  111. </body>
  112. </html>