Lut.html 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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>Code Example</h2>
  15. <code>
  16. const lut = new Lut( 'rainbow', 512 );
  17. const color = lut.getColor( 0.5 );
  18. </code>
  19. <h2>Constructor</h2>
  20. <h3>[name]( [param:String colormap], [param:Number count] )</h3>
  21. <p>
  22. colormap - Sets a colormap from predefined colormaps. Available colormaps are: `rainbow`, `cooltowarm`, `blackbody`, `grayscale`. Default is `rainbow`.<br />
  23. count - Sets the number of colors used to represent the data array. Default is `32`.
  24. </p>
  25. <h2>Properties</h2>
  26. <h3>[property:Array lut]</h3>
  27. <p>
  28. The lookup table for the selected color map represented as an array of [page:Color]s.
  29. </p>
  30. <h3>[property:Array map]</h3>
  31. <p>
  32. The currently selected color map. Default is the `rainbow` color map.
  33. </p>
  34. <h3>[property:Number minV]</h3>
  35. <p>
  36. The minimum value to be represented with the lookup table. Default is *0*.
  37. </p>
  38. <h3>[property:Number maxV]</h3>
  39. <p>
  40. The maximum value to be represented with the lookup table. Default is *1*.
  41. </p>
  42. <h3>[property:Number n]</h3>
  43. <p>
  44. The number of colors of the current selected color map. Default is `32`.
  45. </p>
  46. <h2>Methods</h2>
  47. <h3>[method:this copy]( [param:Lut lut] ) [param:Lut this]</h3>
  48. <p>
  49. color — Lut to copy.
  50. </p>
  51. <p>
  52. Copies the given lut.
  53. </p>
  54. <h3>[method:this addColorMap]( [param:String name], [param:Array arrayOfColors] )</h3>
  55. <p>
  56. name — The name of the color map.<br />
  57. arrayOfColors — An array of color values. Each value is an array holding a threshold and the actual color value as a hexadecimal number.
  58. </p>
  59. <p>
  60. Adds a color map to this [name] instance.
  61. </p>
  62. <h3>[method:HTMLCanvasElement createCanvas]()</h3>
  63. <p>
  64. Creates a canvas in order to visualize the lookup table as a texture.
  65. </p>
  66. <h3>[method:Color getColor]( [param:Number alpha] )</h3>
  67. <p>
  68. value -- the data value to be displayed as a color.
  69. </p>
  70. <p>
  71. Returns an instance of [page:Color] for the given data value.
  72. </p>
  73. <h3>[method:this setColorMap]( [param:String colormap], [param:Number count] )</h3>
  74. <p>
  75. colormap — The name of the color map.<br />
  76. count — The number of colors. Default is `32`.
  77. </p>
  78. <p>
  79. Configure the lookup table for the given color map and number of colors.
  80. </p>
  81. <h3>[method:this setMin]( [param:Number minV] )</h3>
  82. <p>
  83. minV — The minimum value to be represented with the lookup table
  84. </p>
  85. <p>
  86. Sets this Lut with the minimum value to be represented.
  87. </p>
  88. <h3>[method:this setMax]( [param:Number maxV] )</h3>
  89. <p>
  90. maxV — The maximum value to be represented with the lookup table.
  91. </p>
  92. <p>
  93. Sets this Lut with the maximum value to be represented.
  94. </p>
  95. <h3>[method:HTMLCanvasElement updateCanvas]( [param:HTMLCanvasElement canvas] )</h3>
  96. <p>
  97. Updates the canvas with the [name]'s data.
  98. </p>
  99. <h2>Source</h2>
  100. <p>
  101. [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/math/Lut.js examples/jsm/math/Lut.js]
  102. </p>
  103. </body>
  104. </html>