How do i find center point on 3d curve?

CURVE

Hello! Can you help find a way to get the yellow center point?

default curve.geometry.boundingSphere.center gives me center where the red marker is

Hi!
Have a look at the docs: three.js docs

Something like this:

let midPoint = new THREE.Vector3();
curve.getPointAt(0.5, midPoint);
1 Like

forget to say, that I’m using the THREE.Line to draw this
And Line doesn’t have this method

Then it’s better to provide an editable working live code example to demostrate what and how you do.

Based on your line data you can replicate a pure mathematical version of your line via THREE.Path and then use the method suggested by @prisoner849.

2 Likes

how could i represent it if Path is 2d?

working on it

I’ve assumed you curve lies in a conceptual 2D plane e.g. a XY plane.

If not, it’s correct that you can’t use THREE.Path. However, you can create an instance of THREE.CurvePath and use the add() method to add instances of THREE.LineCurve3.

2 Likes

I’ll try this way

Thank you! This way enable me to get the mid point as the prisoner said. Can’t mark 2 solution at once, but you both helped me. Many thanks!

1 Like