#include <segment.hh>
Inheritance diagram for oln::snakes::segment< I >:
Public Types | |
typedef std::vector< node< I > >::iterator | iter_type |
typedef std::vector< node< I > >::const_iterator | const_iter_type |
typedef I::point_type | point_type |
Public Member Functions | |
segment (std::list< point_type > &initial_contour) | |
ntg::float_s | energy (const I &gradient) const |
std::list< point_type > | contour (void) const |
Return the points of the segment. | |
const_iter_type | begin (void) const |
iter_type | begin (void) |
Return an iterator on the first node of the segment. | |
const_iter_type | end (void) const |
iter_type | end (void) |
Return an iterator on the last node of the segment. | |
const node< I > | prev_node (void) const |
Node before the first node of this segment. | |
const node< I > | next_node (void) const |
Node after the next node of this segment. | |
Friends | |
std::ostream & | operator<< (std::ostream &, const segment &) |
Definition at line 45 of file segment.hh.
|
Just iterate through the vector and sums up point energies.
Definition at line 49 of file segment.hxx. References oln::snakes::segment< I >::next_node(), and oln::snakes::segment< I >::prev_node().
00050 { 00051 ntg::float_s e = 0.f; 00052 typename segment<I>::const_iter_type p = nodes.begin(); 00053 typename segment<I>::const_iter_type c = nodes.begin(); 00054 typename segment<I>::const_iter_type n = nodes.begin(); 00055 00056 ++n; 00057 e += c->energy(gradient, prev_node(), *n); 00058 for (++c, ++n; n != nodes.end(); ++p, ++c, ++n) 00059 e += c->energy(gradient, *p, *n); 00060 e += c->energy(gradient, *p, next_node()); 00061 return e; 00062 } |