Lut.html 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <!DOCTYPE html>
  2. <html lang="zh">
  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. 表示颜色表的查找表,用于从一个数据值的范围中确定颜色值。
  13. </p>
  14. <h2>代码示例</h2>
  15. <code>
  16. const lut = new Lut( 'rainbow', 512 );
  17. const color = lut.getColor( 0.5 );
  18. </code>
  19. <h2>构造函数</h2>
  20. <h3>[name]( colormap, numberOfColors )</h3>
  21. <p>
  22. colormap - (可选)从预定义的颜色表中设置一个颜色表。可选值有:"rainbow"、 "cooltowarm"、 "blackbody"。
  23. numberOfColors - (可选)设置用于表示数据数组的颜色数量。
  24. </p>
  25. <h2>属性</h2>
  26. <h3>[property:Float minV]</h3>
  27. <p>
  28. 查找表所表示的最小值,默认为0。
  29. </p>
  30. <h3>[property:Float maxV]</h3>
  31. <p>
  32. 查找表所表示的最小值,默认为1。
  33. </p>
  34. <h3>.[legend]</h3>
  35. <p>
  36. 查找表的图例。
  37. </p>
  38. <h2>方法</h2>
  39. <h3>[method:null copy]( [param:Lut lut] ) [param:Lut this]</h3>
  40. <p>
  41. color — 要拷贝的 Lut。
  42. </p>
  43. <p>
  44. 拷贝给定的 Lut。
  45. </p>
  46. <h3>.setLegendOn [parameters]</h3>
  47. <p>
  48. parameters - { layout: value, position: { x: value, y: value, z: value }, dimensions: { width: value, height: value } }
  49. layout — Horizontal or vertical layout. Default is vertical.<br />
  50. position — The position x,y,z of the legend.<br />
  51. dimensions — The dimensions (width and height) of the legend.<br />
  52. </p>
  53. <p>
  54. Sets this Lut with the legend on.
  55. </p>
  56. <h3>.setLegendOff</h3>
  57. <p>
  58. </p>
  59. <p>
  60. Sets this Lut with the legend off.
  61. </p>
  62. <h3>.setLegendLabels [parameters, callback]</h3>
  63. <p>
  64. parameters - { fontsize: value, fontface: value, title: value, um: value, ticks: value, decimal: value, notation: value }
  65. fontsize — Font size to be used for labels.<br />
  66. fontface — Font type to be used for labels.<br />
  67. title — The title of the legend.<br />
  68. um — The unit of measurements of the legend.<br />
  69. ticks — The number of ticks to be displayed.<br />
  70. decimal — The number of decimals to be used for legend values.<br />
  71. notation — Legend notation: standard (default) or scientific.<br />
  72. callback — An optional callback to be used to format the legend labels.<br />
  73. </p>
  74. <p>
  75. Sets the labels of the legend of this Lut.
  76. </p>
  77. <h3>[method:Lut setMin]( [param:Float minV] )</h3>
  78. <p>
  79. minV — 查找表所表示的最小值。<br />
  80. </p>
  81. <p>
  82. 将查找表要表示的最小值设为该值。
  83. </p>
  84. <h3>[method:Lut setMax]( [param:Float maxV] )</h3>
  85. <p>
  86. maxV — 查找表所表示的最小值。<br />
  87. </p>
  88. <p>
  89. 将查找表要表示的最大值设为该值。
  90. </p>
  91. <h3>[method:Lut changeNumberOfColors]( [param:Float numberOfColors] )</h3>
  92. <p>
  93. numberOfColors — 用于表示数据数组的颜色数量。<br />
  94. </p>
  95. <p>
  96. 设置查找表中要使用的颜色的数量。
  97. </p>
  98. <h3>[method:Lut changeColorMap]( [param:Float colorMap] )</h3>
  99. <p>
  100. colorMap — 用于表示数据数组的颜色表名称。<br />
  101. </p>
  102. <p>
  103. 设置查找表的颜色表为传入的颜色表。
  104. </p>
  105. <h3>[method:Lut addColorMap]( colorMapName, arrayOfColors )</h3>
  106. <p>
  107. 插入一个新的颜色表到可用颜色表中。
  108. </p>
  109. <h3>[method:Lut getColor]( value ) [param:Lut this]</h3>
  110. <p>
  111. value -- 作为颜色展示的数据值。
  112. </p>
  113. <p>
  114. 返回一个[page:Color]。
  115. </p>
  116. <h2>源码</h2>
  117. <p>
  118. [link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/math/Lut.js examples/jsm/math/Lut.js]
  119. </p>
  120. </body>
  121. </html>