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.

174 lines
6.2 KiB
HTML

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!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">
在三维空间中无限延伸的二维平面,平面方程用单位长度的法向量和常数表示为海塞法向量[link:http://mathworld.wolfram.com/HessianNormalForm.html Hessian normal form]形式。
</p>
<h2>构造器Constructor</h2>
<h3>[name]( [param:Vector3 normal], [param:Float constant] )</h3>
<p>
[page:Vector3 normal] - (可选参数) 定义单位长度的平面法向量[page:Vector3]。默认值为 *(1, 0, 0)*。<br />
[page:Float constant] - (可选参数) 从原点到平面的有符号距离。 默认值为 *0*.
</p>
<h2>属性Properties</h2>
<h3>[property:Boolean isPlane]</h3>
<p>
只读属性,用于检查给定对象是否为[name]类型。
</p>
<h3>[property:Vector3 normal]</h3>
<h3>[property:Float constant]</h3>
<h2>方法Methods</h2>
<h3>[method:this applyMatrix4]( [param:Matrix4 matrix], [param:Matrix3 optionalNormalMatrix] )</h3>
<p>
[page:Matrix4 matrix] - 要应用的四位矩阵([Page:Matrix4])。<br />
[page:Matrix3 optionalNormalMatrix] - (可选参数) 预先计算好的上述Matrix4参数的法线矩阵 [Page:Matrix3]。<br /><br />
在平面上应用矩阵。矩阵必须是仿射齐次变换。<br />
如果提供一个optionalNormalMatrix可以这样创建:
<code>
const optionalNormalMatrix = new THREE.Matrix3().getNormalMatrix( matrix );
</code>
</p>
<h3>[method:Plane clone]()</h3>
<p>返回一个与当前平面有相同法线 [page:.normal normal],常量 [page:.constant constant] 距离的平面。</p>
<h3>[method:Vector3 coplanarPoint]( [param:Vector3 target] )</h3>
<p>
[page:Vector3 target] — 结果会拷贝到该向量中。<br /><br />
返回一个共面点,通过原点的法向量在平面上投影算得。
</p>
<h3>[method:this copy]( [param:Plane plane] )</h3>
<p>
拷贝给定平面,将其中的法线 [page:.normal normal],距离常量 [page:.constant constant]属性拷贝给该对象。
</p>
<h3>[method:Float distanceToPoint]( [param:Vector3 point] )</h3>
<p>返回点[page:Vector3 point]到平面的有符号距离。</p>
<h3>[method:Float distanceToSphere]( [param:Sphere sphere] )</h3>
<p>返回球面 [page:Sphere sphere] 的边缘到平面的最短距离。</p>
<h3>[method:Boolean equals]( [param:Plane plane] )</h3>
<p>
检查两个平面是否相等。(法线 [page:.normal normal] 以及常量 [page:.constant constant] 都相同)。
</p>
<h3>[method:Vector3 intersectLine]( [param:Line3 line], [param:Vector3 target] )</h3>
<p>
[page:Line3 line] - 检测是否相交的三维几何线段 [page:Line3]。<br />
[page:Vector3 target] — 结果将会写入该向量中。<br /><br />
返回给定线段和平面的交点。如果不相交则返回null。如果线与平面共面则返回该线段的起始点。
</p>
<h3>[method:Boolean intersectsBox]( [param:Box3 box] )</h3>
<p>
[page:Box3 box] - 检查是否相交的包围盒 [page:Box3]。<br /><br />
确定该平面是否与给定3d包围盒[page:Box3]相交。
</p>
<h3>[method:Boolean intersectsLine]( [param:Line3 line] )</h3>
<p>
[page:Line3 line] - 检查是否相交的三维线段 [page:Line3]。<br /><br />
测试线段是否与平面相交。
</p>
<h3>[method:Boolean intersectsSphere]( [param:Sphere sphere] )</h3>
<p>
[page:Sphere sphere] - 检查是否相交的球体 [page:Sphere]。<br /><br />
确定该平面是否与给定球体 [page:Sphere] 相交。
</p>
<h3>[method:this negate]()</h3>
<p>
将法向量与常量求反(乘以-1
</p>
<h3>[method:this normalize]()</h3>
<p>
归一化法向量 [page:.normal normal] ,并相应的调整常量 [page:.constant constant]数值。
</p>
<h3>[method:Vector3 projectPoint]( [param:Vector3 point], [param:Vector3 target] )</h3>
<p>
[page:Vector3 point] - 需要投射到该平面的点。<br />
[page:Vector3 target] — 在该平面上离投射点最近的点。<br /><br />
将一个点[page:Vector3 point]投射到该平面上。
</p>
<h3>[method:this set]( [param:Vector3 normal], [param:Float constant] )</h3>
<p>
[page:Vector3 normal] - 单位长度的向量表示平面的法向量。<br />
[page:Float constant] - 原点到平面有符号距离。<br /><br />
设置平面 [page:.normal normal] 的法线和常量 [page:.constant constant] 属性值。
</p>
<h3>[method:this setComponents]( [param:Float x], [param:Float y], [param:Float z], [param:Float w] )</h3>
<p>
[page:Float x] - 单位长度法向量的x值。<br />
[page:Float y] - 单位长度法向量的y值。<br />
[page:Float z] - 单位长度法向量的z值。<br />
[page:Float w] - 原点沿法向量到平面常量 [page:.constant constant] 距离。<br /><br />
设置定义平面的各个变量。
</p>
<h3>[method:this setFromCoplanarPoints]( [param:Vector3 a], [param:Vector3 b], [param:Vector3 c] )</h3>
<p>
[page:Vector3 a] - 用于确定平面的第一个点。<br />
[page:Vector3 b] - 用于确定平面的第二个点。<br />
[page:Vector3 c] - 用于确定平面的第三个点。<br /><br />
根据给定的三个点确定平面。如果三个点共线将会抛出错误。通过右手螺旋规则确定(向量叉乘)法向量 [page:.normal normal]。
</p>
<h3>[method:this setFromNormalAndCoplanarPoint]( [param:Vector3 normal], [param:Vector3 point] )</h3>
<p>
[page:Vector3 normal] - 平面单位法向量<br />
[page:Vector3 point] - 平面上的点<br /><br />
通过参数提供的法线 normal 和 平面上的一个点 point 来设置该平面。
</p>
<h3>[method:this translate]( [param:Vector3 offset] )</h3>
<p>
[page:Vector3 offset] - 平移量<br /><br />
将平面平移给定向量大小,注意:这只会影响平面的常量不会影响平面的法向量。
</p>
<h2>Source</h2>
<p>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</p>
</body>
</html>