question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Corridor renders from Primitive API but not Entity API

See original GitHub issue

From #4326

This corridor renders:

var viewer = new Cesium.Viewer('cesiumContainer');
var scene = viewer.scene;

var redCorridorInstance = new Cesium.GeometryInstance({
    geometry: new Cesium.CorridorGeometry({
        positions : Cesium.Cartesian3.fromDegreesArray([
            -16.41549000000001,28.44423000000001,
            -16.41549000000001,28.44423000000001,
            -16.41505000000001,28.44430000000001,
            -16.41507000000001,28.44430000000001,
            -16.41473000000001,28.44460000000001,
            -16.41429000000001,28.44452000000001,
            -16.41430000000001,28.44453000000001,
            -16.41428000000001,28.44452000000001,
            -16.41416000000001,28.44434000000001,
            -16.41415000000001,28.44434000000001,
            -16.41397000000001,28.44408000000001
        ]),
        width : 1,
        vertexFormat : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT
    }),
    attributes : {
        color : Cesium.ColorGeometryInstanceAttribute.fromColor(new Cesium.Color(1.0, 0.0, 0.0, 0.5))
    }
});

var primitive = scene.groundPrimitives.add(new Cesium.GroundPrimitive({
    geometryInstances: [redCorridorInstance],
    appearance: new Cesium.PerInstanceColorAppearance({
        closed: true
    })
}));

scene.camera.setView({
    destination: Cesium.Cartesian3.fromDegrees(-16.41549000000001, 28.44423000000001, 100)
});

But this one doesn’t

var viewer = new Cesium.Viewer('cesiumContainer');

var redCorridor = viewer.entities.add({
    name : 'Red corridor on surface with rounded corners and outline',
    corridor : {
        positions : Cesium.Cartesian3.fromDegreesArray([
            -16.41549000000001,28.44423000000001,
            -16.41549000000001,28.44423000000001,
            -16.41505000000001,28.44430000000001,
            -16.41507000000001,28.44430000000001,
            -16.41473000000001,28.44460000000001,
            -16.41429000000001,28.44452000000001,
            -16.41430000000001,28.44453000000001,
            -16.41428000000001,28.44452000000001,
            -16.41416000000001,28.44434000000001,
            -16.41415000000001,28.44434000000001,
            -16.41397000000001,28.44408000000001
        ]),
        width : 1,
        material : Cesium.Color.RED.withAlpha(0.5),
        outline : true,
        outlineColor : Cesium.Color.RED
    }
});

viewer.zoomTo(viewer.entities);

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
hpinkoscommented, Dec 21, 2017

@CHBaker try changing the value of the granularity attribute. This is a value in radians that specifies the distance at which the line should be subdivided and pushed to the ellipsoid surface. Here’s an illustration to show what I’m talking about: image

For a really large number, the line will just cut through the ellipsoid. A smaller value will break the line up to better fit the curvature.

By default, it subdivides the line each degree (Math.PI/180 radians). A smaller value might work better for your case.

0reactions
CHBakercommented, Dec 21, 2017

Alright, I think that did it, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Primitive - Cesium Documentation
optional The geometry instances - or a single geometry instance - to render. appearance, Appearance, optional The appearance used to render the primitive....
Read more >
angular-cesium - npm
Create map based applications using cesium and angular2 components. Focusing on high performance with easy usage. Check out our Demo that contains small...
Read more >
City Sample Project Unreal Engine Demonstration
An overview of the features used to create the City Sample learning example project for Unreal Engine.
Read more >
Viewer - Cesium Documentation
The DOM element or ID that will contain the widget. options, Object, optional Object with the following properties: Name, Type, Default ...
Read more >
Entity Collection Rendering - Google Groups
I'm trying to visualize a custom GeoJSON dataset of a big city. At the moment, I'm able to parse the GeoJSON, to calculate...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found