Angle geometry/plane from points

Hi,
Trying to create a rotated geometry/plane from these points,

 var points = [
        [ -400,  200 ],
        [  400,  200 ],
        [  400, -200 ],
        [ -400, -200 ],
     ];
     

I then have passed points to vector3 and included z values and sent the output to console and I get the following:

x, y, z  -400 200 0
x, y, z  400 200 0
x, y, z  400 -200 30
x, y, z  -400 -200 30

I then create the a Three.shape using push( new THREE.Vector3( x, y, z ) ) and a geometry of this shape but when I create a mesh of this it does not angle.

My question is:

Is this the correct approach to create a rectangular surface that is angled ?

Shape operates with sets of Vector2, thus, when you pass a set of Vector3, it doesn’t take z-coord in count. That’s why you get a non-inclined plane.

If I were you, in the case of creation of a plane by four points, I would use PlaneGeometry, replacing positions of vertices with my own ones, using .setFromPoints().

Demo: https://codepen.io/prisoner849/full/WbNEVja

2 Likes

Thank you for the reply and example.

Also for the clarification on Shape passing to Vector2, which I had totally missed!

Much appreciated !