qd-changjing/public/static/Build/Documentation/Intersections2D.html

1199 lines
65 KiB
HTML
Raw Normal View History

2022-07-05 16:56:29 +08:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Intersections2D - Cesium Documentation</title>
<!--[if lt IE 9]>
<script src="javascript/html5.js"></script>
<![endif]-->
<link href="styles/jsdoc-default.css" rel="stylesheet">
<link href="styles/prism.css" rel="stylesheet">
</head>
<body>
<div id="main">
<h1 class="page-title">
<a href="index.html"><img src="Images/CesiumLogo.png" class="cesiumLogo"></a>
Intersections2D
<div class="titleCenterer"></div>
</h1>
<section>
<header>
</header>
<article>
<div class="container-overview">
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Core/Intersections2D.js#L7">Core/Intersections2D.js 7</a>
</div>
<div class="description">Contains functions for operating on 2D triangles.</div>
<dl class="details">
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<div class="nameContainer">
<h4 class="name" id=".clipTriangleAtAxisAlignedThreshold">
<a href="#.clipTriangleAtAxisAlignedThreshold" class="doc-link"></a>
<span class="type-signature attribute-static">static</span> Cesium.Intersections2D.clipTriangleAtAxisAlignedThreshold<span class="signature">(threshold, keepAbove, u0, u1, u2, <span class="optional">result</span>)</span> &rarr; <span class="type-signature returnType">Array.&lt;Number></span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Core/Intersections2D.js#L40">Core/Intersections2D.js 40</a>
</div>
</h4>
</div>
<div class="description">
Splits a 2D triangle at given axis-aligned threshold value and returns the resulting
polygon on a given side of the threshold. The resulting polygon may have 0, 1, 2,
3, or 4 vertices.
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>threshold</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The threshold coordinate value at which to clip the triangle.</td>
</tr>
<tr>
<td class="name"><code>keepAbove</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="description last">
true to keep the portion of the triangle above the threshold, or false
to keep the portion below.</td>
</tr>
<tr>
<td class="name"><code>u0</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The coordinate of the first vertex in the triangle, in counter-clockwise order.</td>
</tr>
<tr>
<td class="name"><code>u1</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The coordinate of the second vertex in the triangle, in counter-clockwise order.</td>
</tr>
<tr>
<td class="name"><code>u2</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The coordinate of the third vertex in the triangle, in counter-clockwise order.</td>
</tr>
<tr>
<td class="name"><code>result</code></td>
<td class="type">
<span class="param-type">Array.&lt;Number></span>
</td>
<td class="description last">
<span class="optional">optional</span>
The array into which to copy the result. If this parameter is not supplied,
a new array is constructed and returned.</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
The polygon that results after the clip, specified as a list of
vertices. The vertices are specified in counter-clockwise order.
Each vertex is either an index from the existing list (identified as
a 0, 1, or 2) or -1 indicating a new vertex not in the original triangle.
For new vertices, the -1 is followed by three additional numbers: the
index of each of the two original vertices forming the line segment that
the new vertex lies on, and the fraction of the distance from the first
vertex to the second one.
</div>
<dl class="details">
<h5>Example:</h5>
<pre><code class="language-javascript">const result = Cesium.Intersections2D.clipTriangleAtAxisAlignedThreshold(0.5, false, 0.2, 0.6, 0.4);
// result === [2, 0, -1, 1, 0, 0.25, -1, 1, 2, 0.5]</code></pre>
</dl>
<div class="nameContainer">
<h4 class="name" id=".computeBarycentricCoordinates">
<a href="#.computeBarycentricCoordinates" class="doc-link"></a>
<span class="type-signature attribute-static">static</span> Cesium.Intersections2D.computeBarycentricCoordinates<span class="signature">(x, y, x1, y1, x2, y2, x3, y3, <span class="optional">result</span>)</span> &rarr; <span class="type-signature returnType"><a href="Cartesian3.html">Cartesian3</a></span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Core/Intersections2D.js#L236">Core/Intersections2D.js 236</a>
</div>
</h4>
</div>
<div class="description">
Compute the barycentric coordinates of a 2D position within a 2D triangle.
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>x</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The x coordinate of the position for which to find the barycentric coordinates.</td>
</tr>
<tr>
<td class="name"><code>y</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The y coordinate of the position for which to find the barycentric coordinates.</td>
</tr>
<tr>
<td class="name"><code>x1</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The x coordinate of the triangle's first vertex.</td>
</tr>
<tr>
<td class="name"><code>y1</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The y coordinate of the triangle's first vertex.</td>
</tr>
<tr>
<td class="name"><code>x2</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The x coordinate of the triangle's second vertex.</td>
</tr>
<tr>
<td class="name"><code>y2</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The y coordinate of the triangle's second vertex.</td>
</tr>
<tr>
<td class="name"><code>x3</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The x coordinate of the triangle's third vertex.</td>
</tr>
<tr>
<td class="name"><code>y3</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The y coordinate of the triangle's third vertex.</td>
</tr>
<tr>
<td class="name"><code>result</code></td>
<td class="type">
<span class="param-type"><a href="Cartesian3.html">Cartesian3</a></span>
</td>
<td class="description last">
<span class="optional">optional</span>
The instance into to which to copy the result. If this parameter
is undefined, a new instance is created and returned.</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
The barycentric coordinates of the position within the triangle.
</div>
<dl class="details">
<h5>Example:</h5>
<pre><code class="language-javascript">const result = Cesium.Intersections2D.computeBarycentricCoordinates(0.0, 0.0, 0.0, 1.0, -1, -0.5, 1, -0.5);
// result === new Cesium.Cartesian3(1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0);</code></pre>
</dl>
<div class="nameContainer">
<h4 class="name" id=".computeLineSegmentLineSegmentIntersection">
<a href="#.computeLineSegmentLineSegmentIntersection" class="doc-link"></a>
<span class="type-signature attribute-static">static</span> Cesium.Intersections2D.computeLineSegmentLineSegmentIntersection<span class="signature">(x00, y00, x01, y01, x10, y10, x11, y11, <span class="optional">result</span>)</span> &rarr; <span class="type-signature returnType"><a href="Cartesian2.html">Cartesian2</a></span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Core/Intersections2D.js#L313">Core/Intersections2D.js 313</a>
</div>
</h4>
</div>
<div class="description">
Compute the intersection between 2 line segments
</div>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>x00</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The x coordinate of the first line's first vertex.</td>
</tr>
<tr>
<td class="name"><code>y00</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The y coordinate of the first line's first vertex.</td>
</tr>
<tr>
<td class="name"><code>x01</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The x coordinate of the first line's second vertex.</td>
</tr>
<tr>
<td class="name"><code>y01</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The y coordinate of the first line's second vertex.</td>
</tr>
<tr>
<td class="name"><code>x10</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The x coordinate of the second line's first vertex.</td>
</tr>
<tr>
<td class="name"><code>y10</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The y coordinate of the second line's first vertex.</td>
</tr>
<tr>
<td class="name"><code>x11</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The x coordinate of the second line's second vertex.</td>
</tr>
<tr>
<td class="name"><code>y11</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last">
The y coordinate of the second line's second vertex.</td>
</tr>
<tr>
<td class="name"><code>result</code></td>
<td class="type">
<span class="param-type"><a href="Cartesian2.html">Cartesian2</a></span>
</td>
<td class="description last">
<span class="optional">optional</span>
The instance into to which to copy the result. If this parameter
is undefined, a new instance is created and returned.</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
The intersection point, undefined if there is no intersection point or lines are coincident.
</div>
<dl class="details">
<h5>Example:</h5>
<pre><code class="language-javascript">const result = Cesium.Intersections2D.computeLineSegmentLineSegmentIntersection(0.0, 0.0, 0.0, 2.0, -1, 1, 1, 1);
// result === new Cesium.Cartesian2(0.0, 1.0);</code></pre>
</dl>
</article>
</section>
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.10</a>
</footer>
</div>
<div class="nav">
<div class="menu">
<input type="text" class="classFilter" id="ClassFilter" placeholder="Search">
<ul id="ClassList"><li data-name="Animation"><a href="Animation.html">Animation</a></li><li data-name="AnimationViewModel"><a href="AnimationViewModel.html">AnimationViewModel</a></li><li data-name="Appearance"><a href="Appearance.html">Appearance</a></li><li data-name="ArcGisMapServerImageryProvider"><a href="ArcGisMapServerImageryProvider.html">ArcGisMapServerImageryProvider</a></li><li data-name="ArcGISTiledElevationTerrainProvider"><a href="ArcGISTiledElevationTerrainProvider.html">ArcGISTiledElevationTerrainProvider</a></li><li data-name="ArcType"><a href="global.html#ArcType">ArcType</a></li><li data-name="AssociativeArray"><a href="AssociativeArray.html">AssociativeArray</a></li><li data-name="Axis"><a href="global.html#Axis">Axis</a></li><li data-name="AxisAlignedBoundingBox"><a href="AxisAlignedBoundingBox.html">AxisAlignedBoundingBox</a></li><li data-name="backFaceCulling"><a href="global.html#backFaceCulling">backFaceCulling</a></li><li data-name="barycentricCoordinates"><a href="global.html#barycentricCoordinates">barycentricCoordinates</a></li><li data-name="BaseLayerPicker"><a href="BaseLayerPicker.html">BaseLayerPicker</a></li><li data-name="BaseLayerPickerViewModel"><a href="BaseLayerPickerViewModel.html">BaseLayerPickerViewModel</a></li><li data-name="Billboard"><a href="Billboard.html">Billboard</a></li><li data-name="BillboardCollection"><a href="BillboardCollection.html">BillboardCollection</a></li><li data-name="BillboardGraphics"><a href="BillboardGraphics.html">BillboardGraphics</a></li><li data-name="BillboardVisualizer"><a href="BillboardVisualizer.html">BillboardVisualizer</a></li><li data-name="binarySearch"><a href="global.html#binarySearch">binarySearch</a></li><li data-name="binarySearchComparator"><a href="global.html#binarySearchComparator">binarySearchComparator</a></li><li data-name="BingMapsGeocoderService"><a href="BingMapsGeocoderService.html">BingMapsGeocoderService</a></li><li data-name="BingMapsImageryProvider"><a href="BingMapsImageryProvider.html">BingMapsImageryProvider</a></li><li data-name="BingMapsStyle"><a href="global.html#BingMapsStyle">BingMapsStyle</a></li><li data-name="BlendEquation"><a href="global.html#BlendEquation">BlendEquation</a></li><li data-name="BlendFunction"><a href="global.html#BlendFunction">BlendFunction</a></li><li data-name="BlendingState"><a href="BlendingState.html">BlendingState</a></li><li data-name="BlendOption"><a href="global.html#BlendOption">BlendOption</a></li><li data-name="BoundingRectangle"><a href="BoundingRectangle.html">BoundingRectangle</a></li><li data-name="BoundingSphere"><a href="BoundingSphere.html">BoundingSphere</a></li><li data-name="boundingSphere"><a href="global.html#boundingSphere">boundingSphere</a></li><li data-name="BoxEmitter"><a href="BoxEmitter.html">BoxEmitter</a></li><li data-name="BoxGeometry"><a href="BoxGeometry.html">BoxGeometry</a></li><li data-name="BoxGeometryUpdater"><a href="BoxGeometryUpdater.html">BoxGeometryUpdater</a></li><li data-name="BoxGraphics"><a href="BoxGraphics.html">BoxGraphics</a></li><li data-name="BoxOutlineGeometry"><a href="BoxOutlineGeometry.html">BoxOutlineGeometry</a></li><li data-name="buildModuleUrl"><a href="global.html#buildModuleUrl">buildModuleUrl</a></li><li data-name="CallbackProperty"><a href="CallbackProperty.html">CallbackProperty</a></li><li data-name="Camera"><a href="Camera.html">Camera</a></li><li data-name="CameraEventAggregator"><a href="CameraEventAggregator.html">CameraEventAggregator</a></li><li data-name="CameraEventType"><a href="global.html#CameraEventType">CameraEventType</a></li><li data-name="cancelAnimationFrame"><a href="global.html#cancelAnimationFrame">cancelAnimationFrame</a></li><li data-name="Cartesian2"><a href="Cartesian2.html">Cartesian2</a></li><li data-name="Cartesian3"><a href="Cartesian3.html">Cartesian3</a></li><li data-name="Cartesian4"><a href="Cartesian4.html">Cartesian4</a></li><li data-name="Cartographic"><a href="Cartographic.html">Cartographic</a></li><li data-name="CartographicGeocoderService"><a href="CartographicGeocoderServic
</div>
</div>
<script>
if (window.frameElement) {
document.body.className = 'embedded';
var ele = document.createElement('a');
ele.className = 'popout';
ele.target = '_blank';
ele.href = window.location.href;
ele.title = 'Pop out';
document.getElementById('main').appendChild(ele);
}
// Set targets on external links. Sandcastle and GitHub shouldn't be embedded in any iframe.
Array.prototype.forEach.call(document.getElementsByTagName('a'), function(a) {
if (/^https?:/i.test(a.getAttribute('href'))) {
a.target='_blank';
}
});
</script>
<script src="javascript/prism.js"></script>
<script src="javascript/cesiumDoc.js"></script>
</body>
</html>