ITK  4.1.0
Insight Segmentation and Registration Toolkit
itkTriangleHelper.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkTriangleHelper_h
00019 #define __itkTriangleHelper_h
00020 
00021 #include "itkCrossHelper.h"
00022 
00023 namespace itk
00024 {
00030 template< typename TPoint >
00031 class TriangleHelper
00032 {
00033 public:
00034   typedef TriangleHelper                   Self;
00035   typedef TPoint                           PointType;
00036   typedef typename PointType::CoordRepType CoordRepType;
00037   typedef typename PointType::VectorType   VectorType;
00038   typedef CrossHelper< VectorType >        CrossVectorType;
00039 
00040   itkStaticConstMacro(PointDimension, unsigned int, PointType::PointDimension);
00041 
00044   static bool IsObtuse(const PointType & iA, const PointType & iB, const PointType & iC);
00045 
00047   static VectorType ComputeNormal(const PointType & iA,
00048                                   const PointType & iB,
00049                                   const PointType & iC);
00050 
00052   static CoordRepType Cotangent(const PointType & iA,
00053                                 const PointType & iB,
00054                                 const PointType & iC);
00055 
00057   static PointType ComputeBarycenter(
00058     const CoordRepType & iA1, const PointType & iP1,
00059     const CoordRepType & iA2, const PointType & iP2,
00060     const CoordRepType & iA3, const PointType & iP3);
00061 
00063   static CoordRepType ComputeAngle(const PointType & iP1, const PointType & iP2,
00064                                    const PointType & iP3);
00065 
00067   static PointType ComputeGravityCenter(
00068     const PointType & iP1,
00069     const PointType & iP2,
00070     const PointType & iP3);
00071 
00073   static PointType ComputeCircumCenter(
00074     const PointType & iP1,
00075     const PointType & iP2,
00076     const PointType & iP3);
00077 
00079   static PointType ComputeConstrainedCircumCenter(const PointType & iP1,
00080                                                   const PointType & iP2, const PointType & iP3);
00081 
00083   static CoordRepType ComputeArea(const PointType & iP1, const PointType & iP2, const PointType & iP3);
00084 
00085 private:
00086   TriangleHelper(const Self &);  // purposely not implemented
00087   void operator=(const Self &);  // purposely not implemented
00088 };
00089 }
00090 
00091 #include "itkTriangleHelper.hxx"
00092 #endif
00093