1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- import Cartesian3 from "../Core/Cartesian3.js";
- import Check from "../Core/Check.js";
- import defaultValue from "../Core/defaultValue.js";
- import CesiumMath from "../Core/Math.js";
- function CircleEmitter(radius) {
- radius = defaultValue(radius, 1.0);
-
- Check.typeOf.number.greaterThan("radius", radius, 0.0);
-
- this._radius = defaultValue(radius, 1.0);
- }
- Object.defineProperties(CircleEmitter.prototype, {
-
- radius: {
- get: function () {
- return this._radius;
- },
- set: function (value) {
-
- Check.typeOf.number.greaterThan("value", value, 0.0);
-
- this._radius = value;
- },
- },
- });
- CircleEmitter.prototype.emit = function (particle) {
- var theta = CesiumMath.randomBetween(0.0, CesiumMath.TWO_PI);
- var rad = CesiumMath.randomBetween(0.0, this._radius);
- var x = rad * Math.cos(theta);
- var y = rad * Math.sin(theta);
- var z = 0.0;
- particle.position = Cartesian3.fromElements(x, y, z, particle.position);
- particle.velocity = Cartesian3.clone(Cartesian3.UNIT_Z, particle.velocity);
- };
- export default CircleEmitter;
|