From 133742d6e75ea245d95b565b06c88e41db3a6efc Mon Sep 17 00:00:00 2001
From: Sergi Hernandez Juan <shernand@iri.upc.edu>
Date: Wed, 4 Oct 2023 18:49:57 +0200
Subject: [PATCH] Generate the spline in case it is not already generated in
 the evaluate() function.

---
 src/g2_spline.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/g2_spline.cpp b/src/g2_spline.cpp
index f79b3b6..f3cdbd9 100644
--- a/src/g2_spline.cpp
+++ b/src/g2_spline.cpp
@@ -865,6 +865,8 @@ void CG2Spline::generate(double &resolution,double n1,double n2, double n3, doub
 
 bool CG2Spline::evaluate(double length, TPoint& point)
 {
+  if(!this->generated)
+    this->generate(DEFAULT_RESOLUTION);
   if (length < -this->resolution || length > (this->length[this->num_points-1]+this->resolution))
     return false;
   else if(length<0.0)
-- 
GitLab