# .computeLineDistances() with BufferGeometry

**URL:** <https://discourse.threejs.org/t/computelinedistances-with-buffergeometry/644>\
**Category:** Questions\
**Tags:** buffergeometry, lines\
**Created:** [July 24, 2017, 4:23pm UTC](https://discourse.threejs.org/t/computelinedistances-with-buffergeometry/644 "2017-07-24T16:23:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Singularity](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@Singularity](https://discourse.threejs.org/u/Singularity)\
**Post date:** [July 24, 2017, 4:23pm UTC](https://discourse.threejs.org/t/computelinedistances-with-buffergeometry/644/1 "2017-07-24T16:23:32Z")

</div>

Hello, I am trying to use BufferGeometry with ShaderMaterial because I want to add custom line types to my lines. Previously I was using Geometry and it was working perfectly find due to Geometry computelinedistance() capability. However, since I am not updating my geometry after the initial draw I found it to be much more efficient to use BufferGeometry but at last I have ran into this trade off. Is there any way I can get past this?  
I have tried implementing my own computelinedistance into the threejs library for BufferGeometry because I know my positions are in order and do not repeat or have indices, but still does not work. I also may be able to provide the line distances before drawing. Any suggestions?

I know this topic has been briefly explained here: [https://github.com/mrdoob/three.js/issues/7013](https://github.com/mrdoob/three.js/issues/7013) by the great WestLangley himself, but that was awhile ago and no progress has seem to be made. Please help.

---

<div class="post-metadata">

**Author:** ![Mugen87](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/mugen87/32/5645_2.png) [@Mugen87](https://discourse.threejs.org/u/Mugen87)\
**Post date:** [July 25, 2017, 8:10pm UTC](https://discourse.threejs.org/t/computelinedistances-with-buffergeometry/644/2 "2017-07-25T20:10:55Z")

</div>

I think it’s a good idea if you post your comment at the linked issue. It is still a valid and useful feature request. It just needs some new attention 😉

---

<div class="post-metadata">

**Author:** ![Singularity](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@Singularity](https://discourse.threejs.org/u/Singularity)\
**Post date:** [July 25, 2017, 8:14pm UTC](https://discourse.threejs.org/t/computelinedistances-with-buffergeometry/644/3 "2017-07-25T20:14:31Z")

</div>

You are right, it is still open!

---

<div class="post-metadata">

**Author:** ![Alex](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/alex/32/9027_2.png) [@Alex](https://discourse.threejs.org/u/Alex)\
**Post date:** [December 28, 2020, 3:53pm UTC](https://discourse.threejs.org/t/computelinedistances-with-buffergeometry/644/4 "2020-12-28T15:53:40Z")

</div>

I see this ticket is already close but with the dynamic line code it is not working i am not getting a dashedline

---

<div class="post-metadata">

**Author:** ![prisoner849](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/prisoner849/32/535_2.png) [@prisoner849](https://discourse.threejs.org/u/prisoner849)\
**Post date:** [December 29, 2020, 6:54am UTC](https://discourse.threejs.org/t/computelinedistances-with-buffergeometry/644/5 "2020-12-29T06:54:49Z")

</div>

@Alex  
[`.computeLineDistances()`](https://threejs.org/docs/index.html#api/en/objects/Line.computeLineDistances) is a method of `THREE.Line()` (also `LineLoop` and `LineSegments`)

---

<div class="post-metadata">

**Author:** ![Alex](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/alex/32/9027_2.png) [@Alex](https://discourse.threejs.org/u/Alex)\
**Post date:** [December 29, 2020, 7:08am UTC](https://discourse.threejs.org/t/computelinedistances-with-buffergeometry/644/6 "2020-12-29T07:08:03Z")

</div>

@prisoner849 yes it is working fine now thanks
