# Consistent point in path from convexHull

**URL:** <https://discourse.libcinder.org/t/consistent-point-in-path-from-convexhull/378>\
**Category:** Using Cinder\
**Created:** [November 5, 2016, 3:25am UTC](https://discourse.libcinder.org/t/consistent-point-in-path-from-convexhull/378 "2016-11-05T03:25:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hperigo](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/hperigo/32/409_2.png) [@hperigo](https://discourse.libcinder.org/u/hperigo)\
**Post date:** [November 5, 2016, 3:25am UTC](https://discourse.libcinder.org/t/consistent-point-in-path-from-convexhull/378/1 "2016-11-05T03:25:48Z")

</div>

Hi all,

I generating a PolyLine2f using the convexHull function, with that path I need to find two points in it. Everything is fine when the polyline is static, but if the convex hull points move’s around I get some glitches from the fact it changes the point indexed at 0, making `getPosition (float t) const` useless…

My initial solution is to make a line crossing the polygon and calculate it’s intersection points with the shape.

so…

1. Is there an easy way of calculating this intersections with cinder already?
2. Anyone with a better idea? 😛

I made a little video that show’s the `getPosition (0.0f)` jumping around…  
[Video](https://www.dropbox.com/s/nkh4hjo5ukzuxq2/calcConvexHull.mov?dl=0)

thankss

---

<div class="post-metadata">

**Author:** ![paul.houx](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.libcinder.org/paul.houx/32/31_2.png) [@paul.houx](https://discourse.libcinder.org/u/paul.houx)\
**Post date:** [November 5, 2016, 3:56pm UTC](https://discourse.libcinder.org/t/consistent-point-in-path-from-convexhull/378/2 "2016-11-05T15:56:56Z")

</div>

I am not sure what you mean by “I need to find two points in it”. But the `Path2d` class has more functionality than the `PolyLine` class and is more flexible as it allows you to add arcs and curve segments as well. You can call the `lineTo()` function to initialize it and then use non-const `getPoints()` or `setPoint()` to move the points around. The `contains()` function will tell you if a point is inside the (closed) shape.

I recently made a [pull-request](https://github.com/cinder/Cinder/pull/1615) that adds distance functions to `Path2d`, allowing you to calculate the distance of a point and the shape.

-Paul
