CesiumGS / CesiumGS/cesium

Rendering error for entity at origin

Open
#12,150 9 comments 0 reactions 1 assignee Claimed by @mzschwartz5 View on GitHub
category - entity onramping type - bug
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

When creating an entity at (0,0,0), it crashes with

> TypeError: Cannot read properties of undefined (reading 'longitude')

Sandcastle:

https://sandcastle.cesium.com/index.html#c=dY/BSsQwEIZfZeiphZK6eFu7RehV8CB46iVtRh02nZRM2nWVfXeT9rLoCnPI/Pm+n2RwLAEWwhN6OADjCVoUmkf1umZ5lw3r3joOmhh9lxUPHW+GQg4UCEVpY/LvjgEmJzFxvL/uarUP8aT5Pr8rIU1RJrh3n3tYNQBDI7JEU/5TdyWkKRJ/if4lPSQrs1rC2WKz1QA80jg5H2D2NleqCjhOVseOqp+HIwY1iCQxoXV1rdaGFiBzuPFlGKwWiTdvs7Uv9IVd1tRV5P+o1mlD/P68oLf6nLCPXfO0hUqpuorrbTM4Z3vtfzX/AA

It's pretty simple:
```
const viewer = new Cesium.Viewer("cesiumContainer");
viewer.entities.add({
position: new Cesium.Cartesian3(0, 0, 0),
box: {
dimensions: new Cesium.Cartesian3(1, 1, 1)
},
});
```

This is caused here: https://github.com/CesiumGS/cesium/blob/89d15af5d2c0338a59f91f3dfa666ad8478f694b/packages/engine/Source/Scene/Primitive.js#L1530

The `cartesianToCartographic` function is returning `undefined` when receiving the center.

(I'll just put it at (0, 0, 1e-15) for now...)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.