Commit 43fc2dbb authored by Fabien Grzeskowiak's avatar Fabien Grzeskowiak

add obstacle in api

parent f6b3878c
......@@ -204,4 +204,26 @@ extern "C"
return true;
}
API_FUNCTION bool AddObstacle(float* points, int nbr_points)
{
if (cs == nullptr)
return false;
std::vector<Vector2D> poly(nbr_points);
int j = 0;
for(int i = 0; i < nbr_points; i++)
{
Vector2D p = Vector2D(points[j], points[j+1]);
poly[i] = p;
j = j+2;
}
// try to add an wall obstacle
cs->GetWorld()->AddObstacle(poly);
return true;
}
}
......@@ -110,4 +110,13 @@ extern "C"{
/// <summary>Cleans up some objects related to the simulation. Call this method just before you finish using the UMANS library.</summary>
/// <returns>true if the operation was successful; false otherwise, i.e. if the simulation has not been initialized (correctly) yet.</returns>
API_FUNCTION bool CleanUp();
/// <summary>Tries to add a new obstacle polygon to the simulation.</summary>
/// <param ref="points">the array of points (x1,y1,x2,y2...)</param>
/// <param ref="nbr_points">The number of points (half size of array)</param>
/// <returns>true if the operation was successful; false otherwise,
/// i.e. if the simulation has not been initialized (correctly) yet, or if the obstacle could not be created</returns>
API_FUNCTION bool AddObstacle(float* points, int nbr_points);
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment