EllipsoidPrimitive

new EllipsoidPrimitive(options)

A renderable ellipsoid. It can also draw spheres when the three EllipsoidPrimitive#radii components are equal.

This is only supported in 3D. The ellipsoid is not shown in 2D or Columbus view.

Name Type Description
options Object optional Object with the following properties:
Name Type Default Description
center Cartesian3 Cartesian3.ZERO optional The center of the ellipsoid in the ellipsoid's model coordinates.
radii Cartesian3 optional The radius of the ellipsoid along the x, y, and z axes in the ellipsoid's model coordinates.
modelMatrix Matrix4 Matrix4.IDENTITY optional The 4x4 transformation matrix that transforms the ellipsoid from model to world coordinates.
show Boolean true optional Determines if this primitive will be shown.
material Material Material.ColorType optional The surface appearance of the primitive.
id Object optional A user-defined object to return when the instance is picked with Scene#pick
debugShowBoundingVolume Boolean false optional For debugging only. Determines if this primitive's commands' bounding spheres are shown.
Examples:
// 1. Create a sphere using the ellipsoid primitive
primitives.add(new Cesium.EllipsoidPrimitive({
  center : Cesium.Cartesian3.fromDegrees(-75.0, 40.0, 500000.0),
  radii : new Cesium.Cartesian3(500000.0, 500000.0, 500000.0)
}));
// 2. Create a tall ellipsoid in an east-north-up reference frame
var e = new Cesium.EllipsoidPrimitive();
e.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(
  Cesium.Cartesian3.fromDegrees(-95.0, 40.0, 200000.0));
e.radii = new Cesium.Cartesian3(100000.0, 100000.0, 200000.0);
primitives.add(e);
Demo:

Members

center :Cartesian3

The center of the ellipsoid in the ellipsoid's model coordinates.

The default is Cartesian3.ZERO.

Default Value: Cartesian3.ZERO
See:

debugShowBoundingVolume :Boolean

This property is for debugging only; it is not for production use nor is it optimized.

Draws the bounding sphere for each draw command in the primitive.

Default Value: false

id :Object

User-defined object returned when the ellipsoid is picked.
Default Value: undefined
See:

material :Material

The surface appearance of the ellipsoid. This can be one of several built-in Material objects or a custom material, scripted with Fabric.

The default material is Material.ColorType.

Default Value: Material.fromType(Material.ColorType)
Example:
// 1. Change the color of the default material to yellow
e.material.uniforms.color = new Cesium.Color(1.0, 1.0, 0.0, 1.0);

// 2. Change material to horizontal stripes
e.material = Cesium.Material.fromType(Material.StripeType);
See:

modelMatrix :Matrix4

The 4x4 transformation matrix that transforms the ellipsoid from model to world coordinates. When this is the identity matrix, the ellipsoid is drawn in world coordinates, i.e., Earth's WGS84 coordinates. Local reference frames can be used by providing a different transformation matrix, like that returned by Transforms.eastNorthUpToFixedFrame.
Default Value: Matrix4.IDENTITY
Example:
var origin = Cesium.Cartesian3.fromDegrees(-95.0, 40.0, 200000.0);
e.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(origin);

radii :Cartesian3

The radius of the ellipsoid along the x, y, and z axes in the ellipsoid's model coordinates. When these are the same, the ellipsoid is a sphere.

The default is undefined. The ellipsoid is not drawn until a radii is provided.

Default Value: undefined
Example:
// A sphere with a radius of 2.0
e.radii = new Cesium.Cartesian3(2.0, 2.0, 2.0);
See:

show :Boolean

Determines if the ellipsoid primitive will be shown.
Default Value: true

Methods

destroy()undefined

Destroys the WebGL resources held by this object. Destroying an object allows for deterministic release of WebGL resources, instead of relying on the garbage collector to destroy this object.

Once an object is destroyed, it should not be used; calling any function other than isDestroyed will result in a DeveloperError exception. Therefore, assign the return value (undefined) to the object as done in the example.
Returns:
Throws:
  • DeveloperError : This object was destroyed, i.e., destroy() was called.
Example:
e = e && e.destroy();
See:

isDestroyed()Boolean

Returns true if this object was destroyed; otherwise, false.

If this object was destroyed, it should not be used; calling any function other than isDestroyed will result in a DeveloperError exception.
Returns:
true if this object was destroyed; otherwise, false.
See:

update()

Called when Viewer or CesiumWidget render the scene to get the draw commands needed to render this primitive.

Do not call this function directly. This is documented just to list the exceptions that may be propagated when the scene is rendered:

Throws: