MCPcopy Create free account
hub / github.com/ImageEngine/cortex / intersectionPoint

Method intersectionPoint

src/IECoreScene/MeshPrimitiveEvaluator.cpp:793–817  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

791}
792
793bool MeshPrimitiveEvaluator::intersectionPoint( const Imath::V3f &origin, const Imath::V3f &direction,
794 PrimitiveEvaluator::Result *result, float maxDistance ) const
795{
796 assert( dynamic_cast<Result *>( result ) );
797
798 if ( m_triangles.size() == 0)
799 {
800 return false;
801 }
802
803 assert( m_tree );
804
805 Result *mr = static_cast<Result *>( result );
806
807 float maxDistSqrd = maxDistance * maxDistance;
808
809 Imath::Line3f ray;
810 ray.pos = origin;
811 ray.dir = direction.normalized();
812
813 bool hit = false;
814
815 intersectionPointWalk( m_tree->rootIndex(), ray, maxDistSqrd, mr, hit );
816 return hit;
817}
818
819int MeshPrimitiveEvaluator::intersectionPoints( const Imath::V3f &origin, const Imath::V3f &direction,
820 std::vector<PrimitiveEvaluator::ResultPtr> &results, float maxDistance ) const

Callers 5

testCylinderMeshMethod · 0.95
testSimpleMethod · 0.45
testSphereMeshMethod · 0.45
testRandomTrianglesMethod · 0.45
operator()Method · 0.45

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected