Warning, /education/kstars/kstars/htmesh/NOTES is written in an unsupported language. File is not indexed.
0001 test if a triangle (id) is rejected: 0002 0003 Implicitly, id is used in macro NV 0004 0005 mark = testNode(V(NV(0)),V(NV(1)),V(NV(2))); 0006 0007 testNode takes SpatialVectors and returns reject, full, partial or dontknow 0008 it would make more sense to have a testnode(id) and macros have no implicit reference to id 0009 0010 OPTIMIZE: 0011 The expresiion index->nodes_[id] gets evaluated three times, instead of once. 0012 0013 0014 testNode( 0015 index->vertices_[ index->nodes_[id].v_[0]] 0016 index->vertices_[ index->nodes_[id].v_[1]] 0017 index->vertices_[ index->nodes_[id].v_[2]] 0018 0019 This simple thing took the runtime from 6.36 to 6.24 (time intersect -count -range 14 ex4) 0020 0021 INTERESTING TRIVIA: 0022 in gnu C++, references are slower than pointers 0023 0024 // Slow: const struct SpatialIndex::QuadNode &indexNode = index_->nodes_[id]; 0025 const struct SpatialIndex::QuadNode *indexNode = &index_->nodes_[id]; //faster