0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Cesium Z軸0の円サンプル

Posted at

image.png

const viewer = new Cesium.Viewer("cesiumContainer");
const entities = viewer.entities;
const scene = viewer.scene;
const globe = scene.globe;
/*
  globe.showGroundAtmosphere = false;
  globe.baseColor = Cesium.Color.TRANSPARENT;
  globe.translucency.enabled = true;
  globe.undergroundColor = undefined;
const baseLayer = viewer.scene.imageryLayers.get(0);
  baseLayer.colorToAlpha = new Cesium.Color(0.0, 0.016, 0.059);
  baseLayer.colorToAlphaThreshold = 0.2;
*/

// X,Yの円 (x−a)2+(y−b)2=r2
// 中心緯度経度 36,135,
// 半径300,000 m
let Hankei = 300000;
let Ido = 90.0;
let Keido = 135.0;

let centerXYZ = new Cesium.Cartesian3.fromDegrees(Keido, Ido);

// 中心ポイント
const centerPoint = viewer.entities.add({
  position: Cesium.Cartesian3.fromDegrees(Keido, Ido),
  ellipsoid: {
    radii: new Cesium.Cartesian3(10000.0, 10000.0, 10000.0),
    material: Cesium.Color.RED,
  },
});

console.log("center:"+centerXYZ);

let line_XY = [];

for( let theta = 0; theta <= 360; theta+= 40 ){
  
  let radi = theta * (Math.PI / 180)
  let X = centerXYZ.x + Hankei * Math.cos(radi);
  let Y = centerXYZ.y + Hankei * Math.sin(radi);

  line_XY.push(new Cesium.Cartesian3.fromElements(X, Y, centerXYZ.z));

  
  let point =  viewer.entities.add({
    position: Cesium.Cartesian3.fromElements(X, Y, centerXYZ.z),
    ellipsoid: {
      radii: new Cesium.Cartesian3(10000.0, 10000.0, 10000.0),
      material: Cesium.Color.YELLOW,
    },
  });
}

let line_Z_0 =  viewer.entities.add({
    polyline: {
      positions: line_XY,
     }
  });

viewer.zoomTo(viewer.entities);
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?