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
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);
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.
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
.
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!
Hey @insuby, would you mind sharing your solution?