How to translate a polygon geometry along it's normal

23 views
Skip to first unread message

Qandeel Abbassi

unread,
Apr 1, 2020, 10:04:57 PM4/1/20
to cesium-dev
I am dynamically creating a polygon geometry from user given coordinates using this code:

this._primitive = new Cesium.Primitive({
geometryInstances: new Cesium.GeometryInstance({
geometry: polygonGeometry,
modelMatrix: Cesium.Matrix4.IDENTITY,
id: this.id,
}),
appearance: this.appearance
});


This code works fine and I can successfully create a polygon. Now, I would like to translate this polygon along it's normal by some distance. I am guessing that it can be achieved using the model matrix but I am not sure how to go about it. I have tried setting the model matrix to this:
Cesium.Matrix4.multiplyByTranslation(Cesium.Matrix4.IDENTITY, normalCartesian3,new Cesium.Cartesian3())
 
But the polygon disappears. Can someone let me know how to set the model matrix correctly to achieve the desired result?
Reply all
Reply to author
Forward
0 new messages