You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
141 lines
3.2 KiB
HTML
141 lines
3.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh">
|
|
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<base href="../../../" />
|
|
<script src="page.js"></script>
|
|
<link type="text/css" rel="stylesheet" href="page.css" />
|
|
</head>
|
|
|
|
<body>
|
|
<h1>查找表([name])</h1>
|
|
|
|
<p class="desc">
|
|
表示色彩映射的查找表。它用于从一系列数据值中确定颜色值。
|
|
</p>
|
|
|
|
<h2>导入</h2>
|
|
|
|
<p>
|
|
[name] 是一个附加组件,必须显式导入。请参阅 [link:#manual/introduction/Installation Installation / Addons]。
|
|
</p>
|
|
|
|
<code>
|
|
import { Lut } from 'three/addons/math/Lut.js';
|
|
</code>
|
|
|
|
<h2>代码示例</h2>
|
|
|
|
<code>
|
|
const lut = new Lut( 'rainbow', 512 );
|
|
const color = lut.getColor( 0.5 );
|
|
</code>
|
|
|
|
<h2>构造函数</h2>
|
|
|
|
|
|
<h3>[name]( [param:String colormap], [param:Number count] )</h3>
|
|
<p>
|
|
colormap - 设置预定义色彩映射中的一个。可用的色彩映射有:`rainbow`, `cooltowarm`, `blackbody`,
|
|
`grayscale`。 默认为 `rainbow`。<br />
|
|
count - 设置用于表示数据数组的颜色数量。默认为 `32`。
|
|
</p>
|
|
|
|
<h2>属性</h2>
|
|
|
|
<h3>[property:Array lut]</h3>
|
|
<p>
|
|
所选颜色映射的查找表,表示为 [page:Color] 数组。
|
|
</p>
|
|
|
|
<h3>[property:Array map]</h3>
|
|
<p>
|
|
当前选择的颜色映射。默认是 `rainbow`。
|
|
</p>
|
|
|
|
<h3>[property:Number minV]</h3>
|
|
<p>
|
|
用查找表表示的最小值。默认值为 *0*。
|
|
</p>
|
|
|
|
<h3>[property:Number maxV]</h3>
|
|
<p>
|
|
用查找表表示的最大值。默认值为 *1*。
|
|
</p>
|
|
|
|
<h3>[property:Number n]</h3>
|
|
<p>
|
|
当前所选颜色映射的颜色数。默认为 `32`。
|
|
</p>
|
|
|
|
<h2>方法</h2>
|
|
|
|
<h3>[method:this copy]( [param:Lut lut] ) [param:Lut this]</h3>
|
|
<p>
|
|
color — Lut 复制。
|
|
</p>
|
|
<p>
|
|
复制给定的 lut。
|
|
</p>
|
|
|
|
<h3>[method:this addColorMap]( [param:String name], [param:Array arrayOfColors] )</h3>
|
|
<p>
|
|
name — 颜色映射的名称。<br />
|
|
arrayOfColors — 颜色值数组。每个值都是一个数组,其中包含阈值和十六进制数形式的实际颜色值。
|
|
</p>
|
|
<p>
|
|
将一个颜色映射添加到此 [name] 实例。
|
|
</p>
|
|
|
|
<h3>[method:HTMLCanvasElement createCanvas]()</h3>
|
|
<p>
|
|
创建一个画布以将查找表可视化为纹理。
|
|
</p>
|
|
|
|
<h3>[method:Color getColor]( [param:Number alpha] )</h3>
|
|
<p>
|
|
value -- 要显示为颜色的数据值。
|
|
</p>
|
|
<p>
|
|
返回给定数据值的 [page:Color] 实例。
|
|
</p>
|
|
|
|
<h3>[method:this setColorMap]( [param:String colormap], [param:Number count] )</h3>
|
|
<p>
|
|
colormap — 颜色映射的名称。<br />
|
|
count — 颜色的数量。默认为 `32`。
|
|
</p>
|
|
<p>
|
|
为给定的颜色映射和颜色数量配置查找表。
|
|
</p>
|
|
|
|
<h3>[method:this setMin]( [param:Number minV] )</h3>
|
|
<p>
|
|
minV — 用查找表表示的最小值
|
|
</p>
|
|
<p>
|
|
设置此 [name] 的表示最小值。
|
|
</p>
|
|
|
|
<h3>[method:this setMax]( [param:Number maxV] )</h3>
|
|
<p>
|
|
maxV — 用查找表表示的最大值。
|
|
</p>
|
|
<p>
|
|
设置此 [name] 的表示最大值。
|
|
</p>
|
|
|
|
<h3>[method:HTMLCanvasElement updateCanvas]( [param:HTMLCanvasElement canvas] )</h3>
|
|
<p>
|
|
使用 [name] 的数据更新画布。
|
|
</p>
|
|
|
|
<h2>源代码</h2>
|
|
|
|
<p>
|
|
[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/math/Lut.js examples/jsm/math/Lut.js]
|
|
</p>
|
|
</body>
|
|
|
|
</html> |