# What is calculation of Line of sight in cesuim and projections over the building thru human vision

1. A concise explanation of the problem you're experiencing.

i am not able find exact calculation to find line of sight calculation from one latitude and longitude with human vision over buildings

2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.

code-------------------

var theta=360 ; //bearing in degre
var R= 5000 ; // distance in meters

for(var i=0;i<=theta;i++){

var dx1 = R * Math.cos(i) ;
console.log("dx=="+dx1);

var dy1 = R * Math.sin(i);
console.log("dy=="+dy1);

var delta_longitude1 = dx1/(111320*Math.cos(42.25732445310803));
console.log(delta_longitude1);

var delta_latitude1 = dy1/110540;
console.log(delta_latitude1);

Final_longitude1 = longitude + delta_longitude1;
Final_latitude1 = latitude + delta_latitude1;

var value=longitude+","+latitude+","+height+","+Final_longitude1+","+Final_latitude1+","+height;

var arr=[value];

var res = value.split(",");

name : 'Glowing blue line on the surface',
polyline : {
//positions : Cesium.Cartesian3.fromDegreesArray(res),
positions : Cesium.Cartesian3.fromDegreesArrayHeights(res),
width : 1,
material : Cesium.Color.ORANGE.withAlpha(0.5),

}
});

Your example seems to be trying to show the rays from your center point, but you’ve left out the latitude and have included a couple of ‘magic’ numbers (111320 and 110540). Below is an example of computing and drawing the rays.

Hope that helps.

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var thetaMax = 360; //bearing in degrees

var dTheta = 10;

var R = 5000; // distance in meters

var centerLLH = Cesium.Cartographic.fromDegrees(-75.5966, 40.0386 , 0.0);

var centerXYZ = Cesium.Cartographic.toCartesian(centerLLH);

// We’ll need the transformation from local coordinates to Earth-Centered, Earth-Fixed

var enuTransform = Cesium.Transforms.eastNorthUpToFixedFrame(centerXYZ);

for (var theta = 0; theta < thetaMax; theta += dTheta) {

``````var dX = R * Math.cos(Cesium.Math.toRadians(theta)) ;

var dY = R * Math.sin(Cesium.Math.toRadians(theta));

var limitENU = new Cesium.Cartesian4(dX, dY, 0.0, 1.0);

// Transform point in local coordinate system (East-North-Up) to ECEF

var limitECF = new Cesium.Cartesian4();

limitECF = Cesium.Matrix4.multiplyByVector(enuTransform, limitENU, limitECF);

name : 'Ray at ' + theta + ' degrees ENU',

polyline : {

positions : [

centerXYZ,

limitECF

],

width : 1,

material : Cesium.Color.ORANGE.withAlpha(0.5),

}

});
``````

}

``````name: 'Center',

position: new Cesium.ConstantPositionProperty(centerXYZ),

point: {

size: 8

}
``````

});

viewer.zoomTo(centerEntity);

``

Hi Scott Reynolds,

Thanks for the amazing help.

I request to share calculations on restricting line of sight projections over other buildings.

I could not find the calculations, where the line of sight rays are projected over all buildings.

**For example, there is a building, the light cannot pass thru the 3rd building where it has to stop, if the light is hitting to second building, **

can u share, how the restrictions can be done?

Regards

Dhanalakshmi

Hi Scott ,

I have received error as “ces_example.html:45 Uncaught TypeError: Cesium.Cartographic.toCartesian is not a function” in my html .

but in sandcastle,its working fine. Can you help me out. is that any problem with version ? or any other thing.

Regards

Dhana

Thank you. Will check.

Hi Gabby,

Please, tell us exactly what function you mean?