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.

Examples
// 1. Create a sphere using the ellipsoid primitive
var e = new EllipsoidPrimitive();
e.center = ellipsoid.cartographicToCartesian(
  Cartographic.fromDegrees(-75.0, 40.0, 500000.0));
e.radii = new Cartesian3(500000.0, 500000.0, 500000.0);
primitives.add(e);
// 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:

: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(scene.getContext(), Material.StripeType);
Default Value:
  • Material.fromType(undefined, 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:
  • Matrix4.IDENTITY
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: