Alex
April 16, 2021, 5:00am
1
Hello All,
My main goal is to divide the merge geometry so i can get the world position of the individual geometry used in it.
Until now i am able to understand that in merge geometry this
geometry.group β this object i think contain details related to all the geometry i used.
Any possibility to achieve this.
More details
my code is some what like this.
geometries = [g1,g2,g3]
i merged them by Buffer Utils
Now they are into my scene
I need a way to find the position of g1 , g2 and g3 in my scene
This is possible. As soon as you merge geometries and produce a single mesh, the positions of the previous meshes are lost. Even if you split the geometries after merging again, you still canβt figure out the original origin in 3D space.
However, you can compute the center point of the geometries bounding boxes and use this as a position value. After splitting the geometries call BufferGeometry.computeBoundingBox()
and then do this:
const center = geometry.boundingBox.getCenter( new THREE.Vector3() );
Alex
April 16, 2021, 8:44am
3
Splitting is a part of my question. Means i have a merged geometry that is created with several geometries. So how i split them?
Also after split how i can determine with part belongs to g1 , g2, g3.
Please let me know
You need group data for this. You can then iterate over the groups and produce new geometries.
1 Like
Alex
April 16, 2021, 8:46am
5
I see you mean , that group data start to count help me to iterate through the position and get geometries.
1 Like
Alex
April 19, 2021, 11:40am
6
Hello @Mugen87 can you please let me know what exactly the min and max vector denotes to in the bounding box.
Also as we are able to find the center so is there any way to get the lower left or any corner of the geometry.
These are the minimum and maximum bounds of the AABB along the x/y/z axes.
Have you tried using Box3.getCenter() ?
1 Like
Alex
April 22, 2021, 12:04pm
8
Yes this is working absolutely fine . I am marking this as an solution though.
But i need one help
i want to calculate the corner of my plans
So what i am doing is i am using math
i.e x - plan.width/2, z- plan.length/2
Because i am working in xz plan
But when my plan have some rotation like 45 degree or 120 in xz plan so this formula is giving wrong corner point i think so.
This formula i wrote for lower left corner of my plan