Hello Alex,
Thank you for your reply!
I think I need to explain more details of the “Normal Vector”, which I mentioned in the question.
It’s more related to the data source like terrain tiles, entities, primitives and 3D Tileset models.
Actually I have wrote a demo to get the Normal Vector, but in a very roughly way. And the Normal Vector I get is not very precisely.
I added a left click event to draw the Normal Vector of the click point and return it. Here is how I tried to calculate the Normal Vector.
// choose the clicked screen_coord and two other screen cooedinates nearby (mostly these three screen coordinates will be on the same feature surface)
var screenP0 = movement.position;
var screenP1 = new Cesium.Cartesian2(movement.position.x, movement.position.y - 5);
var screenP2 = new Cesium.Cartesian2(movement.position.x - 5, movement.position.y);
// get the cartesian coordinates for each of them
var P0 = viewer.scene.pickPosition(screenP0);
var P1 = viewer.scene.pickPosition(screenP1);
var P2 = viewer.scene.pickPosition(screenP2);
// calculate the Normal Vector by Cesium.Cartesian3.cross()
var vec1 = Cesium.Cartesian3.subtract(P1, P0, new Cesium.Cartesian3());
var vec2 = Cesium.Cartesian3.subtract(P2, P0, new Cesium.Cartesian3());
var normalVec = Cesium.Cartesian3.cross(vec1, vec2, new Cesium.Cartesian3());
Draw Normal Vectors in the scene will be like this:
The Green volumes in the picture represents Normal Vector of three click positions.
====================================
But in this way, the calculated Normal Vector of the clicked position has some error which I guess might come from the getDepth() function inside viewer.scene.pickPosition().
So I am wondering if there’s some accurate methods to get the Normal Vector instead of “calculate” it.
Thanks!
Yujie