MCPcopy Create free account
hub / github.com/MeshInspector/MeshLib / main

Function main

examples/cpp-examples/CollisionPrecise.dox.cpp:8–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6#include <iostream>
7
8int main()
9{
10 auto meshA = MR::makeUVSphere(); // make mesh A
11 auto meshB = MR::makeUVSphere(); // make mesh B
12 meshB.transform( MR::AffineXf3f::translation( MR::Vector3f( 0.1f, 0.1f, 0.1f ) ) ); // shift mesh B for better demonstration
13
14 auto converters = MR::getVectorConverters( meshA, meshB ); // create converters to integer field (needed for absolute precision predicates)
15 auto collidingFaceEdges = MR::findCollidingEdgeTrisPrecise( meshA, meshB, converters.toInt ); // find each intersecting edge/triangle pair
16 // print pairs of edges triangles
17 for ( const auto& vet : collidingFaceEdges )
18 {
19 if ( vet.isEdgeATriB() )
20 std::cout << "edgeA: " << int( vet.edge ) << ", triB: " << vet.tri().get() << "\n";
21 else
22 std::cout << "triA: " << vet.tri().get() << ", edgeB: " << int( vet.edge ) << "\n";
23 }
24 return 0;
25}

Callers

nothing calls this directly

Calls 7

makeUVSphereFunction · 0.85
getVectorConvertersFunction · 0.85
isEdgeATriBMethod · 0.80
triMethod · 0.80
transformMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected