Arbitrary Polygons and Rotation

Hello! I am fairly new to Cesium and have been experimenting around with different parts of the Sandcastle examples. However, there are a few things I have not been able to figure out.

Is there a way to define an arbitrary polygon shape in Cesium? I'm not really interested in giving them a texture, but I am looking to give them color and levels of transparency. I'd like to be able to define such shapes dynamically in my application and define their position by Lat, Lon, and Altitude. Is there some example out there to view?

Also, how would one go about rotating such an object? I believe I would have to use Quaternion.fromAxisAngle(), but I would like to see an example of how this is done to an object.

Thanks!

By “arbitrary polygon”, do you mean a mesh? Cesium has a large library of geometries, see:

http://cesiumjs.org/2013/11/04/Geometry-and-Appearances/

If none of them fit your needs, it is possible to write a custom geometry. Here is a draft tutorial (the code examples may be slightly dated):

Geometry and Appearances · CesiumGS/cesium Wiki · GitHub

For a simple example, see the box geometry:

https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Core/BoxGeometry.js

https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Workers/createBoxGeometry.js

Patrick

Thanks! I will check those out.