Isovist analaize using cesium

I am looking for some ideas about running isovist analyze using cesium,

Could some one gives me some hints and start points?

here is some information about it

I think the easiest way could be loop around 360 degree and then find the nearest object in each direction and draw a boundry…Again for make a 3d shape we must loop around in vertical to form a geometry,
But it seems too heavy process…IS there any simpler way?

Here I’ll write as I go forward in case that may be usefull and also new ideas are welcome, I am some how noob

I found the Ray which seems is exactly what I need,

I should now loop 360,180 for a point,

Does any one has any suggestion in case of improvement of preformance ?

Well,I go forward and get to this code

var handler = new Cesium.ScreenSpaceEventHandler(viewer.canvas);
handler.setInputAction(function(click) {

  //  var pickedObject = scene.pick(click.position);

       // addToMessage('target',;
        var position =;
        var cartographicPosition = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position);

    var y=Cesium.Math.toDegrees(cartographicPosition.latitude);
    var x=Cesium.Math.toDegrees(cartographicPosition.longitude);
    var radius=100;
    var segmants=10;
    var origin=  new Cesium.Cartesian3(x, y, 0);
    var shape = [];
    for (i = 0; i < segmants; i++) {
        var teta=segmants*i;
        var a =x+Math.cos(teta)*radius;
        var b =y+Math.sin(teta)*radius;

        var direction=  new Cesium.Cartesian3(a, b, 0);
        var ray=new Cesium.Ray(origin, direction);

        var intersection = Cesium.IntersectionTests.rayEllipsoid(ray, bluePolygon);
        var point = Cesium.Ray.getPoint(ray, intersection.start);


 //   shape.push(shape[0]);
   // shape.push(shape[1]);
    var resultPolygon = viewer.entities.add({
        name : 'result',
        polygon : {
            hierarchy : Cesium.Cartesian3.fromDegreesArray(shape),
            material : Cesium.Color.YELLOW

}, Cesium.ScreenSpaceEventType.LEFT_CLICK);


It seems to work but does not work…Can some one gives me some hints about it?

Intersection part does not work

well…finally I managed to do it…
here is its video,

but I think cesium liberary lakes in intersection part…