Enhance documentation in Readme and Header
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
// |_| //
|
||||
// //
|
||||
// Copyright 2022 Mattia Montanari, University of Oxford //
|
||||
// //
|
||||
// //
|
||||
// This program is free software: you can redistribute it and/or modify it under //
|
||||
// the terms of the GNU General Public License as published by the Free Software //
|
||||
// Foundation, either version 3 of the License. You should have received a copy //
|
||||
@@ -20,34 +20,55 @@
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS //
|
||||
// FOR A PARTICULAR PURPOSE. See GNU General Public License for details. //
|
||||
|
||||
/**
|
||||
* @file openGJK.h
|
||||
* @author Mattia Montanari
|
||||
* @date 1 Jan 2022
|
||||
* @brief Main interface of OpenGJK containing quick reference and API documentation.
|
||||
*
|
||||
* More extensive explanation of what the header
|
||||
* @see http://google.com
|
||||
*/
|
||||
|
||||
#ifndef OPENGJK_H__
|
||||
#define OPENGJK_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/// @brief Use double as default precision
|
||||
/*! @brief Precision of floating-point numbers.
|
||||
*
|
||||
* Default is set to 64-bit (Double). Change this to quickly play around with 16- and 32-bit. */
|
||||
#define gkFloat double
|
||||
|
||||
/// @brief Structure of a body
|
||||
typedef struct gkPolytope_ {
|
||||
int numpoints; // Number of points defining the body
|
||||
gkFloat s[3]; // Support mapping computed last
|
||||
gkFloat **coord; // Points' coordinates
|
||||
} gkPolytope;
|
||||
/*! @brief Data structure for convex polytopes.
|
||||
*
|
||||
* Polytopes are three-dimensional shapes and the GJK algorithm works directly on their convex-hull. However the convex-hull is never computed explicity, instead each GJK-iteraion employs a support function that has a cost linearly dependen on the number of points defining the polytope. */
|
||||
typedef struct gkPolytope_
|
||||
{
|
||||
int numpoints; /*!< Number of points defining the polytope. */
|
||||
gkFloat s[3]; /*!< Furthest point retunred by the support function and updated at each GJK-iteration. For the first itearion this value is a guess - and this guess not irrelevant. */
|
||||
gkFloat **coord; /*!< Coordinates of the points of the polytope. This is owned by user who manages and garbage-collects the memory for these coordinates. */
|
||||
} gkPolytope;
|
||||
|
||||
/// @brief Structure of the simplex
|
||||
typedef struct gkSimplex_ {
|
||||
int nvrtx; // Number of simplex's vertices
|
||||
gkFloat vrtx[4][3]; // Coordinates of simplex's vertices
|
||||
} gkSimplex;
|
||||
/*! @brief Data structure for simplex.
|
||||
*
|
||||
* The simplex is updated at each GJK-iteration. For the first itearion this value is a guess - and this guess not irrelevant. */
|
||||
typedef struct gkSimplex_
|
||||
{
|
||||
int nvrtx; /*!< Number of points defining the simplex. */
|
||||
gkFloat vrtx[4][3]; /*!< Coordinates of the points of the simplex. */
|
||||
} gkSimplex;
|
||||
|
||||
/// @brief Uses the GJK algorithm to compute the minimum distance between two bodies
|
||||
gkFloat compute_minimum_distance(const gkPolytope p_, const gkPolytope q_, gkSimplex *s_);
|
||||
/*! @brief Invoke the GJK algorithm to compute the minimum distance between two polytopes.
|
||||
*
|
||||
* The simplex has to be initialised prior the call to this function. */
|
||||
gkFloat compute_minimum_distance(const gkPolytope p_, const gkPolytope q_, gkSimplex *s_);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // OPENGJK_H__
|
||||
#endif // OPENGJK_H__
|
||||
|
||||
Reference in New Issue
Block a user