The pipe created with PolylineVolumeGeometry is wrong

var viewer = new Cesium.Viewer(“cesiumContainer”);

  function computeCircle(radius) {

    var positions = [];
    for (var i = 0; i < 360; i++) {
        var radians = Cesium.Math.toRadians(i);
        positions.push(new Cesium.Cartesian2(radius * Math.cos(radians), radius * Math.sin(radians)))
    }
    return positions;
}

var volume = new Cesium.PolylineVolumeOutlineGeometry({
    vertexFormat : Cesium.VertexFormat.POSITION_ONLY,
    polylinePositions : Cesium.Cartesian3.fromDegreesArrayHeights([
        -72.0, 40.0,10,
        -72.0, 40.0,100000,      
        -72.0, 42.0,300000
    ]),
    shapePositions : computeCircle(100000.0)
});

var instance = new Cesium.GeometryInstance({
    geometry : volume,
});

var primitive=viewer.scene.primitives.add(new Cesium.Primitive({
    geometryInstances : instance,
    appearance : new Cesium.PolylineMaterialAppearance({
        material : Cesium.Material.fromType('Color')
    })
}));

如何才能实现以下效果

Welcome to the Cesium Community!

Can you send a working sandcastle link (instead of the code sample) with the example? I am not able to run the provided code.

I have prepared a working example of a pipe that uses polylineVolume. Please see it here.

The positions were causing the interpolation between the points to be skewed. I have updated the positions here.

If my location must be [-90.0,32.0,0.0,-90.0,32.0,100000.0,-94.0,36.0,110000.0], is there any way to create a pipeline

Currently PolylineVolume only works for when the points are aligned such that the volume it is roughly parallel to the ellipsoid surface.

The easiest fix is to export the geometry as a model like .obj, import it to Cesium ion and load it into your app via the asset ID.

thanks for the awesome information.

1 Like

@jackyjoy123

Welcome to the community :rocket: :grinning: Let me know if you have any other questions or concerns!

-Sam