MeshKit  1.0
AF2RuleExistEdge.cpp
Go to the documentation of this file.
00001 #include "meshkit/AF2RuleExistEdge.hpp"
00002 
00003 AF2RuleExistEdge::AF2RuleExistEdge(const AF2RuleExistVertex* firstVtx,
00004     const AF2RuleExistVertex* secondVtx,
00005     double coeffAlpha, double coeffBravo, double coeffCharlie)
00006 {
00007   firstVertexPtr = firstVtx;
00008   secondVertexPtr = secondVtx;
00009   vecDiffX = secondVtx->getX() - firstVtx->getX();
00010   vecDiffY = secondVtx->getY() - firstVtx->getY();
00011   a = coeffAlpha;
00012   b = coeffBravo;
00013   c = coeffCharlie;
00014 }
00015 
00016 const AF2RuleExistVertex* AF2RuleExistEdge::getStart() const
00017 {
00018   return firstVertexPtr;
00019 }
00020 
00021 const AF2RuleExistVertex* AF2RuleExistEdge::getEnd() const
00022 {
00023   return secondVertexPtr;
00024 }
00025 
00026 bool AF2RuleExistEdge::isMatching(AF2Point2D const & startPnt,
00027     AF2Point2D const & endPnt, double maxDeviation) const
00028 {
00029   double matchDiffX = endPnt.getX() - startPnt.getX();
00030   double matchDiffY = endPnt.getY() - startPnt.getY();
00031   double dx = matchDiffX - vecDiffX;
00032   double dy = matchDiffY - vecDiffY;
00033   double deviation = a*dx*dx + b*dx*dy + c*dy*dy;
00034   return (deviation < maxDeviation);
00035 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines