Is there a way to represent custom geometry ?

Hello, I am trying to create and display a primitive with the Geometry class. When I run my code, I got the following errors:

TypeError: Cannot read property 'center' of undefined
TypeError: Cannot read property 'center' of undefined
    at createVertexArray (https://cesiumjs.org/Cesium/Source/Scene/Primitive.js:1014:59)
    at Primitive.update (https://cesiumjs.org/Cesium/Source/Scene/Primitive.js:1381:13)
    at PrimitiveCollection.update (https://cesiumjs.org/Cesium/Source/Scene/PrimitiveCollection.js:366:27)
    at updatePrimitives (https://cesiumjs.org/Cesium/Source/Scene/Scene.js:1850:27)
    at executeCommandsInViewport (https://cesiumjs.org/Cesium/Source/Scene/Scene.js:1808:9)
    at updateAndExecuteCommands (https://cesiumjs.org/Cesium/Source/Scene/Scene.js:1707:17)
    at render (https://cesiumjs.org/Cesium/Source/Scene/Scene.js:2043:9)
    at Scene.render (https://cesiumjs.org/Cesium/Source/Scene/Scene.js:2081:13)
    at CesiumWidget.render (https://cesiumjs.org/Cesium/Source/Widgets/CesiumWidget/CesiumWidget.js:675:25)
    at render (https://cesiumjs.org/Cesium/Source/Widgets/CesiumWidget/CesiumWidget.js:70:32)
OK

I found out that code tried to access to "geometry.boundingSphereCV.center" (line 1014:59 in Primitive.js file) but the geometry object doesn't contain boundingSphereCV.

Does anyone know why this error are occurring ? How to fix this?

Hello,

I’m not sure exactly what would be causing this error. Are you trying to create a new geometry type?

Take a look at this tutorial for information about the Geometry and Appearances API: http://cesiumjs.org/tutorials/Geometry-and-Appearances/

Also look at this unfinished tutorial for creating a custom geometry type: https://github.com/AnalyticalGraphicsInc/cesium/wiki/Geometry-and-Appearances

Some of the code samples in that tutorial may be a little out of date, but I believe the information in there is still relevant. That might help you debug.

Best,

Hannah

Hello Hannah,
Thank you for tutorials but unfortunately they did not allow me to find a solution.
I'm not trying to create a new geometry type.
I would like to know if there is a way to create a primitive from a matrix data which represents a surface, without using basic geometry (boxGeometry, RectangleGeometry,...)?

I don’t believe we have a primitive type that supports that type of data. What are you trying to visualize?

Best,

Hannah

I have a DTM that represent a grid of vertex with elevation (x, y, z).
Is there a way on Cesium to create a primitive (or other) with it ?

Is this terrain data? Cesium supports height maps and quantized mesh formats for terrain, but quantized mesh runs way more efficiently. Information about our supported terrain providers can be found here: http://cesiumjs.org/tutorials/Terrain-Tutorial/#terrain-providers
If you are interested in converting your data to a qunatized mesh format, AGI (the company that employs most of the Cesium team) offers a commercial product called STK Terrain Server. This is what the team at FodarEarth (demo) used to process their DEM photogrammetry data.

Best,

Hannah