Add maxhullvert.
PiperOrigin-RevId: 641092710 Change-Id: Ib4fa828a9c82531614f0a67de9990340dbb25406
This commit is contained in:
committed by
Copybara-Service
parent
fb8bf206d9
commit
ace0c8f0a3
@@ -446,6 +446,7 @@ typedef struct mjsMesh_ { // mesh specification
|
||||
double refquat[4]; // reference orientation
|
||||
double scale[3]; // rescale mesh
|
||||
mjtByte smoothnormal; // do not exclude large-angle faces from normals
|
||||
int maxhullvert; // maximum vertex count for the convex hull
|
||||
mjFloatVec* uservert; // user vertex data
|
||||
mjFloatVec* usernormal; // user normal data
|
||||
mjFloatVec* usertexcoord; // user texcoord data
|
||||
|
||||
@@ -243,6 +243,7 @@ void mjs_defaultMesh(mjsMesh* mesh) {
|
||||
memset(mesh, 0, sizeof(mjsMesh));
|
||||
mesh->refquat[0] = 1;
|
||||
mesh->scale[0] = mesh->scale[1] = mesh->scale[2] = 1;
|
||||
mesh->maxhullvert = -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+11
-6
@@ -50,8 +50,8 @@
|
||||
|
||||
#include <mujoco/mjmacro.h>
|
||||
#include <mujoco/mjmodel.h>
|
||||
#include <mujoco/mjtnum.h>
|
||||
#include <mujoco/mjplugin.h>
|
||||
#include <mujoco/mjtnum.h>
|
||||
#include "engine/engine_crossplatform.h"
|
||||
#include "engine/engine_io.h"
|
||||
#include "engine/engine_plugin.h"
|
||||
@@ -135,6 +135,7 @@ mjCMesh::mjCMesh(mjCModel* _model, mjCDef* _def) {
|
||||
center_ = NULL;
|
||||
graph_ = NULL;
|
||||
needhull_ = false;
|
||||
maxhullvert_ = -1;
|
||||
invalidorientation_.first = -1;
|
||||
invalidorientation_.second = -1;
|
||||
validarea_ = true;
|
||||
@@ -223,6 +224,7 @@ void mjCMesh::CopyFromSpec() {
|
||||
facetexcoord_ = spec_facetexcoord_;
|
||||
file = &file_;
|
||||
content_type = &content_type_;
|
||||
maxhullvert_ = spec.maxhullvert;
|
||||
uservert = &vert_;
|
||||
usernormal = &normal_;
|
||||
userface = &face_;
|
||||
@@ -1548,12 +1550,17 @@ double& mjCMesh::GetVolumeRef(mjtGeomInertia type) {
|
||||
|
||||
|
||||
// make graph describing convex hull
|
||||
void mjCMesh::MakeGraph(void) {
|
||||
void mjCMesh::MakeGraph() {
|
||||
int adr, ok, curlong, totlong, exitcode;
|
||||
double* data;
|
||||
facetT* facet, **facetp;
|
||||
vertexT* vertex, *vertex1, **vertex1p;
|
||||
char qhopt[10] = "qhull Qt";
|
||||
|
||||
std::string qhopt = "qhull Qt";
|
||||
if (maxhullvert_ > -1) {
|
||||
// qhull "TA" actually means "number of vertices added after the initial simplex"
|
||||
qhopt += " TA" + std::to_string(maxhullvert_ - 4);
|
||||
}
|
||||
|
||||
// graph not needed for small meshes
|
||||
if (nvert() < 4) {
|
||||
@@ -1585,7 +1592,7 @@ void mjCMesh::MakeGraph(void) {
|
||||
qh->NOerrexit = false;
|
||||
if (!exitcode) {
|
||||
// actual init
|
||||
qh_initflags(qh, qhopt);
|
||||
qh_initflags(qh, const_cast<char*>(qhopt.c_str()));
|
||||
qh_init_B(qh, data, nvert(), 3, False);
|
||||
|
||||
// construct convex hull
|
||||
@@ -1742,8 +1749,6 @@ void mjCMesh::MakeGraph(void) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// copy graph into face data
|
||||
void mjCMesh::CopyGraph(void) {
|
||||
// only if face data is missing
|
||||
|
||||
@@ -778,6 +778,7 @@ class mjCMesh_ : public mjCBase {
|
||||
// size of mesh data to be copied into mjModel
|
||||
int szgraph_; // size of graph data in ints
|
||||
bool needhull_; // needs convex hull for collisions
|
||||
int maxhullvert_; // max vertex count of convex hull
|
||||
|
||||
mjCBoundingVolumeHierarchy tree_; // bounding volume hierarchy
|
||||
std::vector<double> face_aabb_; // bounding boxes of all faces
|
||||
|
||||
Reference in New Issue
Block a user