How to use sigma method in wpt

Best JavaScript code snippet using wpt

EllipsoidGeodesic-8b33d834.js

Source:EllipsoidGeodesic-8b33d834.js Github

copy

Full Screen

1/* This file is automatically rebuilt by the Cesium build process. */2define(['exports', './when-e6e3e713', './Check-1df6b9a0', './Math-c5f6c994', './Cartesian2-1d7364fa'], function (exports, when, Check, _Math, Cartesian2) { 'use strict';3 function setConstants(ellipsoidGeodesic) {4 var uSquared = ellipsoidGeodesic._uSquared;5 var a = ellipsoidGeodesic._ellipsoid.maximumRadius;6 var b = ellipsoidGeodesic._ellipsoid.minimumRadius;7 var f = (a - b) / a;8 var cosineHeading = Math.cos(ellipsoidGeodesic._startHeading);9 var sineHeading = Math.sin(ellipsoidGeodesic._startHeading);10 var tanU = (1 - f) * Math.tan(ellipsoidGeodesic._start.latitude);11 var cosineU = 1.0 / Math.sqrt(1.0 + tanU * tanU);12 var sineU = cosineU * tanU;13 var sigma = Math.atan2(tanU, cosineHeading);14 var sineAlpha = cosineU * sineHeading;15 var sineSquaredAlpha = sineAlpha * sineAlpha;16 var cosineSquaredAlpha = 1.0 - sineSquaredAlpha;17 var cosineAlpha = Math.sqrt(cosineSquaredAlpha);18 var u2Over4 = uSquared / 4.0;19 var u4Over16 = u2Over4 * u2Over4;20 var u6Over64 = u4Over16 * u2Over4;21 var u8Over256 = u4Over16 * u4Over16;22 var a0 = (1.0 + u2Over4 - 3.0 * u4Over16 / 4.0 + 5.0 * u6Over64 / 4.0 - 175.0 * u8Over256 / 64.0);23 var a1 = (1.0 - u2Over4 + 15.0 * u4Over16 / 8.0 - 35.0 * u6Over64 / 8.0);24 var a2 = (1.0 - 3.0 * u2Over4 + 35.0 * u4Over16 / 4.0);25 var a3 = (1.0 - 5.0 * u2Over4);26 var distanceRatio = a0 * sigma - a1 * Math.sin(2.0 * sigma) * u2Over4 / 2.0 - a2 * Math.sin(4.0 * sigma) * u4Over16 / 16.0 -27 a3 * Math.sin(6.0 * sigma) * u6Over64 / 48.0 - Math.sin(8.0 * sigma) * 5.0 * u8Over256 / 512;28 var constants = ellipsoidGeodesic._constants;29 constants.a = a;30 constants.b = b;31 constants.f = f;32 constants.cosineHeading = cosineHeading;33 constants.sineHeading = sineHeading;34 constants.tanU = tanU;35 constants.cosineU = cosineU;36 constants.sineU = sineU;37 constants.sigma = sigma;38 constants.sineAlpha = sineAlpha;39 constants.sineSquaredAlpha = sineSquaredAlpha;40 constants.cosineSquaredAlpha = cosineSquaredAlpha;41 constants.cosineAlpha = cosineAlpha;42 constants.u2Over4 = u2Over4;43 constants.u4Over16 = u4Over16;44 constants.u6Over64 = u6Over64;45 constants.u8Over256 = u8Over256;46 constants.a0 = a0;47 constants.a1 = a1;48 constants.a2 = a2;49 constants.a3 = a3;50 constants.distanceRatio = distanceRatio;51 }52 function computeC(f, cosineSquaredAlpha) {53 return f * cosineSquaredAlpha * (4.0 + f * (4.0 - 3.0 * cosineSquaredAlpha)) / 16.0;54 }55 function computeDeltaLambda(f, sineAlpha, cosineSquaredAlpha, sigma, sineSigma, cosineSigma, cosineTwiceSigmaMidpoint) {56 var C = computeC(f, cosineSquaredAlpha);57 return (1.0 - C) * f * sineAlpha * (sigma + C * sineSigma * (cosineTwiceSigmaMidpoint +58 C * cosineSigma * (2.0 * cosineTwiceSigmaMidpoint * cosineTwiceSigmaMidpoint - 1.0)));59 }60 function vincentyInverseFormula(ellipsoidGeodesic, major, minor, firstLongitude, firstLatitude, secondLongitude, secondLatitude) {61 var eff = (major - minor) / major;62 var l = secondLongitude - firstLongitude;63 var u1 = Math.atan((1 - eff) * Math.tan(firstLatitude));64 var u2 = Math.atan((1 - eff) * Math.tan(secondLatitude));65 var cosineU1 = Math.cos(u1);66 var sineU1 = Math.sin(u1);67 var cosineU2 = Math.cos(u2);68 var sineU2 = Math.sin(u2);69 var cc = cosineU1 * cosineU2;70 var cs = cosineU1 * sineU2;71 var ss = sineU1 * sineU2;72 var sc = sineU1 * cosineU2;73 var lambda = l;74 var lambdaDot = _Math.CesiumMath.TWO_PI;75 var cosineLambda = Math.cos(lambda);76 var sineLambda = Math.sin(lambda);77 var sigma;78 var cosineSigma;79 var sineSigma;80 var cosineSquaredAlpha;81 var cosineTwiceSigmaMidpoint;82 do {83 cosineLambda = Math.cos(lambda);84 sineLambda = Math.sin(lambda);85 var temp = cs - sc * cosineLambda;86 sineSigma = Math.sqrt(cosineU2 * cosineU2 * sineLambda * sineLambda + temp * temp);87 cosineSigma = ss + cc * cosineLambda;88 sigma = Math.atan2(sineSigma, cosineSigma);89 var sineAlpha;90 if (sineSigma === 0.0) {91 sineAlpha = 0.0;92 cosineSquaredAlpha = 1.0;93 } else {94 sineAlpha = cc * sineLambda / sineSigma;95 cosineSquaredAlpha = 1.0 - sineAlpha * sineAlpha;96 }97 lambdaDot = lambda;98 cosineTwiceSigmaMidpoint = cosineSigma - 2.0 * ss / cosineSquaredAlpha;99 if (isNaN(cosineTwiceSigmaMidpoint)) {100 cosineTwiceSigmaMidpoint = 0.0;101 }102 lambda = l + computeDeltaLambda(eff, sineAlpha, cosineSquaredAlpha,103 sigma, sineSigma, cosineSigma, cosineTwiceSigmaMidpoint);104 } while (Math.abs(lambda - lambdaDot) > _Math.CesiumMath.EPSILON12);105 var uSquared = cosineSquaredAlpha * (major * major - minor * minor) / (minor * minor);106 var A = 1.0 + uSquared * (4096.0 + uSquared * (uSquared * (320.0 - 175.0 * uSquared) - 768.0)) / 16384.0;107 var B = uSquared * (256.0 + uSquared * (uSquared * (74.0 - 47.0 * uSquared) - 128.0)) / 1024.0;108 var cosineSquaredTwiceSigmaMidpoint = cosineTwiceSigmaMidpoint * cosineTwiceSigmaMidpoint;109 var deltaSigma = B * sineSigma * (cosineTwiceSigmaMidpoint + B * (cosineSigma *110 (2.0 * cosineSquaredTwiceSigmaMidpoint - 1.0) - B * cosineTwiceSigmaMidpoint *111 (4.0 * sineSigma * sineSigma - 3.0) * (4.0 * cosineSquaredTwiceSigmaMidpoint - 3.0) / 6.0) / 4.0);112 var distance = minor * A * (sigma - deltaSigma);113 var startHeading = Math.atan2(cosineU2 * sineLambda, cs - sc * cosineLambda);114 var endHeading = Math.atan2(cosineU1 * sineLambda, cs * cosineLambda - sc);115 ellipsoidGeodesic._distance = distance;116 ellipsoidGeodesic._startHeading = startHeading;117 ellipsoidGeodesic._endHeading = endHeading;118 ellipsoidGeodesic._uSquared = uSquared;119 }120 var scratchCart1 = new Cartesian2.Cartesian3();121 var scratchCart2 = new Cartesian2.Cartesian3();122 function computeProperties(ellipsoidGeodesic, start, end, ellipsoid) {123 var firstCartesian = Cartesian2.Cartesian3.normalize(ellipsoid.cartographicToCartesian(start, scratchCart2), scratchCart1);124 var lastCartesian = Cartesian2.Cartesian3.normalize(ellipsoid.cartographicToCartesian(end, scratchCart2), scratchCart2);125 //>>includeStart('debug', pragmas.debug);126 Check.Check.typeOf.number.greaterThanOrEquals('value', Math.abs(Math.abs(Cartesian2.Cartesian3.angleBetween(firstCartesian, lastCartesian)) - Math.PI), 0.0125);127 //>>includeEnd('debug');128 vincentyInverseFormula(ellipsoidGeodesic, ellipsoid.maximumRadius, ellipsoid.minimumRadius,129 start.longitude, start.latitude, end.longitude, end.latitude);130 ellipsoidGeodesic._start = Cartesian2.Cartographic.clone(start, ellipsoidGeodesic._start);131 ellipsoidGeodesic._end = Cartesian2.Cartographic.clone(end, ellipsoidGeodesic._end);132 ellipsoidGeodesic._start.height = 0;133 ellipsoidGeodesic._end.height = 0;134 setConstants(ellipsoidGeodesic);135 }136 /**137 * Initializes a geodesic on the ellipsoid connecting the two provided planetodetic points.138 *139 * @alias EllipsoidGeodesic140 * @constructor141 *142 * @param {Cartographic} [start] The initial planetodetic point on the path.143 * @param {Cartographic} [end] The final planetodetic point on the path.144 * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid on which the geodesic lies.145 */146 function EllipsoidGeodesic(start, end, ellipsoid) {147 var e = when.defaultValue(ellipsoid, Cartesian2.Ellipsoid.WGS84);148 this._ellipsoid = e;149 this._start = new Cartesian2.Cartographic();150 this._end = new Cartesian2.Cartographic();151 this._constants = {};152 this._startHeading = undefined;153 this._endHeading = undefined;154 this._distance = undefined;155 this._uSquared = undefined;156 if (when.defined(start) && when.defined(end)) {157 computeProperties(this, start, end, e);158 }159 }160 Object.defineProperties(EllipsoidGeodesic.prototype, {161 /**162 * Gets the ellipsoid.163 * @memberof EllipsoidGeodesic.prototype164 * @type {Ellipsoid}165 * @readonly166 */167 ellipsoid : {168 get : function() {169 return this._ellipsoid;170 }171 },172 /**173 * Gets the surface distance between the start and end point174 * @memberof EllipsoidGeodesic.prototype175 * @type {Number}176 * @readonly177 */178 surfaceDistance : {179 get : function() {180 //>>includeStart('debug', pragmas.debug);181 Check.Check.defined('distance', this._distance);182 //>>includeEnd('debug');183 return this._distance;184 }185 },186 /**187 * Gets the initial planetodetic point on the path.188 * @memberof EllipsoidGeodesic.prototype189 * @type {Cartographic}190 * @readonly191 */192 start : {193 get : function() {194 return this._start;195 }196 },197 /**198 * Gets the final planetodetic point on the path.199 * @memberof EllipsoidGeodesic.prototype200 * @type {Cartographic}201 * @readonly202 */203 end : {204 get : function() {205 return this._end;206 }207 },208 /**209 * Gets the heading at the initial point.210 * @memberof EllipsoidGeodesic.prototype211 * @type {Number}212 * @readonly213 */214 startHeading : {215 get : function() {216 //>>includeStart('debug', pragmas.debug);217 Check.Check.defined('distance', this._distance);218 //>>includeEnd('debug');219 return this._startHeading;220 }221 },222 /**223 * Gets the heading at the final point.224 * @memberof EllipsoidGeodesic.prototype225 * @type {Number}226 * @readonly227 */228 endHeading : {229 get : function() {230 //>>includeStart('debug', pragmas.debug);231 Check.Check.defined('distance', this._distance);232 //>>includeEnd('debug');233 return this._endHeading;234 }235 }236 });237 /**238 * Sets the start and end points of the geodesic239 *240 * @param {Cartographic} start The initial planetodetic point on the path.241 * @param {Cartographic} end The final planetodetic point on the path.242 */243 EllipsoidGeodesic.prototype.setEndPoints = function(start, end) {244 //>>includeStart('debug', pragmas.debug);245 Check.Check.defined('start', start);246 Check.Check.defined('end', end);247 //>>includeEnd('debug');248 computeProperties(this, start, end, this._ellipsoid);249 };250 /**251 * Provides the location of a point at the indicated portion along the geodesic.252 *253 * @param {Number} fraction The portion of the distance between the initial and final points.254 * @param {Cartographic} result The object in which to store the result.255 * @returns {Cartographic} The location of the point along the geodesic.256 */257 EllipsoidGeodesic.prototype.interpolateUsingFraction = function(fraction, result) {258 return this.interpolateUsingSurfaceDistance(this._distance * fraction, result);259 };260 /**261 * Provides the location of a point at the indicated distance along the geodesic.262 *263 * @param {Number} distance The distance from the inital point to the point of interest along the geodesic264 * @param {Cartographic} result The object in which to store the result.265 * @returns {Cartographic} The location of the point along the geodesic.266 *267 * @exception {DeveloperError} start and end must be set before calling function interpolateUsingSurfaceDistance268 */269 EllipsoidGeodesic.prototype.interpolateUsingSurfaceDistance = function(distance, result) {270 //>>includeStart('debug', pragmas.debug);271 Check.Check.defined('distance', this._distance);272 //>>includeEnd('debug');273 var constants = this._constants;274 var s = constants.distanceRatio + distance / constants.b;275 var cosine2S = Math.cos(2.0 * s);276 var cosine4S = Math.cos(4.0 * s);277 var cosine6S = Math.cos(6.0 * s);278 var sine2S = Math.sin(2.0 * s);279 var sine4S = Math.sin(4.0 * s);280 var sine6S = Math.sin(6.0 * s);281 var sine8S = Math.sin(8.0 * s);282 var s2 = s * s;283 var s3 = s * s2;284 var u8Over256 = constants.u8Over256;285 var u2Over4 = constants.u2Over4;286 var u6Over64 = constants.u6Over64;287 var u4Over16 = constants.u4Over16;288 var sigma = 2.0 * s3 * u8Over256 * cosine2S / 3.0 +289 s * (1.0 - u2Over4 + 7.0 * u4Over16 / 4.0 - 15.0 * u6Over64 / 4.0 + 579.0 * u8Over256 / 64.0 -290 (u4Over16 - 15.0 * u6Over64 / 4.0 + 187.0 * u8Over256 / 16.0) * cosine2S -291 (5.0 * u6Over64 / 4.0 - 115.0 * u8Over256 / 16.0) * cosine4S -292 29.0 * u8Over256 * cosine6S / 16.0) +293 (u2Over4 / 2.0 - u4Over16 + 71.0 * u6Over64 / 32.0 - 85.0 * u8Over256 / 16.0) * sine2S +294 (5.0 * u4Over16 / 16.0 - 5.0 * u6Over64 / 4.0 + 383.0 * u8Over256 / 96.0) * sine4S -295 s2 * ((u6Over64 - 11.0 * u8Over256 / 2.0) * sine2S + 5.0 * u8Over256 * sine4S / 2.0) +296 (29.0 * u6Over64 / 96.0 - 29.0 * u8Over256 / 16.0) * sine6S +297 539.0 * u8Over256 * sine8S / 1536.0;298 var theta = Math.asin(Math.sin(sigma) * constants.cosineAlpha);299 var latitude = Math.atan(constants.a / constants.b * Math.tan(theta));300 // Redefine in terms of relative argument of latitude.301 sigma = sigma - constants.sigma;302 var cosineTwiceSigmaMidpoint = Math.cos(2.0 * constants.sigma + sigma);303 var sineSigma = Math.sin(sigma);304 var cosineSigma = Math.cos(sigma);305 var cc = constants.cosineU * cosineSigma;306 var ss = constants.sineU * sineSigma;307 var lambda = Math.atan2(sineSigma * constants.sineHeading, cc - ss * constants.cosineHeading);308 var l = lambda - computeDeltaLambda(constants.f, constants.sineAlpha, constants.cosineSquaredAlpha,309 sigma, sineSigma, cosineSigma, cosineTwiceSigmaMidpoint);310 if (when.defined(result)) {311 result.longitude = this._start.longitude + l;312 result.latitude = latitude;313 result.height = 0.0;314 return result;315 }316 return new Cartesian2.Cartographic(this._start.longitude + l, latitude, 0.0);317 };318 exports.EllipsoidGeodesic = EllipsoidGeodesic;...

Full Screen

Full Screen

EllipsoidGeodesic.js

Source:EllipsoidGeodesic.js Github

copy

Full Screen

1import Cartesian3 from './Cartesian3.js';2import Cartographic from './Cartographic.js';3import Check from './Check.js';4import defaultValue from './defaultValue.js';5import defined from './defined.js';6import Ellipsoid from './Ellipsoid.js';7import CesiumMath from './Math.js';8 function setConstants(ellipsoidGeodesic) {9 var uSquared = ellipsoidGeodesic._uSquared;10 var a = ellipsoidGeodesic._ellipsoid.maximumRadius;11 var b = ellipsoidGeodesic._ellipsoid.minimumRadius;12 var f = (a - b) / a;13 var cosineHeading = Math.cos(ellipsoidGeodesic._startHeading);14 var sineHeading = Math.sin(ellipsoidGeodesic._startHeading);15 var tanU = (1 - f) * Math.tan(ellipsoidGeodesic._start.latitude);16 var cosineU = 1.0 / Math.sqrt(1.0 + tanU * tanU);17 var sineU = cosineU * tanU;18 var sigma = Math.atan2(tanU, cosineHeading);19 var sineAlpha = cosineU * sineHeading;20 var sineSquaredAlpha = sineAlpha * sineAlpha;21 var cosineSquaredAlpha = 1.0 - sineSquaredAlpha;22 var cosineAlpha = Math.sqrt(cosineSquaredAlpha);23 var u2Over4 = uSquared / 4.0;24 var u4Over16 = u2Over4 * u2Over4;25 var u6Over64 = u4Over16 * u2Over4;26 var u8Over256 = u4Over16 * u4Over16;27 var a0 = (1.0 + u2Over4 - 3.0 * u4Over16 / 4.0 + 5.0 * u6Over64 / 4.0 - 175.0 * u8Over256 / 64.0);28 var a1 = (1.0 - u2Over4 + 15.0 * u4Over16 / 8.0 - 35.0 * u6Over64 / 8.0);29 var a2 = (1.0 - 3.0 * u2Over4 + 35.0 * u4Over16 / 4.0);30 var a3 = (1.0 - 5.0 * u2Over4);31 var distanceRatio = a0 * sigma - a1 * Math.sin(2.0 * sigma) * u2Over4 / 2.0 - a2 * Math.sin(4.0 * sigma) * u4Over16 / 16.0 -32 a3 * Math.sin(6.0 * sigma) * u6Over64 / 48.0 - Math.sin(8.0 * sigma) * 5.0 * u8Over256 / 512;33 var constants = ellipsoidGeodesic._constants;34 constants.a = a;35 constants.b = b;36 constants.f = f;37 constants.cosineHeading = cosineHeading;38 constants.sineHeading = sineHeading;39 constants.tanU = tanU;40 constants.cosineU = cosineU;41 constants.sineU = sineU;42 constants.sigma = sigma;43 constants.sineAlpha = sineAlpha;44 constants.sineSquaredAlpha = sineSquaredAlpha;45 constants.cosineSquaredAlpha = cosineSquaredAlpha;46 constants.cosineAlpha = cosineAlpha;47 constants.u2Over4 = u2Over4;48 constants.u4Over16 = u4Over16;49 constants.u6Over64 = u6Over64;50 constants.u8Over256 = u8Over256;51 constants.a0 = a0;52 constants.a1 = a1;53 constants.a2 = a2;54 constants.a3 = a3;55 constants.distanceRatio = distanceRatio;56 }57 function computeC(f, cosineSquaredAlpha) {58 return f * cosineSquaredAlpha * (4.0 + f * (4.0 - 3.0 * cosineSquaredAlpha)) / 16.0;59 }60 function computeDeltaLambda(f, sineAlpha, cosineSquaredAlpha, sigma, sineSigma, cosineSigma, cosineTwiceSigmaMidpoint) {61 var C = computeC(f, cosineSquaredAlpha);62 return (1.0 - C) * f * sineAlpha * (sigma + C * sineSigma * (cosineTwiceSigmaMidpoint +63 C * cosineSigma * (2.0 * cosineTwiceSigmaMidpoint * cosineTwiceSigmaMidpoint - 1.0)));64 }65 function vincentyInverseFormula(ellipsoidGeodesic, major, minor, firstLongitude, firstLatitude, secondLongitude, secondLatitude) {66 var eff = (major - minor) / major;67 var l = secondLongitude - firstLongitude;68 var u1 = Math.atan((1 - eff) * Math.tan(firstLatitude));69 var u2 = Math.atan((1 - eff) * Math.tan(secondLatitude));70 var cosineU1 = Math.cos(u1);71 var sineU1 = Math.sin(u1);72 var cosineU2 = Math.cos(u2);73 var sineU2 = Math.sin(u2);74 var cc = cosineU1 * cosineU2;75 var cs = cosineU1 * sineU2;76 var ss = sineU1 * sineU2;77 var sc = sineU1 * cosineU2;78 var lambda = l;79 var lambdaDot = CesiumMath.TWO_PI;80 var cosineLambda = Math.cos(lambda);81 var sineLambda = Math.sin(lambda);82 var sigma;83 var cosineSigma;84 var sineSigma;85 var cosineSquaredAlpha;86 var cosineTwiceSigmaMidpoint;87 do {88 cosineLambda = Math.cos(lambda);89 sineLambda = Math.sin(lambda);90 var temp = cs - sc * cosineLambda;91 sineSigma = Math.sqrt(cosineU2 * cosineU2 * sineLambda * sineLambda + temp * temp);92 cosineSigma = ss + cc * cosineLambda;93 sigma = Math.atan2(sineSigma, cosineSigma);94 var sineAlpha;95 if (sineSigma === 0.0) {96 sineAlpha = 0.0;97 cosineSquaredAlpha = 1.0;98 } else {99 sineAlpha = cc * sineLambda / sineSigma;100 cosineSquaredAlpha = 1.0 - sineAlpha * sineAlpha;101 }102 lambdaDot = lambda;103 cosineTwiceSigmaMidpoint = cosineSigma - 2.0 * ss / cosineSquaredAlpha;104 if (isNaN(cosineTwiceSigmaMidpoint)) {105 cosineTwiceSigmaMidpoint = 0.0;106 }107 lambda = l + computeDeltaLambda(eff, sineAlpha, cosineSquaredAlpha,108 sigma, sineSigma, cosineSigma, cosineTwiceSigmaMidpoint);109 } while (Math.abs(lambda - lambdaDot) > CesiumMath.EPSILON12);110 var uSquared = cosineSquaredAlpha * (major * major - minor * minor) / (minor * minor);111 var A = 1.0 + uSquared * (4096.0 + uSquared * (uSquared * (320.0 - 175.0 * uSquared) - 768.0)) / 16384.0;112 var B = uSquared * (256.0 + uSquared * (uSquared * (74.0 - 47.0 * uSquared) - 128.0)) / 1024.0;113 var cosineSquaredTwiceSigmaMidpoint = cosineTwiceSigmaMidpoint * cosineTwiceSigmaMidpoint;114 var deltaSigma = B * sineSigma * (cosineTwiceSigmaMidpoint + B * (cosineSigma *115 (2.0 * cosineSquaredTwiceSigmaMidpoint - 1.0) - B * cosineTwiceSigmaMidpoint *116 (4.0 * sineSigma * sineSigma - 3.0) * (4.0 * cosineSquaredTwiceSigmaMidpoint - 3.0) / 6.0) / 4.0);117 var distance = minor * A * (sigma - deltaSigma);118 var startHeading = Math.atan2(cosineU2 * sineLambda, cs - sc * cosineLambda);119 var endHeading = Math.atan2(cosineU1 * sineLambda, cs * cosineLambda - sc);120 ellipsoidGeodesic._distance = distance;121 ellipsoidGeodesic._startHeading = startHeading;122 ellipsoidGeodesic._endHeading = endHeading;123 ellipsoidGeodesic._uSquared = uSquared;124 }125 var scratchCart1 = new Cartesian3();126 var scratchCart2 = new Cartesian3();127 function computeProperties(ellipsoidGeodesic, start, end, ellipsoid) {128 var firstCartesian = Cartesian3.normalize(ellipsoid.cartographicToCartesian(start, scratchCart2), scratchCart1);129 var lastCartesian = Cartesian3.normalize(ellipsoid.cartographicToCartesian(end, scratchCart2), scratchCart2);130 //>>includeStart('debug', pragmas.debug);131 Check.typeOf.number.greaterThanOrEquals('value', Math.abs(Math.abs(Cartesian3.angleBetween(firstCartesian, lastCartesian)) - Math.PI), 0.0125);132 //>>includeEnd('debug');133 vincentyInverseFormula(ellipsoidGeodesic, ellipsoid.maximumRadius, ellipsoid.minimumRadius,134 start.longitude, start.latitude, end.longitude, end.latitude);135 ellipsoidGeodesic._start = Cartographic.clone(start, ellipsoidGeodesic._start);136 ellipsoidGeodesic._end = Cartographic.clone(end, ellipsoidGeodesic._end);137 ellipsoidGeodesic._start.height = 0;138 ellipsoidGeodesic._end.height = 0;139 setConstants(ellipsoidGeodesic);140 }141 /**142 * Initializes a geodesic on the ellipsoid connecting the two provided planetodetic points.143 *144 * @alias EllipsoidGeodesic145 * @constructor146 *147 * @param {Cartographic} [start] The initial planetodetic point on the path.148 * @param {Cartographic} [end] The final planetodetic point on the path.149 * @param {Ellipsoid} [ellipsoid=Ellipsoid.WGS84] The ellipsoid on which the geodesic lies.150 */151 function EllipsoidGeodesic(start, end, ellipsoid) {152 var e = defaultValue(ellipsoid, Ellipsoid.WGS84);153 this._ellipsoid = e;154 this._start = new Cartographic();155 this._end = new Cartographic();156 this._constants = {};157 this._startHeading = undefined;158 this._endHeading = undefined;159 this._distance = undefined;160 this._uSquared = undefined;161 if (defined(start) && defined(end)) {162 computeProperties(this, start, end, e);163 }164 }165 Object.defineProperties(EllipsoidGeodesic.prototype, {166 /**167 * Gets the ellipsoid.168 * @memberof EllipsoidGeodesic.prototype169 * @type {Ellipsoid}170 * @readonly171 */172 ellipsoid : {173 get : function() {174 return this._ellipsoid;175 }176 },177 /**178 * Gets the surface distance between the start and end point179 * @memberof EllipsoidGeodesic.prototype180 * @type {Number}181 * @readonly182 */183 surfaceDistance : {184 get : function() {185 //>>includeStart('debug', pragmas.debug);186 Check.defined('distance', this._distance);187 //>>includeEnd('debug');188 return this._distance;189 }190 },191 /**192 * Gets the initial planetodetic point on the path.193 * @memberof EllipsoidGeodesic.prototype194 * @type {Cartographic}195 * @readonly196 */197 start : {198 get : function() {199 return this._start;200 }201 },202 /**203 * Gets the final planetodetic point on the path.204 * @memberof EllipsoidGeodesic.prototype205 * @type {Cartographic}206 * @readonly207 */208 end : {209 get : function() {210 return this._end;211 }212 },213 /**214 * Gets the heading at the initial point.215 * @memberof EllipsoidGeodesic.prototype216 * @type {Number}217 * @readonly218 */219 startHeading : {220 get : function() {221 //>>includeStart('debug', pragmas.debug);222 Check.defined('distance', this._distance);223 //>>includeEnd('debug');224 return this._startHeading;225 }226 },227 /**228 * Gets the heading at the final point.229 * @memberof EllipsoidGeodesic.prototype230 * @type {Number}231 * @readonly232 */233 endHeading : {234 get : function() {235 //>>includeStart('debug', pragmas.debug);236 Check.defined('distance', this._distance);237 //>>includeEnd('debug');238 return this._endHeading;239 }240 }241 });242 /**243 * Sets the start and end points of the geodesic244 *245 * @param {Cartographic} start The initial planetodetic point on the path.246 * @param {Cartographic} end The final planetodetic point on the path.247 */248 EllipsoidGeodesic.prototype.setEndPoints = function(start, end) {249 //>>includeStart('debug', pragmas.debug);250 Check.defined('start', start);251 Check.defined('end', end);252 //>>includeEnd('debug');253 computeProperties(this, start, end, this._ellipsoid);254 };255 /**256 * Provides the location of a point at the indicated portion along the geodesic.257 *258 * @param {Number} fraction The portion of the distance between the initial and final points.259 * @param {Cartographic} result The object in which to store the result.260 * @returns {Cartographic} The location of the point along the geodesic.261 */262 EllipsoidGeodesic.prototype.interpolateUsingFraction = function(fraction, result) {263 return this.interpolateUsingSurfaceDistance(this._distance * fraction, result);264 };265 /**266 * Provides the location of a point at the indicated distance along the geodesic.267 *268 * @param {Number} distance The distance from the inital point to the point of interest along the geodesic269 * @param {Cartographic} result The object in which to store the result.270 * @returns {Cartographic} The location of the point along the geodesic.271 *272 * @exception {DeveloperError} start and end must be set before calling function interpolateUsingSurfaceDistance273 */274 EllipsoidGeodesic.prototype.interpolateUsingSurfaceDistance = function(distance, result) {275 //>>includeStart('debug', pragmas.debug);276 Check.defined('distance', this._distance);277 //>>includeEnd('debug');278 var constants = this._constants;279 var s = constants.distanceRatio + distance / constants.b;280 var cosine2S = Math.cos(2.0 * s);281 var cosine4S = Math.cos(4.0 * s);282 var cosine6S = Math.cos(6.0 * s);283 var sine2S = Math.sin(2.0 * s);284 var sine4S = Math.sin(4.0 * s);285 var sine6S = Math.sin(6.0 * s);286 var sine8S = Math.sin(8.0 * s);287 var s2 = s * s;288 var s3 = s * s2;289 var u8Over256 = constants.u8Over256;290 var u2Over4 = constants.u2Over4;291 var u6Over64 = constants.u6Over64;292 var u4Over16 = constants.u4Over16;293 var sigma = 2.0 * s3 * u8Over256 * cosine2S / 3.0 +294 s * (1.0 - u2Over4 + 7.0 * u4Over16 / 4.0 - 15.0 * u6Over64 / 4.0 + 579.0 * u8Over256 / 64.0 -295 (u4Over16 - 15.0 * u6Over64 / 4.0 + 187.0 * u8Over256 / 16.0) * cosine2S -296 (5.0 * u6Over64 / 4.0 - 115.0 * u8Over256 / 16.0) * cosine4S -297 29.0 * u8Over256 * cosine6S / 16.0) +298 (u2Over4 / 2.0 - u4Over16 + 71.0 * u6Over64 / 32.0 - 85.0 * u8Over256 / 16.0) * sine2S +299 (5.0 * u4Over16 / 16.0 - 5.0 * u6Over64 / 4.0 + 383.0 * u8Over256 / 96.0) * sine4S -300 s2 * ((u6Over64 - 11.0 * u8Over256 / 2.0) * sine2S + 5.0 * u8Over256 * sine4S / 2.0) +301 (29.0 * u6Over64 / 96.0 - 29.0 * u8Over256 / 16.0) * sine6S +302 539.0 * u8Over256 * sine8S / 1536.0;303 var theta = Math.asin(Math.sin(sigma) * constants.cosineAlpha);304 var latitude = Math.atan(constants.a / constants.b * Math.tan(theta));305 // Redefine in terms of relative argument of latitude.306 sigma = sigma - constants.sigma;307 var cosineTwiceSigmaMidpoint = Math.cos(2.0 * constants.sigma + sigma);308 var sineSigma = Math.sin(sigma);309 var cosineSigma = Math.cos(sigma);310 var cc = constants.cosineU * cosineSigma;311 var ss = constants.sineU * sineSigma;312 var lambda = Math.atan2(sineSigma * constants.sineHeading, cc - ss * constants.cosineHeading);313 var l = lambda - computeDeltaLambda(constants.f, constants.sineAlpha, constants.cosineSquaredAlpha,314 sigma, sineSigma, cosineSigma, cosineTwiceSigmaMidpoint);315 if (defined(result)) {316 result.longitude = this._start.longitude + l;317 result.latitude = latitude;318 result.height = 0.0;319 return result;320 }321 return new Cartographic(this._start.longitude + l, latitude, 0.0);322 };...

Full Screen

Full Screen

Gruntfile.js

Source:Gruntfile.js Github

copy

Full Screen

1var fs = require('fs');2module.exports = function(grunt) {3 var coreJsFiles = [4 // Core:5 'src/sigma.core.js',6 // Utils:7 'src/conrad.js',8 'src/utils/sigma.utils.js',9 'src/utils/sigma.polyfills.js',10 // Main classes:11 'src/sigma.settings.js',12 'src/classes/sigma.classes.dispatcher.js',13 'src/classes/sigma.classes.configurable.js',14 'src/classes/sigma.classes.graph.js',15 'src/classes/sigma.classes.camera.js',16 'src/classes/sigma.classes.quad.js',17 'src/classes/sigma.classes.edgequad.js',18 // Captors:19 'src/captors/sigma.captors.mouse.js',20 'src/captors/sigma.captors.touch.js',21 // Renderers:22 'src/renderers/sigma.renderers.canvas.js',23 'src/renderers/sigma.renderers.webgl.js',24 'src/renderers/sigma.renderers.svg.js',25 'src/renderers/sigma.renderers.def.js',26 // Sub functions per engine:27 'src/renderers/webgl/sigma.webgl.nodes.def.js',28 'src/renderers/webgl/sigma.webgl.nodes.fast.js',29 'src/renderers/webgl/sigma.webgl.edges.def.js',30 'src/renderers/webgl/sigma.webgl.edges.fast.js',31 'src/renderers/webgl/sigma.webgl.edges.arrow.js',32 'src/renderers/canvas/sigma.canvas.labels.def.js',33 'src/renderers/canvas/sigma.canvas.hovers.def.js',34 'src/renderers/canvas/sigma.canvas.nodes.def.js',35 'src/renderers/canvas/sigma.canvas.edges.def.js',36 'src/renderers/canvas/sigma.canvas.edges.dotCurve.js',37 'src/renderers/canvas/sigma.canvas.edges.arrow.js',38 'src/renderers/canvas/sigma.canvas.edges.dotCurvedArrow.js',39 'src/renderers/canvas/sigma.canvas.edgehovers.def.js',40 'src/renderers/canvas/sigma.canvas.edgehovers.curve.js',41 'src/renderers/canvas/sigma.canvas.edgehovers.arrow.js',42 'src/renderers/canvas/sigma.canvas.edgehovers.curvedArrow.js',43 'src/renderers/canvas/sigma.canvas.extremities.def.js',44 'src/renderers/svg/sigma.svg.utils.js',45 'src/renderers/svg/sigma.svg.nodes.def.js',46 'src/renderers/svg/sigma.svg.edges.def.js',47 'src/renderers/svg/sigma.svg.edges.curve.js',48 'src/renderers/svg/sigma.svg.labels.def.js',49 'src/renderers/svg/sigma.svg.hovers.def.js',50 // Middlewares:51 'src/middlewares/sigma.middlewares.rescale.js',52 'src/middlewares/sigma.middlewares.copy.js',53 // Miscellaneous:54 'src/misc/sigma.misc.animation.js',55 'src/misc/sigma.misc.bindEvents.js',56 'src/misc/sigma.misc.bindDOMEvents.js',57 'src/misc/sigma.misc.drawHovers.js'58 ];59 var npmJsFiles = coreJsFiles.slice(0);60 npmJsFiles.splice(2, 0, 'src/sigma.export.js');61 var plugins = [62 'exporters.svg',63 'layout.forceAtlas2',64 'layout.noverlap',65 'neo4j.cypher',66 'parsers.gexf',67 'parsers.json',68 'pathfinding.astar',69 'plugins.animate',70 'plugins.dragNodes',71 'plugins.filter',72 'plugins.neighborhoods',73 'plugins.relativeSize',74 'renderers.customEdgeShapes',75 'renderers.customShapes',76 'renderers.edgeDots',77 'renderers.edgeLabels',78 'renderers.parallelEdges',79 'renderers.snapshot',80 'statistics.HITS'81 ];82 var pluginFiles = [],83 subGrunts = {};84 plugins.forEach(function(p) {85 var dir = 'plugins/sigma.' + p + '/';86 if (fs.existsSync(dir + 'Gruntfile.js'))87 subGrunts[p] = {88 gruntfile: dir + 'Gruntfile.js'89 };90 else91 pluginFiles.push(dir + '**/*.js');92 });93 // Project configuration:94 grunt.initConfig({95 pkg: grunt.file.readJSON('package.json'),96 grunt: subGrunts,97 closureLint: {98 app: {99 closureLinterPath: '/usr/local/bin',100 command: 'gjslint',101 src: coreJsFiles,102 options: {103 stdout: true,104 strict: true,105 opt: '--disable 6,13'106 }107 }108 },109 jshint: {110 all: coreJsFiles,111 options: {112 '-W055': true,113 '-W040': true,114 '-W064': true115 }116 },117 qunit: {118 all: {119 options: {120 urls: [121 './test/unit.html'122 ]123 }124 }125 },126 uglify: {127 prod: {128 files: {129 'build/sigma.min.js': coreJsFiles130 },131 options: {132 banner: '/* sigma.js - <%= pkg.description %> - Version: <%= pkg.version %> - Author: Alexis Jacomy, Sciences-Po Médialab - License: MIT */\n'133 }134 },135 plugins: {136 files: pluginFiles.reduce(function(res, path) {137 var dest = 'build/' + path.replace(/\/\*\*\/\*\.js$/, '.min.js');138 res[dest] = path;139 return res;140 }, {})141 }142 },143 concat: {144 options: {145 separator: '\n'146 },147 dist: {148 src: coreJsFiles,149 dest: 'build/sigma.js'150 },151 require: {152 src: npmJsFiles,153 dest: 'build/sigma.require.js'154 }155 },156 sed: {157 version: {158 recursive: true,159 path: 'examples/',160 pattern: /<!-- START SIGMA IMPORTS -->[\s\S]*<!-- END SIGMA IMPORTS -->/g,161 replacement: ['<!-- START SIGMA IMPORTS -->'].concat(coreJsFiles.map(function(path) {162 return '<script src="../' + path + '"></script>';163 }).concat('<!-- END SIGMA IMPORTS -->')).join('\n')164 }165 },166 zip: {167 release: {168 dest: 'build/release-v<%= pkg.version %>.zip',169 src: [170 'README.md',171 'build/sigma.min.js',172 'build/plugins/*.min.js'173 ],174 router: function(filepath) {175 return filepath.replace(/build\//, '');176 }177 }178 }179 });180 require('load-grunt-tasks')(grunt);181 // By default, will check lint, hint, test and minify:182 grunt.registerTask('default', ['closureLint', 'jshint', 'qunit', 'sed', 'grunt', 'uglify']);183 grunt.registerTask('release', ['closureLint', 'jshint', 'qunit', 'sed', 'grunt', 'uglify', 'zip']);184 grunt.registerTask('npmPrePublish', ['uglify:plugins', 'grunt', 'concat:require']);185 grunt.registerTask('build', ['uglify', 'grunt', 'concat:require']);186 grunt.registerTask('test', ['qunit']);187 // For travis-ci.org, only launch tests:188 grunt.registerTask('travis', ['qunit']);...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org');3 if (err) return console.error(err);4 console.log('Test status:', data.statusText);5});6* `from` - Source of test (e.g. `webpagetest`)

Full Screen

Using AI Code Generation

copy

Full Screen

1const wptools = require('wptools');2wptools.page('Albert Einstein').get().then(function(page) {3 console.log(page.data);4});5const wptools = require('wptools');6wptools.page('Albert Einstein').get().then(function(page) {7 console.log(page.data);8});9const wptools = require('wptools');10wptools.page('Albert Einstein').get().then(function(page) {11 console.log(page.data);12});13const wptools = require('wptools');14wptools.page('Albert Einstein').get().then(function(page) {15 console.log(page.data);16});17const wptools = require('wptools');18wptools.page('Albert Einstein').get().then(function(page) {19 console.log(page.data);20});21const wptools = require('wptools');22wptools.page('Albert Einstein').get().then(function(page) {23 console.log(page.data);24});25const wptools = require('wptools');26wptools.page('Albert Einstein').get().then(function(page) {27 console.log(page.data);28});29const wptools = require('wptools');30wptools.page('Albert Einstein').get().then(function(page) {31 console.log(page.data);32});33const wptools = require('wptools');34wptools.page('Albert Einstein').get().then(function(page) {35 console.log(page.data);36});37const wptools = require('wptools');38wptools.page('Albert Einstein').get().then(function(page) {39 console.log(page.data);40});

Full Screen

Using AI Code Generation

copy

Full Screen

1const wptools = require('wptools');2const wiki = wptools.page('Albert Einstein').get((err, info) => {3 console.log(info);4});5const wptools = require('wptools');6const wiki = wptools.page('Albert Einstein').get((err, info) => {7 console.log(info);8});9const wptools = require('wptools');10const wiki = wptools.page('Albert Einstein').get((err, info) => {11 console.log(info);12});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var fs = require('fs');3var _ = require('lodash');4var wikitext = fs.readFileSync('wikitext.txt', 'utf8');5var wiki = wptools(wikitext);6wiki.get(function(err, data) {7 if (err) {8 console.log(err);9 }10 console.log(data);11});12var wptools = require('wptools');13var fs = require('fs');14var _ = require('lodash');15var wikitext = fs.readFileSync('wikitext.txt', 'utf8');16var wiki = wptools(wikitext);17wiki.get(function(err, data) {18 if (err) {19 console.log(err);20 }21 console.log(data);22});23{ [Error: ENOENT: no such file or directory, open 'wikitext.txt']24 path: 'wikitext.txt' }25var wikitext = fs.readFileSync(__dirname + '/wikitext.txt', 'utf8');

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var page = wptools.page('Mahatma Gandhi');3page.get(function(err, resp) {4 console.log(resp);5});6var wtf = require('wtf_wikipedia');7wtf.from_api('Mahatma Gandhi', 'en', function(markup) {8 var doc = wtf.parse(markup);9 console.log(doc.text());10});

Full Screen

Using AI Code Generation

copy

Full Screen

1var sigma = require('wptoolkit').sigma;2var mySigma = sigma();3 if (err) {4 console.log('error: ', err);5 } else {6 console.log('data: ', data);7 }8});9var sigma = require('wptoolkit').sigma;10var mySigma = sigma();11 if (err) {12 console.log('error: ', err);13 } else {14 console.log('data: ', data);15 }16});17var sigma = require('wptoolkit').sigma;18var mySigma = sigma();19 if (err) {20 console.log('error: ', err);21 } else {22 console.log('data: ', data);23 }24});25var sigma = require('wptoolkit').sigma;26var mySigma = sigma();27 if (err) {28 console.log('error: ', err);29 } else {30 console.log('data: ', data);31 }32});33var sigma = require('wptoolkit').sigma;34var mySigma = sigma();35 if (err) {36 console.log('error: ', err);37 } else {38 console.log('data: ', data);39 }40});41var sigma = require('wptoolkit').sigma;42var mySigma = sigma();43 if (err) {44 console.log('error: ', err);45 } else {46 console.log('data: ', data);47 }48});

Full Screen

Using AI Code Generation

copy

Full Screen

1var testdata = getTestData();2var result = sigmaMethod(testdata);3console.log(result);4var testdata = getTestData();5var result = sigmaMethod(testdata);6console.log(result);7var testdata = getTestData();8var result = sigmaMethod(testdata);9console.log(result);10var testdata = getTestData();11var result = sigmaMethod(testdata);12console.log(result);13var testdata = getTestData();14var result = sigmaMethod(testdata);15console.log(result);

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2var wpt = new WebPageTest('www.webpagetest.org', 'A.3e3d6f8e1f9b6e3d6f8e1f9b6e3d6f8e');3var options = { runs: 3, location: 'Dulles:Chrome' };4 if (err) return console.error(err);5 console.log('Test submitted. Poll for results at %s/jsonResult.php?test=%s', wpt.endpoint, data.data.testId);6});7var wpt = require('wpt');8var options = { runs: 3, location: 'Dulles:Chrome' };9 if (err) return console.error(err);10 console.log('Test submitted. Poll for results at %s/jsonResult.php?test=%s', wpt.endpoint, data.data.testId);11});12### runTest(url, options, callback)

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful