How to use the cesium.Cartesian3 function in cesium

To help you get started, we’ve selected a few cesium examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github richard1015 / cesium-navigation-es6 / viewModels / NavigationViewModel.js View on Github external
var oldTransform

    if (viewModel.navigationLocked) {
      return true
    }

    if (defined(viewModel.orbitFrame)) {
      oldTransform = Matrix4.clone(camera.transform, oldTransformScratch)

      camera.lookAtTransform(viewModel.orbitFrame)
    }

    // do not look up/down or rotate in 2D mode
    if (scene.mode === SceneMode.SCENE2D) {
      camera.move(new Cartesian3(x, y, 0), Math.max(scene.canvas.clientWidth, scene.canvas.clientHeight) / 100 * camera.positionCartographic.height * distance)
    } else {
      if (viewModel.orbitIsLook) {
        camera.look(Cartesian3.UNIT_Z, -x)
        camera.look(camera.right, -y)
      } else {
        camera.rotateLeft(x)
        camera.rotateUp(y)
      }
    }

    if (defined(viewModel.orbitFrame)) {
      camera.lookAtTransform(oldTransform)
    }

    // viewModel.terria.cesium.notifyRepaintRequired();
github Webiks / GeoStrike / packages / server / src / core / background-character / background-character-manager.ts View on Github external
private calcNextLocation(from: ICartesian3Location,
                           destinationNode: PathNode,
                           characterId,
                           updateDistanceMeters: number) {
    const currentPosition = new Cesium.Cartesian3(from.x, from.y, from.z);
    const destPosition = destinationNode.location;
    const finalPosition = new Cesium.Cartesian3(
      destPosition.x,
      destPosition.y,
      destPosition.z
    );

    const distance = Cesium.Cartesian3.distance(currentPosition, finalPosition);

    // Check if reached destination node
    if (distance < updateDistanceMeters) {
      const newDestinationPath = this.getRandomLocation(destinationNode.points);
      this.bgCharacterToNextLocation.set(characterId, newDestinationPath);

      return this.calcNextLocation(from, newDestinationPath, characterId, updateDistanceMeters);
    }

    let interpolate = updateDistanceMeters / distance;
github Webiks / GeoStrike / packages / server / src / core / background-character / background-character-manager.ts View on Github external
destPosition.z
    );

    const distance = Cesium.Cartesian3.distance(currentPosition, finalPosition);

    // Check if reached destination node
    if (distance < updateDistanceMeters) {
      const newDestinationPath = this.getRandomLocation(destinationNode.points);
      this.bgCharacterToNextLocation.set(characterId, newDestinationPath);

      return this.calcNextLocation(from, newDestinationPath, characterId, updateDistanceMeters);
    }

    let interpolate = updateDistanceMeters / distance;
    interpolate = parseFloat(interpolate.toFixed(8));
    let nextLocation = new Cesium.Cartesian3();
    nextLocation = Cesium.Cartesian3.lerp(
      currentPosition,
      finalPosition,
      interpolate,
      nextLocation
    );

    const bearing = this.calculateBearing(currentPosition, nextLocation);
    return {
      heading: bearing,
      nextLocation,
    };
  }
github daniel-hilton / gltf-b3dm-convertor / b3dmConvertor.js View on Github external
function getExtentByDegree(){
    let transformMatrix = this.transformMatrix;
    let extent = this.extent;
    let northEastTop = new Cesium.Cartesian3(extent.east,extent.north,extent.top);
    let southWestBottom = new Cesium.Cartesian3(extent.west,extent.south,extent.bottom);

    Cesium.Matrix4.multiplyByPoint(transformMatrix, northEastTop, northEastTop);
    Cesium.Matrix4.multiplyByPoint(transformMatrix, southWestBottom, southWestBottom);

    let corner1 = Cesium.Cartographic.fromCartesian(northEastTop);
    let corner2 = Cesium.Cartographic.fromCartesian(southWestBottom);

    return{
        west: Math.min(corner1.longitude,corner2.longitude),
        east: Math.max(corner1.longitude,corner2.longitude),
        north: Math.max(corner1.latitude,corner2.latitude),
        south: Math.min(corner1.latitude,corner2.latitude),
        top: Math.max(corner1.height,corner2.height),
        bottom:  Math.min(corner1.height,corner2.height)
    }
}
github darwin-education / resium / src / Label / story.tsx View on Github external
.add("Basic", () => (
    
      
        <label>
        <label>
        <label>
        <label>
      </label></label></label></label>
    
  ))
  .add("Events", () =&gt; (
github darwin-education / resium / src / Label / story.tsx View on Github external
.add("Basic", () =&gt; (
    
      
        <label>
        <label>
        <label>
        <label>
      </label></label></label></label>
    
  ))
  .add("Events", () =&gt; (
github codice / ddf / ui / packages / catalog-ui-search / src / main / webapp / component / visualization / maps / cesium / map.cesium.js View on Github external
updateCluster(geometry, options) {
      if (geometry.constructor === Array) {
        geometry.forEach(innerGeometry => {
          this.updateCluster(innerGeometry, options)
        })
      }
      if (geometry.constructor === Cesium.Billboard) {
        geometry.image = DrawingUtility.getCircleWithText({
          fillColor: options.color,
          strokeColor: options.outline,
          text: options.count,
          textColor: options.textFill,
        })
        geometry.eyeOffset = new Cesium.Cartesian3(
          0,
          0,
          options.isSelected ? -1 : 0
        )
      } else if (geometry.constructor === Cesium.PolylineCollection) {
        geometry._polylines.forEach(polyline => {
          polyline.material = Cesium.Material.fromType('PolylineOutline', {
            color: determineCesiumColor('rgba(0,0,0, .1)'),
            outlineColor: determineCesiumColor('rgba(255,255,255, .1)'),
            outlineWidth: 4,
          })
        })
      } else if (geometry.showWhenSelected) {
        geometry.show = options.isSelected
      } else {
        geometry.show = !options.isSelected
github darwin-education / resium / src / Label / story.tsx View on Github external
.add("Basic", () =&gt; (
    
      
        <label>
        <label>
        <label>
        <label>
      </label></label></label></label>
    
  ))
  .add("Events", () =&gt; (