Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rendering error for polyline segment along y-axis #11836

Open
javagl opened this issue Feb 16, 2024 · 0 comments
Open

Rendering error for polyline segment along y-axis #11836

javagl opened this issue Feb 16, 2024 · 0 comments

Comments

@javagl
Copy link
Contributor

javagl commented Feb 16, 2024

The following sandcastle tries to create three polylines (single segments):

const viewer = new Cesium.Viewer("cesiumContainer");

function addLine(positions) {
  const geometry = new Cesium.PolylineGeometry({
    positions: positions,
    width: 10.0,
    vertexFormat: Cesium.PolylineMaterialAppearance.VERTEX_FORMAT,
    arcType: Cesium.ArcType.NONE,
  });
  const geometryInstance = new Cesium.GeometryInstance({
    geometry: geometry,
    attributes: {
      color: Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.RED),
    },
  });
  const primitive = new Cesium.Primitive({
    asynchronous: false,
    geometryInstances: geometryInstance,
    appearance: new Cesium.PolylineColorAppearance({
      translucent: false,
    }),
  });
  viewer.scene.primitives.add(primitive);
}

const positionsX = [
  new Cesium.Cartesian3(0, 0, 0.0),
  new Cesium.Cartesian3(10000000, 0, 0),
];
const positionsYa = [
  new Cesium.Cartesian3(0, 0, 0.1),
  new Cesium.Cartesian3(0, 10000000, 0),
];
const positionsYb = [
  new Cesium.Cartesian3(0, 0, 0.0),
  new Cesium.Cartesian3(0, 10000000, 0),
];
addLine(positionsX); // Works
addLine(positionsYa); // Works
addLine(positionsYb); // Crashes

For the last case - a line that starts at the origin and goes along the y-axis - it results in a DeveloperError: Could not project point (0, 0, 0) to 2D.. This seems to be a very special case, but as such, should probably be handled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment