MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/Imath / intersectTuple

Function intersectTuple

src/python/PyImath/PyImathLine.cpp:334–367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

332
333template <class T>
334static tuple
335intersectTuple(Line3<T> &line, const tuple &t0, const tuple &t1, const tuple &t2)
336{
337
338 if(t0.attr("__len__")() == 3 && t1.attr("__len__")() == 3 && t2.attr("__len__")() == 3)
339 {
340 Vec3<T> v0, v1, v2, pt, bar;
341 bool front;
342 v0.x = extract<T>(t0[0]);
343 v0.y = extract<T>(t0[1]);
344 v0.z = extract<T>(t0[2]);
345
346 v1.x = extract<T>(t1[0]);
347 v1.y = extract<T>(t1[1]);
348 v1.z = extract<T>(t1[2]);
349
350 v2.x = extract<T>(t2[0]);
351 v2.y = extract<T>(t2[1]);
352 v2.z = extract<T>(t2[2]);
353
354 if(IMATH_NAMESPACE::intersect(line, v0, v1, v2, pt, bar, front))
355 {
356 tuple t = make_tuple(pt, bar, front);
357 return t;
358 }
359 else
360 {
361 tuple t;
362 return t;
363 }
364 }
365 else
366 throw std::invalid_argument ( "Line3 expects tuple of length 3");
367}
368
369template <class T>
370static Vec3<T>

Callers

nothing calls this directly

Calls 1

intersectFunction · 0.85

Tested by

no test coverage detected