How to use the Spherical function from three

Find comprehensive JavaScript three.Spherical code examples handpicked from public code repositorys.

151
152
153
154
155
156
157
158
159
160
bindLightTransform: function (offset, phi, theta, obj, dirLight) {
  // Computing boundingSphere
  const bb = new THREE.Box3().setFromObject(obj);
  const center = bb.getCenter(new THREE.Vector3());
  const bsphere = bb.getBoundingSphere(new THREE.Sphere(center));
  const sphericalPoint = new THREE.Spherical(
    bsphere.radius + offset,
    phi,
    theta
  );
fork icon15
star icon10
watch icon0

+ 4 other calls in file

251
252
253
254
255
256
257
258
259
260

var EPS = 0.000001;

// current position in spherical coordinates
var spherical = new THREE.Spherical();
var sphericalDelta = new THREE.Spherical();

var scale = 1;
var panOffset = new THREE.Vector3();
var zoomChanged = false;
fork icon4
star icon26
watch icon0

2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
	TOUCH_DOLLY_ROTATE: 6
};
let state = STATE.NONE;
const EPS = 0.000001; // current position in spherical coordinates

const spherical = new THREE.Spherical();
const sphericalDelta = new THREE.Spherical();
let scale = 1;
const panOffset = new THREE.Vector3();
let zoomChanged = false;
fork icon3
star icon7
watch icon1

+ 35 other calls in file

256
257
258
259
260
261
262
263
264
265
var state = STATE.NONE

var EPS = 0.000001

// current position in spherical coordinates
var spherical = new THREE.Spherical()
var sphericalDelta = new THREE.Spherical()

var scale = 1
var panOffset = new THREE.Vector3()
fork icon2
star icon14
watch icon0

51
52
53
54
55
56
57
58
59
60
61
62


var rotateStart = new THREE.Vector2();
var rotateEnd = new THREE.Vector2();
var rotateDelta = new THREE.Vector2();
var spherical = new THREE.Spherical(1.0, 0.01, 0);
var sphericalDelta = new THREE.Spherical(1.0, 0, 0);
var orbitScale = 1.0; // Pan


var panStart = new THREE.Vector2();
var panEnd = new THREE.Vector2();
fork icon0
star icon1
watch icon0

698
699
700
701
702
703
704
705
706
707
bubbleAnim: function(options) {
    var defaults = {
    }
    var settings = $.extend(defaults, options);

    // const spherical = new THREE.Spherical();
    // const rotationMatrix = new THREE.Matrix4();
    // const targetQuaternion = new THREE.Quaternion();

    // if ( ! mesh.quaternion.equals( targetQuaternion ) ) {
fork icon1
star icon0
watch icon0

+ 5 other calls in file

173
174
175
176
177
178
179
180
181
182
  return raycaster.intersectObject(mesh, false) //(world, true)
}

getAngleFromVectors3 = (initPoint, endPoint) => {  // returns source and target angles between two spherical points to make interpolation

  const sphericalStart = new THREE.Spherical()
  const sphericalEnd = new THREE.Spherical()
    const sourceAngle = {
        phi: 0,
        theta: 0
fork icon0
star icon1
watch icon1

+ 53 other calls in file

244
245
246
247
248
249
250
251
252
253
let state = STATE.NONE;

let EPS = 0.000001;

// current position in spherical coordinates
let spherical = new THREE.Spherical();
let sphericalDelta = new THREE.Spherical();

let scale = 1;
let panOffset = new THREE.Vector3();
fork icon0
star icon0
watch icon2

+ 111 other calls in file

335
336
337
338
339
340
341
342
343
344

const EPS = 0.000001;

// current position in spherical coordinates
const spherical = new three.Spherical();
const sphericalDelta = new three.Spherical();

let scale = 1;
const panOffset = new three.Vector3();
let zoomChanged = false;
fork icon0
star icon0
watch icon1

110
111
112
113
114
115
116
117
118
119
120
  return oldDir.applyMatrix3(R);
}


// Calculate angle noise
function noiseA(dir,errA){
  var tempSphere = new THREE.Spherical;
  tempSphere.setFromVector3(dir);
  tempSphere.radius = 1;
  tempSphere.phi += errA * (2 * Math.random() - 1);
  tempSphere.theta += errA * (2 * Math.random() - 1);
fork icon0
star icon0
watch icon0

Other functions in three

Sorted by popularity

function icon

three.Vector3 is the most popular function in three (22341 examples)