]> Creatis software - cpMesh.git/blob - lib/cpm/Algorithms/QuadEdge/SquaredEdgeLengthDecimationFilter.hxx
First commit
[cpMesh.git] / lib / cpm / Algorithms / QuadEdge / SquaredEdgeLengthDecimationFilter.hxx
1 #ifndef __CPM__ALGORITHMS__QUADEDGE__SQUAREDEDGELENGTHDECIMATIONFILTER__HXX__
2 #define __CPM__ALGORITHMS__QUADEDGE__SQUAREDEDGELENGTHDECIMATIONFILTER__HXX__
3
4 // -------------------------------------------------------------------------
5 template< typename I, typename O, typename C >
6 cpm::Algorithms::QuadEdge::SquaredEdgeLengthDecimationFilter< I, O, C >::
7 SquaredEdgeLengthDecimationFilter( )
8   : Superclass( )
9 {
10 }
11
12
13 // -------------------------------------------------------------------------
14 template< typename I, typename O, typename C >
15 cpm::Algorithms::QuadEdge::SquaredEdgeLengthDecimationFilter< I, O, C >::
16 ~SquaredEdgeLengthDecimationFilter( )
17 {
18 }
19
20 // -------------------------------------------------------------------------
21 template< typename I, typename O, typename C >
22 typename
23 cpm::Algorithms::QuadEdge::SquaredEdgeLengthDecimationFilter< I, O, C >::
24 TScalar
25 cpm::Algorithms::QuadEdge::SquaredEdgeLengthDecimationFilter< I, O, C >::
26 MeasureEdge(TOutPrimalEdge *iEdge)
27 {
28   typename O::PointIdentifier id_org = iEdge->GetOrigin();
29   typename O::PointIdentifier id_dest = iEdge->GetDestination();
30
31   typename O::PointType org = this->GetOutput( )->GetPoint(id_org);
32   typename O::PointType dest = this->GetOutput( )->GetPoint(id_dest);
33
34   return(static_cast< TScalar >( org.SquaredEuclideanDistanceTo(dest) ));
35 }
36
37 // -------------------------------------------------------------------------
38 template< typename I, typename O, typename C >
39 typename
40 cpm::Algorithms::QuadEdge::SquaredEdgeLengthDecimationFilter< I, O, C >::
41 TOutPoint
42 cpm::Algorithms::QuadEdge::SquaredEdgeLengthDecimationFilter< I, O, C >::
43 Relocate(TOutPrimalEdge *iEdge)
44 {
45   typename O::Pointer     output = this->GetOutput();
46   typename O::PointIdentifier id_org = iEdge->GetOrigin();
47   typename O::PointIdentifier id_dest = iEdge->GetDestination();
48
49   typename O::PointType oPt;
50
51   oPt.SetToMidPoint( output->GetPoint(id_org),
52                      output->GetPoint(id_dest) );
53
54   return oPt;
55 }
56
57 #endif // __CPM__ALGORITHMS__QUADEDGE__SQUAREDEDGELENGTHDECIMATIONFILTER__HXX__
58
59 // eof - $RCSfile$