Find all points where a sphere intersects a plane

Hello. I wanna to find all points where a sphere intersects a plane.


I rewrote the algorithm suggested prisoner849
[javascript - Three JS - Find all points where a mesh intersects a plane - Stack Overflow]
it works well for shapes like box, dodecaedron, but doesn’t work for a sphere
[http://jsfiddle.net/kirill321592/0fLnmq7c/12/](my code)

Hi!
As you’re getting vertex coordinates by .index, so use it in the loop, not position attribute.
Change
for (let i = 0; i < obj.geometry.attributes.position.count; i += 3) {
to
for (let i = 0; i < obj.geometry.index.count; i += 3) {

1 Like