Files
Mujoco_WASM/src/engine/engine_collision_gjk.h
T
Kyle Bayes 1e8454820d Implement initial GJK algorithm.
PiperOrigin-RevId: 645368315
Change-Id: I40a1e1023fd9f14a59e11a9dcc6ac22df241b6ae
2024-06-21 06:17:43 -07:00

41 lines
1.2 KiB
C

// Copyright 2024 DeepMind Technologies Limited
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef MUJOCO_SRC_ENGINE_ENGINE_COLLISION_GJK_H_
#define MUJOCO_SRC_ENGINE_ENGINE_COLLISION_GJK_H_
#include <mujoco/mjexport.h>
#include <mujoco/mjtnum.h>
#include "engine/engine_collision_convex.h"
#ifdef __cplusplus
extern "C" {
#endif
// internal struct with settings for GJK
struct _mjGjkConfig {
mjtNum max_iterations;
mjtNum tolerance;
};
typedef struct _mjGjkConfig mjGjkConfig;
// Returns the distance between the two objects given an initial guess x0.
MJAPI mjtNum mj_gjk(const mjGjkConfig* config, mjtCCObj* obj1, mjtCCObj* obj2, const mjtNum x0[3]);
#ifdef __cplusplus
}
#endif
#endif // MUJOCO_SRC_ENGINE_ENGINE_COLLISION_GJK_H_