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

Method bound

src/IECoreScene/Primitive.cpp:74–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74Imath::Box3f Primitive::bound() const
75{
76 Box3f result;
77 PrimitiveVariableMap::const_iterator it = variables.find( "P" );
78 if( it!=variables.end() )
79 {
80 ConstV3fVectorDataPtr p = runTimeCast<const V3fVectorData>( it->second.data );
81 if( p )
82 {
83 const vector<V3f> &pp = p->readable();
84 using RangeType = tbb::blocked_range< const V3f* >;
85 tbb::this_task_arena::isolate( [ & result, & pp ]{
86 tbb::task_group_context taskGroupContext( tbb::task_group_context::isolated );
87 result = tbb::parallel_reduce( RangeType( pp.data(), pp.data() + pp.size(), 1000 ), Imath::Box3f(),
88 []( const RangeType& range, const Imath::Box3f& value ) -> Imath::Box3f
89 {
90 Imath::Box3f b( value );
91 for( const V3f& pos : range )
92 {
93 b.extendBy( pos );
94 }
95 return b;
96 },
97 []( const Imath::Box3f& lhs, const Imath::Box3f& rhs ) -> Imath::Box3f
98 {
99 Imath::Box3f b( lhs );
100 b.extendBy( rhs );
101 return b;
102 },
103 taskGroupContext );
104 } );
105 }
106 }
107 return result;
108}
109
110void Primitive::copyFrom( const Object *other, IECore::Object::CopyContext *context )
111{

Callers

nothing calls this directly

Calls 5

readableMethod · 0.80
dataMethod · 0.80
findMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected