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

894 lines
63 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>Geometry - 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>
Geometry
<div class="titleCenterer"></div>
</h1>
<section>
<header>
</header>
<article>
<div class="container-overview">
<div class="nameContainer">
<h4 class="name" id="Geometry">
<a href="#Geometry" class="doc-link"></a>
new Cesium.Geometry<span class="signature">(options)</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Core/Geometry.js#L67">Core/Geometry.js 67</a>
</div>
</h4>
</div>
<div class="description">
A geometry representation with attributes forming vertices and optional index data
defining primitives. Geometries and an <a href="Appearance.html"><code>Appearance</code></a>, which describes the shading,
can be assigned to a <a href="Primitive.html"><code>Primitive</code></a> for visualization. A <code>Primitive</code> can
be created from many heterogeneous - in many cases - geometries for performance.
<p>
Geometries can be transformed and optimized using functions in <a href="GeometryPipeline.html"><code>GeometryPipeline</code></a>.
</p>
</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>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">
Object with the following properties:
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>attributes</code></td>
<td class="type">
<span class="param-type"><a href="GeometryAttributes.html">GeometryAttributes</a></span>
</td>
<td class="default">
</td>
<td class="description last">
Attributes, which make up the geometry's vertices.</td>
</tr>
<tr>
<td class="name"><code>primitiveType</code></td>
<td class="type">
<span class="param-type"><a href="global.html#PrimitiveType">PrimitiveType</a></span>
</td>
<td class="default">
<code class="language-javascript">PrimitiveType.TRIANGLES</code>
</td>
<td class="description last">
<span class="optional">optional</span>
The type of primitives in the geometry.</td>
</tr>
<tr>
<td class="name"><code>indices</code></td>
<td class="type">
<span class="param-type">Uint16Array</span>
|
<span class="param-type">Uint32Array</span>
</td>
<td class="default">
</td>
<td class="description last">
<span class="optional">optional</span>
Optional index data that determines the primitives in the geometry.</td>
</tr>
<tr>
<td class="name"><code>boundingSphere</code></td>
<td class="type">
<span class="param-type"><a href="BoundingSphere.html">BoundingSphere</a></span>
</td>
<td class="default">
</td>
<td class="description last">
<span class="optional">optional</span>
An optional bounding sphere that fully enclosed the geometry.</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<dl class="details">
<h5>Example:</h5>
<pre><code class="language-javascript">// Create geometry with a position attribute and indexed lines.
const positions = new Float64Array([
0.0, 0.0, 0.0,
7500000.0, 0.0, 0.0,
0.0, 7500000.0, 0.0
]);
const geometry = new Cesium.Geometry({
attributes : {
position : new Cesium.GeometryAttribute({
componentDatatype : Cesium.ComponentDatatype.DOUBLE,
componentsPerAttribute : 3,
values : positions
})
},
indices : new Uint16Array([0, 1, 1, 2, 2, 0]),
primitiveType : Cesium.PrimitiveType.LINES,
boundingSphere : Cesium.BoundingSphere.fromVertices(positions)
});</code></pre>
<h5>Demo:</h5>
<ul class="see-list">
<li><a href="https://sandcastle.cesium.com/index.html?src=Geometry%2520and%2520Appearances.html">Geometry and Appearances Demo</a></li>
</ul>
<h5>See:</h5>
<ul class="see-list">
<li><a href="PolygonGeometry.html">PolygonGeometry</a></li>
<li><a href="RectangleGeometry.html">RectangleGeometry</a></li>
<li><a href="EllipseGeometry.html">EllipseGeometry</a></li>
<li><a href="CircleGeometry.html">CircleGeometry</a></li>
<li><a href="WallGeometry.html">WallGeometry</a></li>
<li><a href="SimplePolylineGeometry.html">SimplePolylineGeometry</a></li>
<li><a href="BoxGeometry.html">BoxGeometry</a></li>
<li><a href="EllipsoidGeometry.html">EllipsoidGeometry</a></li>
</ul>
</dl>
</div>
<h3 class="subsection-title">Members</h3>
<div class="nameContainer">
<h4 class="name" id="attributes">
<a href="#attributes" class="doc-link"></a>
attributes<span class="type-signature"> : <a href="GeometryAttributes.html">GeometryAttributes</a></span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Core/Geometry.js#L120">Core/Geometry.js 120</a>
</div>
</h4>
</div>
<div class="description">
Attributes, which make up the geometry's vertices. Each property in this object corresponds to a
<a href="GeometryAttribute.html"><code>GeometryAttribute</code></a> containing the attribute's data.
<p>
Attributes are always stored non-interleaved in a Geometry.
</p>
<p>
There are reserved attribute names with well-known semantics. The following attributes
are created by a Geometry (depending on the provided <a href="VertexFormat.html"><code>VertexFormat</code></a>.
<ul>
<li><code>position</code> - 3D vertex position. 64-bit floating-point (for precision). 3 components per attribute. See <a href="VertexFormat.html#position"><code>VertexFormat#position</code></a>.</li>
<li><code>normal</code> - Normal (normalized), commonly used for lighting. 32-bit floating-point. 3 components per attribute. See <a href="VertexFormat.html#normal"><code>VertexFormat#normal</code></a>.</li>
<li><code>st</code> - 2D texture coordinate. 32-bit floating-point. 2 components per attribute. See <a href="VertexFormat.html#st"><code>VertexFormat#st</code></a>.</li>
<li><code>bitangent</code> - Bitangent (normalized), used for tangent-space effects like bump mapping. 32-bit floating-point. 3 components per attribute. See <a href="VertexFormat.html#bitangent"><code>VertexFormat#bitangent</code></a>.</li>
<li><code>tangent</code> - Tangent (normalized), used for tangent-space effects like bump mapping. 32-bit floating-point. 3 components per attribute. See <a href="VertexFormat.html#tangent"><code>VertexFormat#tangent</code></a>.</li>
</ul>
</p>
<p>
The following attribute names are generally not created by a Geometry, but are added
to a Geometry by a <a href="Primitive.html"><code>Primitive</code></a> or <a href="GeometryPipeline.html"><code>GeometryPipeline</code></a> functions to prepare
the geometry for rendering.
<ul>
<li><code>position3DHigh</code> - High 32 bits for encoded 64-bit position computed with <a href="GeometryPipeline.html#.encodeAttribute"><code>GeometryPipeline.encodeAttribute</code></a>. 32-bit floating-point. 4 components per attribute.</li>
<li><code>position3DLow</code> - Low 32 bits for encoded 64-bit position computed with <a href="GeometryPipeline.html#.encodeAttribute"><code>GeometryPipeline.encodeAttribute</code></a>. 32-bit floating-point. 4 components per attribute.</li>
<li><code>position3DHigh</code> - High 32 bits for encoded 64-bit 2D (Columbus view) position computed with <a href="GeometryPipeline.html#.encodeAttribute"><code>GeometryPipeline.encodeAttribute</code></a>. 32-bit floating-point. 4 components per attribute.</li>
<li><code>position2DLow</code> - Low 32 bits for encoded 64-bit 2D (Columbus view) position computed with <a href="GeometryPipeline.html#.encodeAttribute"><code>GeometryPipeline.encodeAttribute</code></a>. 32-bit floating-point. 4 components per attribute.</li>
<li><code>color</code> - RGBA color (normalized) usually from <code>GeometryInstance#color</code>. 32-bit floating-point. 4 components per attribute.</li>
<li><code>pickColor</code> - RGBA color used for picking. 32-bit floating-point. 4 components per attribute.</li>
</ul>
</p>
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">undefined</code>
<h5>Example:</h5>
<pre><code class="language-javascript">geometry.attributes.position = new Cesium.GeometryAttribute({
componentDatatype : Cesium.ComponentDatatype.FLOAT,
componentsPerAttribute : 3,
values : new Float32Array(0)
});</code></pre>
<h5>See:</h5>
<ul class="see-list">
<li><a href="GeometryAttribute.html">GeometryAttribute</a></li>
<li><a href="VertexFormat.html">VertexFormat</a></li>
</ul>
</dl>
<div class="nameContainer">
<h4 class="name" id="boundingSphere">
<a href="#boundingSphere" class="doc-link"></a>
boundingSphere<span class="type-signature"> : <a href="BoundingSphere.html">BoundingSphere</a></span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Core/Geometry.js#L153">Core/Geometry.js 153</a>
</div>
</h4>
</div>
<div class="description">
An optional bounding sphere that fully encloses the geometry. This is
commonly used for culling.
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">undefined</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="indices">
<a href="#indices" class="doc-link"></a>
indices<span class="type-signature"> : Array</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Core/Geometry.js#L130">Core/Geometry.js 130</a>
</div>
</h4>
</div>
<div class="description">
Optional index data that - along with <a href="Geometry.html#primitiveType"><code>Geometry#primitiveType</code></a> -
determines the primitives in the geometry.
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">undefined</code>
</dl>
<div class="nameContainer">
<h4 class="name" id="primitiveType">
<a href="#primitiveType" class="doc-link"></a>
primitiveType<span class="type-signature"> : <a href="global.html#PrimitiveType">PrimitiveType</a></span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Core/Geometry.js#L140">Core/Geometry.js 140</a>
</div>
</h4>
</div>
<div class="description">
The type of primitives in the geometry. This is most often <a href="global.html#PrimitiveType#.TRIANGLES"><code>PrimitiveType.TRIANGLES</code></a>,
but can varying based on the specific geometry.
</div>
<dl class="details">
<span class="details-header">Default Value:</span>
<code class="language-javascript">undefined</code>
</dl>
<h3 class="subsection-title">Methods</h3>
<div class="nameContainer">
<h4 class="name" id=".computeNumberOfVertices">
<a href="#.computeNumberOfVertices" class="doc-link"></a>
<span class="type-signature attribute-static">static</span> Cesium.Geometry.computeNumberOfVertices<span class="signature">(geometry)</span> &rarr; <span class="type-signature returnType">Number</span>
<div class="source-link rightLinks">
<a href="https://github.com/CesiumGS/cesium/blob/1.91/Source/Core/Geometry.js#L182">Core/Geometry.js 182</a>
</div>
</h4>
</div>
<div class="description">
Computes the number of vertices in a geometry. The runtime is linear with
respect to the number of attributes in a vertex, not the number of 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>geometry</code></td>
<td class="type">
<span class="param-type"><a href="Geometry.html">Geometry</a></span>
</td>
<td class="description last">
The geometry.</td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="param-desc">
The number of vertices in the geometry.
</div>
<dl class="details">
<h5>Example:</h5>
<pre><code class="language-javascript">const numVertices = Cesium.Geometry.computeNumberOfVertices(geometry);</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>