Hello,

do you know if does exist a method to obtain a geometry based on two planes?

for example:

where the planes are P0 and P1 and I need to create the geometry(marked with dashed line).

Sorry for bothering.

Thank you.

Hello,

do you know if does exist a method to obtain a geometry based on two planes?

for example:

where the planes are P0 and P1 and I need to create the geometry(marked with dashed line).

Sorry for bothering.

Thank you.

How do you generate P1 and P2?

Should the geometry of four rectangles be dynamic?

Hi, thanks for the answer.

P0 and P1 are instances of PlaneGeometry and no, it shouldn’t be dynamic.

The sketch does not show exactly which surfaces you want to create in addition to P1 and P2. Top and bottom or front and back.

I also assume that P1 and P2 are not parallel, otherwise it would be trivial.

I wish to create the whole polygon(planes + dashed edges). And, yes, the planes aren’t necessarily parallel

Add P1 and P2 to a group => three.js docs

Create lines of the desired length and apply LineDashed material to them => three.js docs

(example => three.js examples)

Add the lines to the group.

The problem is: how long should the lines be and where should I place them?

A similar approach could work if you know where the vertices of the planes lies. Is there any way to do so?

If you create P1 and P2 (size) and position them (rotation, shift), you have all the coordinates you need. The line can use these coordinates => three.js docs

I would have the coordinates of the center of the plane. How do I get the vertices?

This is a bit of vector math.

Then it is certainly easier to create P1 and P2 as user-defined geometry at their desired location. Then you immediately have the coordinates needed for the lines.

Simple user-defined geometry examples you can find e.g. in the Collection of examples from discourse.threejs.org

BeginnerExample step 02

Possibly ConvexGeometry => three.js docs is also an option to use the coordinates directly.

Hello, thanks again for your help.

I’ve found useful your suggestion to use ConvexGeometry. The only problem is that, when I rotate the created object(using the lookAt method), I loose the points:

```
//points := an array of Vector3 objects
const cg = new THREE.ConvexGeometry(points);
const mesh = new THREE.Mesh(cg,<some material>);
mesh.lookAt(someVector);
```

Is there a way to update the points array after the rotation has occurred?

If you manipulate the mesh after creation, the positions change. Then ConvexGeometry is not better than PlaneGeometry. My idea was to select the points to fit and then leave the mesh unchanged.

*For clarification:*

Which coordinates and values are the starting point for creating the geometry.

From this may depend on what is the best way to solve.