EllipsoidPrimitive

EllipsoidPrimitive

new

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.

Parameters:
Name Type Argument Default Description
options.center Cartesian3 <optional>
Cartesian3.ZERO The center of the ellipsoid in the ellipsoid's model coordinates.
options.radii Cartesian3 <optional>
undefined The radius of the ellipsoid along the x, y, and z axes in the ellipsoid's model coordinates.
options.modelMatrix Matrix4 <optional>
Matrix4.IDENTITY The 4x4 transformation matrix that transforms the ellipsoid from model to world coordinates.
options.show Boolean <optional>
true Determines if this primitive will be shown.
options.material Material <optional>
Material.ColorType The surface appearance of the primitive.
options.id Object <optional>
undefined A user-defined object to return when the instance is picked with Scene#pick
options.debugShowBoundingVolume Boolean <optional>
false 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 EllipsoidPrimitive({
  center : ellipsoid.cartographicToCartesian(
    Cartographic.fromDegrees(-75.0, 40.0, 500000.0)),
  radii : new Cartesian3(500000.0, 500000.0, 500000.0)
}));
// 2. Create a tall ellipsoid in an east-north-up reference frame
var e = new EllipsoidPrimitive();
e.modelMatrix = Transforms.eastNorthUpToFixedFrame(
  ellipsoid.cartographicToCartesian(
    Cartographic.fromDegrees(-95.0, 40.0, 200000.0)));
e.radii = new Cartesian3(100000.0, 100000.0, 200000.0);
primitives.add(e);
Demo:
Source:

Members

:Cartesian3

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

The default is Cartesian3.ZERO.

Default Value:
See:

:Boolean

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

Draws the bounding sphere for each {@see DrawCommand} in the primitive.

Default Value:
  • false

:Object

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

: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.

Example
// 1. Change the color of the default material to yellow
e.material.uniforms.color = new Color(1.0, 1.0, 0.0, 1.0);

// 2. Change material to horizontal stripes
e.material = Material.fromType(Material.StripeType);
Default Value:
  • Material.fromType(Material.ColorType)
See:

: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.
Example
var origin = ellipsoid.cartographicToCartesian(
  Cartographic.fromDegrees(-95.0, 40.0, 200000.0));
e.modelMatrix = Transforms.eastNorthUpToFixedFrame(origin);
Default Value:
See:

: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.

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

:Boolean

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

Methods

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.

Throws:
DeveloperError : This object was destroyed, i.e., destroy() was called.
Returns:
Example
e = e && e.destroy();
See:

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:
Boolean true if this object was destroyed; otherwise, false.
See: