Create a curved plane surface which dynamically changes its size

Constructively, this can be designed to match the sketch Create a curved plane surface which dynamically changes its size (page 8, left column only) like this


Only one triangle is necessary in addition to the triangles of the three streets.
The angle can be used for simple calculation of the coordinates of the vertices in the area of the branch.

2 Likes

Hi @hofk,

Thanks for your suggestion and I will have a try.

In addition, I’d like to ask another question that you mentioned above, page 16.

Since only the components x and z of the normal are used, but the y component is not always 0, it resulted in different road widths.

I followed your code but it didn’t work. I still got the different road widths if observing them carefully.

    for ( var j = 0; j < lss; j ++ ) { // length
        for ( var i = 0; i < wss; i ++ ) { // width

            // calculate here the coordinates according to your wishes

            tangent = curve.getTangent( j / ls ); //  .. / length segments
            normal.crossVectors( tangent, binormal ); 
            binormal.crossVectors( normal, tangent ); // new binormal

            normal.y = 0;

            normal.normalize();

            var lxz = Math.sqrt(normal.x*normal.x + normal.z*normal.z);
            var nx = normal.x / lxz;
            var nz = normal.z / lxz;

            //x = points[ j ].x + d[ i ] * normal.x;
            x = points[ j ].x + d[ i ] * nx;
            y = points[ j ].y;
            //z = points[ j ].z + d[ i ] * normal.z;
            z = points[ j ].z + d[ i ] * nz;

            xyzSet();
            vIdx ++;
        }
    }

My result is:

I have a hunch. Please use a wireframe material so we can see the construction.

Hi @hofk

How about this?

My suspicions were confirmed.

If you draw a circle with three.js and choose a small number for the segments, you get a triangle, square, …hexagon etc.

If you use too few length segments for the road, the road is no longer consistent.

My example with 35 and 5002020-06-11 19.56.13

2020-06-11 19.58.13

This test reveals yet another problem.

If you make the width of the side strips too large in relation to the strongest curvature, this will not work.

But these “faults” lie in the nature of the road construction.

In case of natural serpentines in the mountains, this section is also specially designed.

I hope I could help. :slightly_smiling_face:

Hi @hofk,

Yeah, I got it and thank you for your patience and explanation. Love you :hearts: