Sha256: b87d3770ac657263b9b3ec2130940f753a2eb6b8e1d52a5937c6800130752e37

Contents?: true

Size: 1.87 KB

Versions: 7

Compression:

Stored size: 1.87 KB

Contents

/*global define*/
define(['Core/defaultValue', 'Core/defined', 'Core/DeveloperError', 'Core/Intersect'], function(
        defaultValue,
        defined,
        DeveloperError,
        Intersect) {
    "use strict";

    /**
     * The culling volume defined by planes.
     *
     * @alias OrthographicFrustum
     * @constructor
     *
     * @param Array planes An array of clipping planes.
     */
    var CullingVolume = function(planes) {
        /**
         * Each plane is represented by a Cartesian4 object, where the x, y, and z components
         * define the unit vector normal to the plane, and the w component is the distance of the
         * plane from the origin.
         * @type {Array}
         * @default []
         */
        this.planes = defaultValue(planes, []);
    };

    /**
     * Determines whether a bounding volume intersects the culling volume.
     * @memberof CullingVolume
     *
     * @param {Object} boundingVolume The bounding volume whose intersection with the culling volume is to be tested.
     * @returns {Intersect}  Intersect.OUTSIDE, Intersect.INTERSECTING, or Intersect.INSIDE.
     *
     * @exception {DeveloperError} boundingVolume is required.
     */
    CullingVolume.prototype.getVisibility = function(boundingVolume) {
        if (!defined(boundingVolume)) {
            throw new DeveloperError('boundingVolume is required.');
        }

        var planes = this.planes;
        var intersecting = false;
        for (var k = 0, len = planes.length; k < len; ++k) {
            var result = boundingVolume.intersect(planes[k]);
            if (result === Intersect.OUTSIDE) {
                return Intersect.OUTSIDE;
            } else if (result === Intersect.INTERSECTING) {
                intersecting = true;
            }
        }

        return intersecting ? Intersect.INTERSECTING : Intersect.INSIDE;
    };

    return CullingVolume;
});

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cesium-0.24.1 app/assets/javascripts/Scene/CullingVolume.js
cesium-0.24.0 app/assets/javascripts/Scene/CullingVolume.js
cesium-0.23.0 app/assets/javascripts/Scene/CullingVolume.js
cesium-0.22.0 app/assets/javascripts/Scene/CullingVolume.js
cesium-0.21.1 app/assets/javascripts/Scene/CullingVolume.js
cesium-0.21 app/assets/javascripts/Scene/CullingVolume.js
cesium-0.20.0 app/assets/javascripts/Scene/CullingVolume.js