EllipsoidPrimitive

new EllipsoidPrimitive()

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 Default Description
options.center Cartesian3 Cartesian3.ZERO optional The center of the ellipsoid in the ellipsoid's model coordinates.
options.radii Cartesian3 optional The radius of the ellipsoid along the x, y, and z axes in the ellipsoid's model coordinates.
options.modelMatrix Matrix4 Matrix4.IDENTITY optional The 4x4 transformation matrix that transforms the ellipsoid from model to world coordinates.
options.show Boolean true optional Determines if this primitive will be shown.
options.material Material Material.ColorType optional The surface appearance of the primitive.
options.id Object optional A user-defined object to return when the instance is picked with Scene#pick
options.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 DrawCommand 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. This matrix is available to GLSL vertex and fragment shaders via czm_model and derived uniforms.
Default Value: Matrix4.IDENTITY
Example:
var origin = Cesium.Cartesian3.fromDegrees(-95.0, 40.0, 200000.0);
e.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(origin);
See:

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: