# Pyramid Directions Help

I’ve got two pyramidal sensors defined in STK, very basic sensors, one oriented to look ‘vertical’ and the other ‘horizontal’. They are published in the STK data federate at ‘/Public/Users/mmacaulay428634/Outgoing/’. I’ve been working some STK folks to get some of these sensors into our Cesium globe with some cool analytics but am having a little bit of trouble getting the pyramid directions working. I have the xHalfAngle and yHalfAngle properties on the sensor, but am having trouble translating those values to the “unitSpherical” “directions” property of the pyramid. I’ve tried all sorts of various combinations but I’m honestly feeling around in the dark. Any guidance would be appreciated. My most current thought is that I need to use some trig to build the vertices. My code is below:
function buildPyramid(fov){

``````    var x = fov.xHalfAngle,

y = fov.yHalfAngle,

hyp = Math.sqrt(x*x+y*y),

atan = Math.atan(y / x);

var pyramid = {

directions : {

// cesium defines it this way, whereas we only get x and y half-angles.

// Assume its square shaped and

unitSpherical : [

Math.PI / 4 + atan,

hyp,

Math.PI / 4 + Math.PI - atan,

hyp,

Math.PI / 4 + Math.PI + atan,

hyp,

Math.PI / 4 -atan,

hyp

]

},

"material" : {

"solidColor" : {

"color" : {

"rgba" : sensorColor

}

}

}

};

return pyramid;

}
``````

I add in the Position and Orientation properties later (if it helps from an STK service we’re using). Currently this seems close, but I have a feeling I’m missing something. Does anyone have experience with both STK and cesium pyramids have any ideas? Is there any Cesium module that will allow one to specify x and y half angles and get a unit spherical direction property?

Mike