Are there any libraries for easier editing of geometry, like splitting edges, bisecting faces, etc?

I’m interested in learning about how to implement these kind of geometry operations that 3d modelers like Blender, have, like splitting edges, bisecting faces, etc. I want to study different implementations of these 3d geometry modifier utilities. I was wondering if ThreeJS has any libraries for editing geometry? I’m aware of GitHub - gkjohnson/three-bvh-csg: A flexible, memory compact, fast and dynamic CSG implementation on top of three-mesh-bvh but it seems to be about boolean operations on geometry. I’m interested in the under-the-hood implementation of operations like:

  • splitting an edge
  • bisecting a face
  • connecting 2 vertices with an edge.

This BMesh article by Blender is interesting: BMesh - Blender Developer Documentation

The reason why I’m interested in ThreeJS is because I feel like it’d be a little bit simpler than the implementations that 3d engines like Blender or Unity have.

1 Like

Hi, not sure if you checked this recent post, this could be useful if you’re looking for CAD modelling algorithms

Another that might be worth a look would be Manifold:

It’s not specifically for three.js, but the two can certainly be used together.

1 Like

Hey, just wanted to share that we also expose manifold library. Here you can find short announcement:

Half edges are pretty trivial to implement, does this require a library? Maybe for those operations.

Not sure if you’re looking for manifold meshes? Are you? Do you want to 3D print stuff or make arbitrary things that look nice, eg. a car?

2 Likes

I second the recommendation of half-edge data structure… It’s pretty simple but creates the necessary scaffolding for a while bunch of geometric operations.

There is an implementation in threejs also, I think added/created by Mugen.

Here’s a basic one:

type HalfEdge = {
  next:number,
  prev:number,
  twin:number,
  face:number,
  start:number
  end:number
}