1515
1616#include < ert/geometry/geo_polygon.hpp>
1717
18- void geo_polygon_add_point (geo_polygon_type *polygon, double x, double y) {
18+ void geo_polygon_add_point (rd::Polygon *polygon, double x, double y) {
1919 polygon->xcoord .push_back (x);
2020 polygon->ycoord .push_back (y);
2121}
2222
23- void geo_polygon_add_point_front (geo_polygon_type *polygon, double x,
23+ void geo_polygon_add_point_front (rd::Polygon *polygon, double x,
2424 double y) {
2525 polygon->xcoord .insert (polygon->xcoord .begin (), x);
2626 polygon->ycoord .insert (polygon->ycoord .begin (), y);
2727}
2828
29- void geo_polygon_close (geo_polygon_type *polygon) {
29+ void geo_polygon_close (rd::Polygon *polygon) {
3030 double x = polygon->xcoord .at (0 );
3131 double y = polygon->ycoord .at (0 );
3232 geo_polygon_add_point (polygon, x, y);
@@ -60,7 +60,7 @@ static bool on_edge(double x1, double y1, double x2, double y2, double x0,
6060 edge will be identified as inside. If the force_edge_inside variable
6161 is set to false the behaviour on the edges is undefined.
6262*/
63- bool geo_polygon_contains_point (const geo_polygon_type *polygon, double x0,
63+ bool geo_polygon_contains_point (const rd::Polygon *polygon, double x0,
6464 double y0, bool force_edge_inside) {
6565 bool inside = false ;
6666 double y = y0;
@@ -117,13 +117,13 @@ bool geo_polygon_contains_point(const geo_polygon_type *polygon, double x0,
117117 included.
118118*/
119119
120- geo_polygon_type *geo_polygon_fload_alloc_irap (const char *filename) {
120+ rd::Polygon *geo_polygon_fload_alloc_irap (const char *filename) {
121121 std::string sfile{filename};
122122 std::ifstream stream{sfile};
123123 if (!stream)
124124 throw std::ios_base::failure (" Failed to open: " + sfile);
125125
126- auto polygon = std::make_unique<geo_polygon_struct >(filename);
126+ auto polygon = std::make_unique<rd::Polygon >(filename);
127127 double x, y, z;
128128
129129 while (stream >> x >> y >> z) {
@@ -146,16 +146,16 @@ geo_polygon_type *geo_polygon_fload_alloc_irap(const char *filename) {
146146 return polygon.release ();
147147}
148148
149- void geo_polygon_reset (geo_polygon_type *polygon) {
149+ void geo_polygon_reset (rd::Polygon *polygon) {
150150 polygon->xcoord .resize (0 );
151151 polygon->ycoord .resize (0 );
152152}
153153
154- size_t geo_polygon_get_size (const geo_polygon_type *polygon) {
154+ size_t geo_polygon_get_size (const rd::Polygon *polygon) {
155155 return polygon->xcoord .size ();
156156}
157157
158- void geo_polygon_iget_xy (const geo_polygon_type *polygon, int index, double *x,
158+ void geo_polygon_iget_xy (const rd::Polygon *polygon, int index, double *x,
159159 double *y) {
160160 *x = polygon->xcoord .at (index);
161161 *y = polygon->ycoord .at (index);
@@ -229,7 +229,7 @@ static XLinesStatus xsegments(const std::array<std::array<double, 2>, 4> points,
229229 }
230230}
231231
232- bool geo_polygon_segment_intersects (const geo_polygon_type *polygon, double x1,
232+ bool geo_polygon_segment_intersects (const rd::Polygon *polygon, double x1,
233233 double y1, double x2, double y2) {
234234 if (polygon->xcoord .empty ())
235235 return false ;
@@ -257,18 +257,18 @@ bool geo_polygon_segment_intersects(const geo_polygon_type *polygon, double x1,
257257 return false ;
258258}
259259
260- const char *geo_polygon_get_name (const geo_polygon_type *polygon) {
260+ const char *geo_polygon_get_name (const rd::Polygon *polygon) {
261261 return polygon->name .has_value () ? (*polygon->name ).c_str () : nullptr ;
262262}
263263
264- void geo_polygon_set_name (geo_polygon_type *polygon, const char *name) {
264+ void geo_polygon_set_name (rd::Polygon *polygon, const char *name) {
265265 if (name)
266266 polygon->name = name;
267267 else
268268 polygon->name = std::nullopt ;
269269}
270270
271- double geo_polygon_get_length (geo_polygon_type *polygon) {
271+ double geo_polygon_get_length (rd::Polygon *polygon) {
272272 if (polygon->xcoord .size () == 1 )
273273 return 0 ;
274274 else {
@@ -303,8 +303,8 @@ static bool approx_equal(const std::vector<double> &a,
303303/*
304304 Name is ignored in the comparison.
305305*/
306- bool geo_polygon_equal (const geo_polygon_type *polygon1,
307- const geo_polygon_type *polygon2) {
306+ bool geo_polygon_equal (const rd::Polygon *polygon1,
307+ const rd::Polygon *polygon2) {
308308 bool equal = polygon1->xcoord == polygon2->xcoord &&
309309 polygon1->ycoord == polygon2->ycoord ;
310310
0 commit comments