INNER CODE UNIT · C++

halfLength

mosra/magnum-integration · src/Magnum/DartIntegration/ConvertShapeNode.cpp:148

            Float halfLength = 0.5f*h/r;

            shapeData.meshes = Containers::Array<Trade::MeshData>(NoInit, 1);
            new(&shapeData.meshes[0]) Trade::MeshData{Primitives::capsule3DSolid(32, 32, 32, halfLength)};

            Matrix4 rot = Matrix4::rotationX(90.0_degf);
            MeshTools::transformVectorsInPlace(rot, shapeData.meshes[0].mutableAttribute<Vector3>(Trade::MeshAttribute::Position));
            MeshTools::transformVectorsInPlace(rot, shapeData.meshes[0].mutableAttribute<Vector3>(Trade::MeshAttribute::Normal));
        }

    /* Cone */
    } else if(shape->getType() == dart::dynamics::ConeShape::getStaticType()) {
        auto coneShape = std::static_pointer_cast<dart::dynamics::ConeShape>(shape);

        Float r = Float(coneShape->getRadius());

        if(convertTypes & ConvertShapeType::Primitive)
            shapeData.scaling = Vector3{r};

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…