Get lat/long/altitude of a cone's apex

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

I'd like to interrogate a cone to determine the lat/long/alt of its apex.

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

I'm using this Sandcastle:

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I'd like to draw an entity at the apex.

4. The Cesium version you're using, your operating system and browser.


Hi! If I understand your question, it seems like you are trying to gauge the position (lat, lon, h) of the top of the cone?

In the particular example, since the cone is standing with its apex upwards, I believe the position of the apex would have the same latitude and longitude as the position of the entity, while the height will be exactly half the length of the cone. It would be half since the position of the cone is defined at the middle of the cone.

So in this case, the position of the entity is: Cesium.Cartesian3.fromDegrees(-105.0, 40.0, 200000.0).

The position of the apex would then be: Cesium.Cartesian3.fromDegrees(-105.0, 40.0, 400000.0).

Thanks Jane, yes trying to gauge the position of the tip of the cone. However I would like to know that position no matter which orientation the cone is in.

Would you have access to the orientation/transformation matrix that rotated the cone? If so, you can use that to transform the un-oriented cone’s apex to be the oriented cone’s apex. I don’t think Cesium has a way of directly accessing the apex of a cone.

Thanks Jane, I do have access to the orientation. How can I use that to deduce the orientated cone's apex?

Hi, so instead of using orientation, there’s a cleaner solution with the entity’s modelMatrix!

Check out this sandcastle. :slight_smile:

For a quick access, the main piece of code from the sandcastle is:

// Apex position relative to the center of the cone
var localApexPos = new Cesium.Cartesian3(0, 0, 10);

var modelMatrix = rotatedCone.computeModelMatrix(new Cesium.JulianDate());

var newApexPos = Cesium.Matrix4.multiplyByPoint(modelMatrix, localApexPos, new Cesium.Cartesian3());


Jane! Thanks so much. That is exactly what I was look for :slight_smile: