Plane passing throw points

Hey everyone,

I’m trying to simply have a plane passing throw 3 points, but i can’t
Here is a sandcastle demo where i try to fit a plane on points :
Sand Demo

Any advise ?

Short answer:

var planeEntity = viewer.entities.add(new Cesium.Entity(
    plane: {
        dimensions: new Cesium.Cartesian2(50,50),
        material: Cesium.Color.fromHsl(0, 1, 0.5, 0.2),
        plane: new Cesium.Plane.fromPointNormal(Cesium.Cartesian3.ZERO, normal)
    position: new Cesium.Cartesian3(m_x,m_y,m_z),

    // !!!
    orientation: Cesium.Quaternion.IDENTITY  // <---------------- ADD THIS LINE!
    // !!!

Longer answer:

When an Entity is created from a plane, then the orientation of the plane will depend on the position of the entity. For example, see the following sandcastle:

The planes both have the same normal. But they are displayed with this normal at the respective position on the globe, and therefore, are oriented differently:

Cesium Planes

Explicitly setting the orientation for the entity avoids this.

An aside: You are doing some computations manually. For example, the computation of the cross product of two vectors. You could use Cartesian3.cross for that. Here is an example of your original sandcastle, where this computation has been replaced:

1 Like

Hi @Marco13 ,
Thanks for the explanation and for your Sandcastle Demo, I learned a lot from it ! :slight_smile: