예제 #1
0
 /** Constructor for markers_placement object.
  * \param locator  Path along which markers are placed (type: vertex source)
  * \param size     Size of the marker
  * \param tr       Affine transform
  * \param detector Collision detection
  * \param spacing  Distance between markers. If the value is negative it is
  *                 converted to a positive value with similar magnitude, but
  *                 choosen to optimize marker placement. 0 = no markers
  */
 markers_placement(Locator &locator,
                   box2d<double> const& size,
                   agg::trans_affine const& tr,
                   Detector &detector,
                   double spacing,
                   double max_error,
                   bool allow_overlap)
   : locator_(locator),
     size_(size),
     tr_(tr),
     detector_(detector),
     max_error_(max_error),
     allow_overlap_(allow_overlap),
     marker_width_((size_ * tr_).width()),
     done_(false),
     last_x(0.0),
     last_y(0.0),
     next_x(0.0),
     next_y(0.0),
     error_(0.0),
     spacing_left_(0.0),
     marker_nr_(0)
 {
   if (spacing >= 0)
   {
       spacing_ = spacing;
   }
   else if (spacing < 0)
   {
       spacing_ = find_optimal_spacing(-spacing);
   }
   rewind();
 }
예제 #2
0
/** Constructor for markers_placement object.
 * \param locator  Path along which markers are placed (type: vertex source)
 * \param size     Size of the marker
 * \param detector Collision detection
 * \param spacing  Distance between markers. If the value is negative it is
 *                 converted to a positive value with similar magnitude, but
 *                 choosen to optimize marker placement. 0 = no markers
 */
template <typename Locator,  typename Detector> markers_placement<Locator, Detector>::markers_placement(
    Locator &locator, box2d<double> size, Detector &detector, double spacing, double max_error, bool allow_overlap)
    : locator_(locator), size_(size), detector_(detector), max_error_(max_error), allow_overlap_(allow_overlap)
{
    if (spacing >= 0)
    {
        spacing_ = spacing;
    } else if (spacing < 0)
    {
        spacing_ = find_optimal_spacing(-spacing);
    }
    rewind();
}
예제 #3
0
markers_placement<Locator, Detector>::markers_placement(
    Locator &locator, box2d<double> size, agg::trans_affine const& tr, Detector &detector, double spacing, double max_error, bool allow_overlap)
    : locator_(locator), size_(size), tr_(tr), detector_(detector), max_error_(max_error), allow_overlap_(allow_overlap)
{
    marker_width_ = (size_ * tr_).width();
    if (spacing >= 0)
    {
        spacing_ = spacing;
    } else if (spacing < 0)
    {
        spacing_ = find_optimal_spacing(-spacing);
    }
    rewind();
}