LCOV - code coverage report
Current view: top level - algs/AdvFront/meshkit - AF2PntTrnsfrmLnrV.hpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 1 1 100.0 %
Date: 2020-07-01 15:24:36 Functions: 1 1 100.0 %
Branches: 1 2 50.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * AF2PntTrnsfmLnrV.hpp
       3                 :            :  *
       4                 :            :  * \brief A point transformation that moves the point by some linear
       5                 :            :  * transformation of the difference between the points that specified
       6                 :            :  * reference vertices are bound to and the locations of the reference
       7                 :            :  * vertices themselves.
       8                 :            :  *
       9                 :            :  * This implementation does not make use of a linear transformation matrix.
      10                 :            :  * Instead it performs the low-level calculations of multiplying coefficients
      11                 :            :  * by the vertex binding differences and summing the result.
      12                 :            :  */
      13                 :            : 
      14                 :            : #ifndef AF2PNTTRNSFRMLNRV_HPP
      15                 :            : #define AF2PNTTRNSFRMLNRV_HPP
      16                 :            : 
      17                 :            : // C++
      18                 :            : #include <list>
      19                 :            : #include <vector>
      20                 :            : 
      21                 :            : // MeshKit
      22                 :            : #include "meshkit/AF2PointTransform.hpp"
      23                 :            : #include "meshkit/AF2RuleExistVertex.hpp"
      24                 :            : 
      25         [ -  + ]:      10770 : class AF2PntTrnsfrmLnrV : public AF2PointTransform
      26                 :            : {
      27                 :            :   private:
      28                 :            : 
      29                 :            :     std::vector<const AF2RuleExistVertex*> refVertices;
      30                 :            :     std::vector<double> xCoeff;
      31                 :            :     std::vector<double> yCoeff;
      32                 :            : 
      33                 :            :   public:
      34                 :            : 
      35                 :            :     /**
      36                 :            :      * \brief Constructor with lists
      37                 :            :      *
      38                 :            :      * Construct an AF2PntTrnsfrmLnrV that is based on the differences
      39                 :            :      * between bound locations of the specified vertices and transforms
      40                 :            :      * these differences using a linear transformation with the specified
      41                 :            :      * coefficients.
      42                 :            :      *
      43                 :            :      * The lists of coefficients should be twice as long as the list
      44                 :            :      * of vertices.  For the vertex v at position i in the list of vertices
      45                 :            :      * (where the first position is i = 0), the xDiffCoeff at position 2*i
      46                 :            :      * defines the coefficient on the contribution of x-coordinate difference
      47                 :            :      * for vertex v to the x translation, and the xDiffCoeff at
      48                 :            :      * position 1 + 2*i defines the coefficient on the contribution of the
      49                 :            :      * y-coordinate difference for vertex v to the x translation.  Similarly,
      50                 :            :      * the yDiffCoeff at positions 2*i and 1 + 2*i define the coefficients
      51                 :            :      * of the contributions of the x and y-coordinate differences for
      52                 :            :      * vertex v to the y translation.
      53                 :            :      *
      54                 :            :      * For example, if a single vertex v is given the xDiffCoeff are 0.5, 0,
      55                 :            :      * and the yDiffCoeff are 0, 0, then the transformation will translate
      56                 :            :      * a point by half of the difference between the x-coordinate of the
      57                 :            :      * vertex to which v is bound and the x-coordinate of the reference
      58                 :            :      * location of vertex v.
      59                 :            :      *
      60                 :            :      * If the coefficient lists are not exactly twice as long as the list
      61                 :            :      * of vertices, this method will throw an exception.
      62                 :            :      *
      63                 :            :      * This object does not take ownership of the AF2RuleExistVertex that
      64                 :            :      * are passed into the constructor.  It is the responsibility of the
      65                 :            :      * context to ensure that the pointers remain valid as long as this
      66                 :            :      * object or a copy, assignment, or clone of it may be used to transform
      67                 :            :      * a point.
      68                 :            :      *
      69                 :            :      * \param vertices a list of AF2RuleExistVertex
      70                 :            :      * \param xDiffCoeff a list of double values twice as long as
      71                 :            :      *   the list of vertices that defines coefficients affecting
      72                 :            :      *   translation in the x direction
      73                 :            :      * \param yDiffCoeff a list of double values twice as long as
      74                 :            :      *   the list of vertices that defines coefficients affecting
      75                 :            :      *   translation in the y direction
      76                 :            :      */
      77                 :            :     AF2PntTrnsfrmLnrV(std::list<const AF2RuleExistVertex*> vertices,
      78                 :            :         std::list<double> xDiffCoeff, std::list<double> yDiffCoeff);
      79                 :            : 
      80                 :            :     /**
      81                 :            :      * \brief Constructor with vectors
      82                 :            :      *
      83                 :            :      * This constructor is equivalent to the constructor with lists, but
      84                 :            :      * allows passing in vectors instead.  See the constructor with
      85                 :            :      * lists for additional documentation.
      86                 :            :      *
      87                 :            :      * \param vertices a vector of AF2RuleExistVertex
      88                 :            :      * \param xDiffCoeff a vector of double values twice as long as
      89                 :            :      *   the vector of vertices that defines coefficients affecting
      90                 :            :      *   translation in the x direction
      91                 :            :      * \param yDiffCoeff a vector of double values twice as long as
      92                 :            :      *   the vector of vertices that defines coefficients affecting
      93                 :            :      *   translation in the y direction
      94                 :            :      */
      95                 :            :     AF2PntTrnsfrmLnrV(std::vector<const AF2RuleExistVertex*> vertices,
      96                 :            :         std::vector<double> xDiffCoeff, std::vector<double> yDiffCoeff);
      97                 :            : 
      98                 :            :     /**
      99                 :            :      * \brief Makes and returns an independent copy of this
     100                 :            :      * AF2PntTrnsfrmLnrV.
     101                 :            :      *
     102                 :            :      * Implements AF2PointTransform::clone.  See additional documentation
     103                 :            :      * there.
     104                 :            :      */
     105                 :            :     virtual AF2PntTrnsfrmLnrV* clone() const;
     106                 :            : 
     107                 :            :     /**
     108                 :            :      * \brief Implements AF2PointTransform::transformPoint
     109                 :            :      *
     110                 :            :      * See the documentation at AF2PointTransform::transformPoint
     111                 :            :      * for the general contract for this method.
     112                 :            :      *
     113                 :            :      * This implementation consults the binding and computes the
     114                 :            :      * differences between the actual bound location and reference
     115                 :            :      * location of certain vertices.  The point is then translated
     116                 :            :      * from its current position by a vector that is the result of a
     117                 :            :      * linear transformation applied to the differences.
     118                 :            :      *
     119                 :            :      * If one of the vertices that this transformation is supposed to
     120                 :            :      * use is not bound to a value in the binding, this method will throw
     121                 :            :      * an exception.
     122                 :            :      *
     123                 :            :      * \param point the coordinates of some 2-dimensional point
     124                 :            :      * \param vBinding a binding of reference vertices and edges to points
     125                 :            :      *   with actual coordinates and edges between those points
     126                 :            :      * \return a point offset from the original point determined by a linear
     127                 :            :      *   transformation and the bound locations of certain vertices
     128                 :            :      */
     129                 :            :     virtual AF2Point2D transformPoint(AF2Point2D const & point,
     130                 :            :         AF2Binding const & vBinding) const;
     131                 :            : };
     132                 :            : 
     133                 :            : #endif

Generated by: LCOV version 1.11