Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// outlineApproximation.cpp: implementation of the outlineApproximation class.
Toshihiro Shimizu 890ddd
//
Toshihiro Shimizu 890ddd
//////////////////////////////////////////////////////////////////////
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tstrokeoutline.h"
Toshihiro Shimizu 890ddd
#include "tstroke.h"
Toshihiro Shimizu 890ddd
#include "tcurves.h"
Toshihiro Shimizu 890ddd
#include "tmathutil.h"
Toshihiro Shimizu 890ddd
#include "tgl.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//#include "tcolorfunctions.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
typedef std::pair<tquadratic *="" *,="" tquadratic=""> outlineEdge;</tquadratic>
Toshihiro Shimizu 890ddd
typedef std::vector<outlineedge> outlineBoundary;</outlineedge>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
const double infDouble = (std::numeric_limits<double>::max)();</double>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*
Toshihiro Shimizu 890ddd
ONLY FOT TEST
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
TSegment  g_tangEnvelope_1;
Toshihiro Shimizu 890ddd
TSegment  g_tangEnvelope_2;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
vector<tquadratic>  g_testOutline;</tquadratic>
Toshihiro Shimizu 890ddd
*/
Shinya Kitaoka 120a6e
namespace Outline {
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class infinityCurvature {};
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class notValidOutline {};
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
namespace {
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*
Toshihiro Shimizu 890ddd
  This formule is derived from Graphic Gems pag. 600
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
    e = h^2 |a|/8
Shinya Kitaoka 120a6e
Toshihiro Shimizu 890ddd
      e = pixel size
Toshihiro Shimizu 890ddd
      h = step
luz paz 67b4e9
      a = acceleration of curve (for a quadratic is a constant value)
Toshihiro Shimizu 890ddd
  */
Shinya Kitaoka 120a6e
double localComputeStep(const TQuadratic &quad, double pixelSize) {
Shinya Kitaoka 120a6e
  double step = 2;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TPointD A = quad.getP0() - 2.0 * quad.getP1() +
Shinya Kitaoka 120a6e
              quad.getP2();  // 2*A is the acceleration of the curve
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  double A_len        = norm(A);
Shinya Kitaoka 120a6e
  if (A_len > 0) step = sqrt(2 * pixelSize / A_len);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  return step;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
//---------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// selezionano lo spicchio da calcolare nella costruzione dei tappi
Toshihiro Shimizu 890ddd
// (semicirconferenze iniziali e finali)
Toshihiro Shimizu 890ddd
const int QUARTER_BEGIN = 1;
Shinya Kitaoka 120a6e
const int QUARTER_END   = 0;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// selezionano il pezzo d'outline da calcolare (sopra/sotto)
Shinya Kitaoka 120a6e
const int OUTLINE_UP   = 1;
Toshihiro Shimizu 890ddd
const int OUTLINE_DOWN = 0;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// utili
Toshihiro Shimizu 890ddd
const double ratio_1_3 = 1.0 / 3.0;
Toshihiro Shimizu 890ddd
const double ratio_2_3 = 2.0 / 3.0;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// torna la curvature per t=0
Toshihiro Shimizu 890ddd
template <class t=""></class>
Shinya Kitaoka 120a6e
double curvature_t0(const T *curve) {
Shinya Kitaoka 120a6e
  assert(curve);
Shinya Kitaoka 120a6e
  TPointD v1 = curve->getP1() - curve->getP0();
Shinya Kitaoka 120a6e
  TPointD v2 = curve->getP2() - curve->getP1();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  double v_cross = cross(v1, v2);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  if (isAlmostZero(v_cross)) return infDouble;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  return ratio_2_3 * v_cross / pow(norm(v1), ratio_1_3);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// torna la curvature per t=1
Shinya Kitaoka 120a6e
double curvature_t1(const TThickQuadratic *curve) {
Shinya Kitaoka 120a6e
  assert(curve);
Shinya Kitaoka 120a6e
  TThickQuadratic tmp;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  tmp.setThickP0(curve->getThickP2());
Shinya Kitaoka 120a6e
  tmp.setThickP1(curve->getThickP1());
Shinya Kitaoka 120a6e
  tmp.setThickP2(curve->getThickP0());
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  return curvature_t0(&tmp);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// estrae il punto dell'outline per il parametro specificato
Toshihiro Shimizu 890ddd
// N.B: e' sbagliata non tiene conto degli inviluppi
Shinya Kitaoka 120a6e
TPointD getPointInOutline(const TThickQuadratic *tq, double t, int upOrDown) {
Shinya Kitaoka 120a6e
  assert(tq);
Shinya Kitaoka 120a6e
  const TThickPoint &p = tq->getThickPoint(t);
Shinya Kitaoka 120a6e
  TPointD n            = tq->getSpeed(t);
Shinya Kitaoka 120a6e
  if (norm2(n)) {
Shinya Kitaoka 120a6e
    n = normalize(n);
Shinya Kitaoka 120a6e
    n = upOrDown ? rotate90(n) : rotate270(n);
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  return convert(p) + p.thick * n;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
bool checkPointInOutline(const TPointD &pointToTest, const TThickQuadratic *tq,
Shinya Kitaoka 120a6e
                         double t, double error) {
Shinya Kitaoka 120a6e
  assert(tq);
Shinya Kitaoka 120a6e
  TThickPoint tpnt = tq->getThickPoint(t);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  if (fabs(sq(pointToTest.x - tpnt.x) + sq(pointToTest.y - tpnt.y) -
Shinya Kitaoka 120a6e
           sq(tpnt.thick)) < error)
Shinya Kitaoka 120a6e
    return true;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  return false;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// costruisce un ramo di outline (sopra o sotto) per una quadratica cicciona
Shinya Kitaoka 120a6e
TQuadratic *makeOutlineForThickQuadratic(const TThickQuadratic *tq,
Shinya Kitaoka 120a6e
                                         int upOrDown) {
Shinya Kitaoka 120a6e
  assert(tq);
Shinya Kitaoka 120a6e
  // if(!outline) return 0;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TThickPoint p0 = tq->getThickP0(),
Shinya Kitaoka 120a6e
              // p1 = tq->getThickP0(),
Shinya Kitaoka 120a6e
      p2 = tq->getThickP2();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TPointD t0 = tq->getP1() - tq->getP0();
Shinya Kitaoka 120a6e
  TPointD t1 = tq->getP2() - tq->getP1();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  if (t0 == t1) return 0;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TPointD N0 = tq->getSpeed(0.0), N2 = tq->getSpeed(1.0);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  if (!norm2(N0) && !norm2(N2)) throw Outline::notValidOutline();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  if (norm2(N0)) {
Shinya Kitaoka 120a6e
    N0 = normalize(N0);
Shinya Kitaoka 120a6e
    N0 = upOrDown ? rotate90(N0) : rotate270(N0);
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  if (norm2(N2)) {
Shinya Kitaoka 120a6e
    N2 = normalize(N2);
Shinya Kitaoka 120a6e
    N2 = upOrDown ? rotate90(N2) : rotate270(N2);
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TPointD p0aux = (convert(p0) + p0.thick * N0);
Shinya Kitaoka 120a6e
  TPointD p2aux = (convert(p2) + p2.thick * N2);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TQuadratic radius(TPointD(tq->getThickP0().thick, 0.0),
Shinya Kitaoka 120a6e
                    TPointD(tq->getThickP1().thick, 0.0),
Shinya Kitaoka 120a6e
                    TPointD(tq->getThickP2().thick, 0.0));
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TPointD r0 = radius.getSpeed(0.0);
Shinya Kitaoka 120a6e
  TPointD r1 = radius.getSpeed(1.0);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TPointD v0, v2;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  double ct0 = curvature_t0(tq);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  if (ct0 != infDouble)
Shinya Kitaoka 120a6e
    v0 = (1 + p0.thick * ct0) * t0 + 0.5 * r0.x * N0;
Shinya Kitaoka 120a6e
  else
Shinya Kitaoka 120a6e
    v0 = r0.x * N0;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  double ct1 = curvature_t1(tq);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  if (ct1 != infDouble)
Shinya Kitaoka 120a6e
    v2 = (1 + p2.thick * ct1) * t1 + 0.5 * r1.x * N2;
Shinya Kitaoka 120a6e
  else
Shinya Kitaoka 120a6e
    v2 = r1.x * N2;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  /*
Shinya Kitaoka 120a6e
try {
Shinya Kitaoka 120a6e
v0 = (1 + p0.thick * curvature_t0( tq )) * t0 + 0.5 * r0.x * N0;
Shinya Kitaoka 120a6e
}
Shinya Kitaoka 120a6e
catch( Outline::infinityCurvature& ) {
Shinya Kitaoka 120a6e
}
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
try {
Shinya Kitaoka 120a6e
v2 = (1 + p2.thick * curvature_t1( tq )) * t1 + 0.5 * r1.x * N2;
Shinya Kitaoka 120a6e
}
Shinya Kitaoka 120a6e
catch( Outline::infinityCurvature& ) {
Shinya Kitaoka 120a6e
}
Shinya Kitaoka 120a6e
*/
Shinya Kitaoka 120a6e
  //    g_tangEnvelope_1.setP0( outline.getP0() );
Shinya Kitaoka 120a6e
  //    g_tangEnvelope_1.setP1( outline.getP0() + v0 );
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  //    g_tangEnvelope_2.setP0( outline.getP2() );
Shinya Kitaoka 120a6e
  //    g_tangEnvelope_2.setP1( outline.getP2() + v2 );
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  //  solve sistem  p1 = p0 + k * v1 = p2 + m * v2 to find
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  double det = v0.x * v0.y - v2.x * v2.y;
Shinya Kitaoka 120a6e
  if (areAlmostEqual(det, 0.0)) return 0;
Shinya Kitaoka 120a6e
  double xsol;
Shinya Kitaoka 120a6e
  try {
Shinya Kitaoka 120a6e
    xsol = ((p0aux.x - p2aux.x) * v2.y - (p0aux.y - p2aux.y) * v2.x) / det;
Shinya Kitaoka 120a6e
    // tsolveSistem( A, 2, b );
Shinya Kitaoka 120a6e
  } catch (TMathException &) {
Shinya Kitaoka 120a6e
    return new TQuadratic((upOrDown) ? p0aux : p2aux, (p0aux + p2aux) * 0.5,
Shinya Kitaoka 120a6e
                          (upOrDown) ? p2aux : p0aux);
Shinya Kitaoka 120a6e
  } catch (std::exception &e) {
Shinya Kitaoka 120a6e
    std::string s(e.what());
Shinya Kitaoka 120a6e
    abort();
Shinya Kitaoka 120a6e
  } catch (...) {
Shinya Kitaoka 120a6e
    abort();
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  return new TQuadratic((upOrDown) ? p0aux : p2aux, p0aux + xsol * v0,
Shinya Kitaoka 120a6e
                        (upOrDown) ? p2aux : p0aux);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
/*
Shinya Kitaoka 120a6e
    costruisce l'outline per una singola quadratica senza
Toshihiro Shimizu 890ddd
    inserire le semicirconferenze iniziali e finali
Toshihiro Shimizu 890ddd
   */
Toshihiro Shimizu 890ddd
void makeOutline(/*std::ofstream& cout,*/
Shinya Kitaoka 120a6e
                 outlineBoundary &outl, const TThickQuadratic &t,
Shinya Kitaoka 120a6e
                 double error) {
Shinya Kitaoka 120a6e
  outlineEdge edge;
Shinya Kitaoka 120a6e
  const TThickQuadratic *tq = &t;
Shinya Kitaoka 120a6e
  edge.first = edge.second = 0;
Shinya Kitaoka 120a6e
  try {
Shinya Kitaoka 120a6e
    edge.first  = makeOutlineForThickQuadratic(tq, OUTLINE_UP);
Shinya Kitaoka 120a6e
    edge.second = makeOutlineForThickQuadratic(tq, OUTLINE_DOWN);
Shinya Kitaoka 120a6e
  } catch (Outline::notValidOutline &) {
Shinya Kitaoka 120a6e
    delete edge.first;
Shinya Kitaoka 120a6e
    delete edge.second;
Shinya Kitaoka 120a6e
    return;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  const TQuadratic *q_up     = edge.first;
Shinya Kitaoka 120a6e
  const TQuadratic *q_down   = edge.second;
Shinya Kitaoka 120a6e
  const double parameterTest = 0.5;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // forza l'uscita per valori troppo piccoli
Shinya Kitaoka 120a6e
  bool isAlmostAPoint =
Shinya Kitaoka 120a6e
      areAlmostEqual(tq->getThickP0(), tq->getThickP1(), 1e-2) &&
Shinya Kitaoka 120a6e
      areAlmostEqual(tq->getThickP1(), tq->getThickP2(), 1e-2) /*&&
Toshihiro Shimizu 890ddd
      areAlmostEqual( tq.getThickP0(), tq.getThickP2(), 1e-2 )*/;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  if (isAlmostAPoint ||
Rozhuk Ivan 823a31
      (q_up && checkPointInOutline(q_up->getPoint(parameterTest), tq,
Shinya Kitaoka 120a6e
                                  parameterTest, error) &&
Shinya Kitaoka 120a6e
          q_down && checkPointInOutline(q_down->getPoint(parameterTest), tq,
Rozhuk Ivan 823a31
                                        parameterTest, error))) {
Shinya Kitaoka 120a6e
    /*	if (edge.first)
Shinya Kitaoka 120a6e
      cout << "left: "<< *(edge.first);
Shinya Kitaoka 120a6e
else
Shinya Kitaoka 120a6e
      cout << "left: "<< 0;
Shinya Kitaoka 120a6e
    if (edge.second)
Shinya Kitaoka 120a6e
      cout << "right: "<<*(edge.second);
Shinya Kitaoka 120a6e
else
Shinya Kitaoka 120a6e
      cout << "right: "<< 0;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    cout<
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    outl.push_back(edge);
Shinya Kitaoka 120a6e
    return;
Shinya Kitaoka 120a6e
  } else {
Shinya Kitaoka 120a6e
    delete edge.first;
Shinya Kitaoka 120a6e
    delete edge.second;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
luz paz f1c245
  TThickQuadratic tq_left, tq_right;
Shinya Kitaoka 120a6e
luz paz f1c245
  tq->split(0.5, tq_left, tq_right);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  makeOutline(/*out,*/ outl, tq_left, error);
luz paz f1c245
  makeOutline(/*cout,*/ outl, tq_right, error);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void splitCircularArcIntoQuadraticCurves(const TPointD &Center,
Shinya Kitaoka 120a6e
                                         const TPointD &Pstart,
Shinya Kitaoka 120a6e
                                         const TPointD &Pend,
Shinya Kitaoka 120a6e
                                         std::vector<tquadratic *=""> &quadArray) {</tquadratic>
Shinya Kitaoka 120a6e
  // It splits a circular anticlockwise arc into a sequence of quadratic bezier
Shinya Kitaoka 120a6e
  // curves
Shinya Kitaoka 120a6e
  // Every quadratic curve can approximate an arc no TLonger than 45 degrees (or
Shinya Kitaoka 120a6e
  // 60).
Shinya Kitaoka 120a6e
  // It supposes that Pstart and Pend are onto the circumference (so that their
Shinya Kitaoka 120a6e
  // lengths
luz paz 67b4e9
  // are equal to the radius of the circumference), otherwise the resulting
Shinya Kitaoka 120a6e
  // curves could
Shinya Kitaoka 120a6e
  // be unpredictable.
Shinya Kitaoka 120a6e
  // The last component in quadCurve[] is an ending void curve
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  /* ----------------------------------------------------------------------------------
Shinya Kitaoka 120a6e
   */
Shinya Kitaoka 120a6e
  // If you want to split the arc into arcs no TLonger than 45 degrees (so that
Shinya Kitaoka 120a6e
  // the whole
Shinya Kitaoka 120a6e
  // curve will be splitted into 8 pieces) you have to set these constants as
Shinya Kitaoka 120a6e
  // follows:
Shinya Kitaoka 120a6e
  // cos_ang     ==> cos_45   = 0.5 * sqrt(2);
Shinya Kitaoka 120a6e
  // sin_ang     ==> sin_45   = 0.5 * sqrt(2);
Shinya Kitaoka 120a6e
  // tan_semiang ==> tan_22p5 = 0.4142135623730950488016887242097;
Shinya Kitaoka 120a6e
  // N_QUAD                   = 8;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // If you want to split the arc into arcs no TLonger than 60 degrees (so that
Shinya Kitaoka 120a6e
  // the whole
Shinya Kitaoka 120a6e
  // curve will be splitted into 6 pieces) you have to set these constants as
Shinya Kitaoka 120a6e
  // follows:
Shinya Kitaoka 120a6e
  // cos_ang     ==> cos_60 = 0.5;
Shinya Kitaoka 120a6e
  // sin_ang     ==> sin_60 = 0.5 * sqrt(3);
Shinya Kitaoka 120a6e
  // tan_semiang ==> tan_30 = 0.57735026918962576450914878050196;
Shinya Kitaoka 120a6e
  // N_QUAD                 = 6;
Shinya Kitaoka 120a6e
  /* ----------------------------------------------------------------------------------
Shinya Kitaoka 120a6e
   */
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // Defines some useful constant to split the arc into arcs no TLonger than
Shinya Kitaoka 120a6e
  // 'ang' degrees
Shinya Kitaoka 120a6e
  // (the whole circumference will be splitted into 360/ang quadratic curves).
Shinya Kitaoka 120a6e
  const double cos_ang     = 0.5 * sqrt(2.0);
Shinya Kitaoka 120a6e
  const double sin_ang     = 0.5 * sqrt(2.0);
Shinya Kitaoka 120a6e
  const double tan_semiang = 0.4142135623730950488016887242097;
Shinya Kitaoka 120a6e
  const int N_QUAD         = 8;  // it's 360/ang
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // First of all, it computes the vectors from the center to the circumference,
Shinya Kitaoka 120a6e
  // in Pstart and Pend, and their cross and dot products
Shinya Kitaoka 120a6e
  TPointD Rstart = Pstart - Center;  // its length is R (radius of the circle)
Shinya Kitaoka 120a6e
  TPointD Rend   = Pend - Center;    // its length is R (radius of the circle)
Shinya Kitaoka 120a6e
  double cross_prod       = cross(Rstart, Rend);  // it's Rstart x Rend
Shinya Kitaoka 120a6e
  double dot_prod         = Rstart * Rend;
Shinya Kitaoka 120a6e
  const double sqr_radius = Rstart * Rstart;
Shinya Kitaoka 120a6e
  TPointD aliasPstart     = Pstart;
Shinya Kitaoka 120a6e
  TQuadratic *quad;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  while ((cross_prod <= 0) ||
Shinya Kitaoka 120a6e
         (dot_prod <= cos_ang * sqr_radius))  // the circular arc is TLonger
Shinya Kitaoka 120a6e
                                              // than a 'ang' degrees arc
Shinya Kitaoka 120a6e
  {
Shinya Kitaoka 120a6e
    if ((int)quadArray.size() == N_QUAD)  // this is possible if Pstart or Pend
Shinya Kitaoka 120a6e
                                          // is not onto the circumference
Shinya Kitaoka 120a6e
      return;
Shinya Kitaoka 120a6e
    TPointD Rstart_rot_ang(cos_ang * Rstart.x - sin_ang * Rstart.y,
Shinya Kitaoka 120a6e
                           sin_ang * Rstart.x + cos_ang * Rstart.y);
Shinya Kitaoka 120a6e
    TPointD Rstart_rot_90(-Rstart.y, Rstart.x);
Shinya Kitaoka 120a6e
    quad =
Shinya Kitaoka 120a6e
        new TQuadratic(aliasPstart, aliasPstart + tan_semiang * Rstart_rot_90,
Shinya Kitaoka 120a6e
                       Center + Rstart_rot_ang);
Shinya Kitaoka 120a6e
    quadArray.push_back(quad);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    // quad->computeMinStepAtNormalSize ();
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    // And moves anticlockwise the starting point on the circumference by 'ang'
Shinya Kitaoka 120a6e
    // degrees
Shinya Kitaoka 120a6e
    Rstart      = Rstart_rot_ang;
Shinya Kitaoka 120a6e
    aliasPstart = quad->getP2();
Shinya Kitaoka 120a6e
    cross_prod  = cross(Rstart, Rend);  // it's Rstart x Rend
Shinya Kitaoka 120a6e
    dot_prod    = Rstart * Rend;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    // after the rotation of 'ang' degrees, the remaining part of the arc could
Shinya Kitaoka 120a6e
    // be a 0 degree
Shinya Kitaoka 120a6e
    // arc, so it must stop and exit from the function
Shinya Kitaoka 120a6e
    if ((cross_prod <= 0) && (dot_prod > 0.95 * sqr_radius)) return;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  if ((cross_prod > 0) && (dot_prod > 0))  // the last quadratic curve
Shinya Kitaoka 120a6e
                                           // approximates an arc shorter than a
Shinya Kitaoka 120a6e
                                           // 'ang' degrees arc
Shinya Kitaoka 120a6e
  {
Shinya Kitaoka 120a6e
    TPointD Rstart_rot_90(-Rstart.y, Rstart.x);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    double deg_index = (sqr_radius - dot_prod) / (sqr_radius + dot_prod);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    quad = new TQuadratic(aliasPstart,
Shinya Kitaoka 120a6e
                          (deg_index < 0)
Shinya Kitaoka 120a6e
                              ? 0.5 * (aliasPstart + Pend)
Shinya Kitaoka 120a6e
                              : aliasPstart + sqrt(deg_index) * Rstart_rot_90,
Shinya Kitaoka 120a6e
                          Pend);
Shinya Kitaoka 120a6e
    quadArray.push_back(quad);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  } else  // the last curve, already computed, is as TLong as a 'ang' degrees
Shinya Kitaoka 120a6e
          // arc
Shinya Kitaoka 120a6e
    quadArray.back()->setP2(Pend);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// copia arrayUp e arrayDown nel vettore dell'outline
Toshihiro Shimizu 890ddd
// se le dimensioni sono diverse il vettore con il numero
Toshihiro Shimizu 890ddd
// minore di quadratiche viene riempito con quadratiche degeneri
Toshihiro Shimizu 890ddd
// con i punti di controllo coincidenti nell'ultimo estremo valido
Toshihiro Shimizu 890ddd
void copy(/*std::ofstream& cout,*/
Shinya Kitaoka 120a6e
          const std::vector<tquadratic *=""> &arrayUp,</tquadratic>
Shinya Kitaoka 120a6e
          const std::vector<tquadratic *=""> &arrayDown, outlineBoundary &ob) {</tquadratic>
Shinya Kitaoka 120a6e
  int minSize = std::min(arrayUp.size(), arrayDown.size());
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  assert(minSize > 0);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  int i;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  for (i = 0; i < minSize; ++i) {
Shinya Kitaoka 120a6e
    // cout<<"left: "<< *(arrayUp[i])<< "right: "<<*(arrayDown[i])<
Shinya Kitaoka 120a6e
    // cout<"left: "<< arrayUp[i].getP0()<<", "arrayUp[i].getP1()<<",
Shinya Kitaoka 120a6e
    // "arrayUp[i].getP2()<< "right: "<< << arrayDown[i].getP0()<<",
Shinya Kitaoka 120a6e
    // "arrayDown[i].getP1()<<", "arrayDown[i].getP2()<
Shinya Kitaoka 120a6e
    ob.push_back(outlineEdge(arrayUp[i], arrayDown[i]));
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  if (arrayUp.size() != arrayDown.size()) {
Shinya Kitaoka 120a6e
    const std::vector<tquadratic *=""> &vMaxSize =</tquadratic>
Shinya Kitaoka 120a6e
        arrayUp.size() > arrayDown.size() ? arrayUp : arrayDown;
Shinya Kitaoka 120a6e
    const std::vector<tquadratic *=""> &vMinSize =</tquadratic>
Shinya Kitaoka 120a6e
        arrayUp.size() < arrayDown.size() ? arrayUp : arrayDown;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    int delta = vMaxSize.size() - vMinSize.size();
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    if (arrayUp.size() > arrayDown.size())
Shinya Kitaoka 120a6e
      while (i < minSize + delta) {
Shinya Kitaoka 120a6e
        // cout<<"left: "<< arrayUp[i]<< "right: "<< 0<
Shinya Kitaoka 120a6e
        ob.push_back(outlineEdge(arrayUp[i], (TQuadratic *)0));
Shinya Kitaoka 120a6e
        i++;
Shinya Kitaoka 120a6e
      }
Shinya Kitaoka 120a6e
    else
Shinya Kitaoka 120a6e
      while (i < minSize + delta) {
Shinya Kitaoka 120a6e
        // cout<<"left: "<< 0 << "right: "<< arrayDown[i]<
Shinya Kitaoka 120a6e
        ob.push_back(outlineEdge((TQuadratic *)0, arrayDown[i]));
Shinya Kitaoka 120a6e
        i++;
Shinya Kitaoka 120a6e
      }
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
inline void changeQuadraticDirection(TQuadratic *q) {
Shinya Kitaoka 120a6e
  TPointD p = q->getP2();
Shinya Kitaoka 120a6e
  q->setP2(q->getP0());
Shinya Kitaoka 120a6e
  q->setP0(p);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
// cambia il verso del vettore di quadratiche (vedi changeDirection di
Shinya Kitaoka 120a6e
// tstroke.cpp)
Shinya Kitaoka 120a6e
void changeDirection(std::vector<tquadratic *=""> &array, bool onlyQuads = false) {</tquadratic>
Shinya Kitaoka 120a6e
  UINT chunkCount = array.size();
Shinya Kitaoka 120a6e
  UINT to         = tfloor(chunkCount * 0.5);
Shinya Kitaoka 120a6e
  UINT i;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  if (chunkCount & 1) changeQuadraticDirection(array[to]);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  --chunkCount;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  for (i = 0; i < to; ++i) {
Shinya Kitaoka 120a6e
    changeQuadraticDirection(array[i]);
Shinya Kitaoka 120a6e
    changeQuadraticDirection(array[chunkCount - i]);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
    if (!onlyQuads) std::swap(array[i], array[chunkCount - i]);
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// estrae i punti necessari a costruire la semicirconferenza
Toshihiro Shimizu 890ddd
// iniziale e finale di una curva cicciona
Shinya Kitaoka 120a6e
TQuadratic getCircleQuarter(const TThickQuadratic *tq, int versus) {
Shinya Kitaoka 120a6e
  TQuadratic out;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TPointD v = versus ? -tq->getSpeed(0.0) : tq->getSpeed(1.0);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  if (norm2(v)) v = normalize(v);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TPointD center = versus ? tq->getP0() : tq->getP2();
Shinya Kitaoka 120a6e
  double radius  = versus ? tq->getThickP0().thick : tq->getThickP2().thick;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  out.setP0(center + (versus ? rotate270(v) : rotate90(v)) * radius);
Shinya Kitaoka 120a6e
  out.setP1(center + v * radius);
Shinya Kitaoka 120a6e
  out.setP2(center + (versus ? rotate90(v) : rotate270(v)) * radius);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  return out;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void drawQuadratic(const TQuadratic &quad, double pixelSize) {
Shinya Kitaoka 120a6e
  double m_min_step_at_normal_size = localComputeStep(quad, pixelSize);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  // It draws the curve as a linear piecewise approximation
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  double invSqrtScale = 1.0;
Shinya Kitaoka 120a6e
  // First of all, it computes the control circles of the curve in screen
Shinya Kitaoka 120a6e
  // coordinates
Shinya Kitaoka 120a6e
  TPointD scP0 = quad.getP0();
Shinya Kitaoka 120a6e
  TPointD scP1 = quad.getP1();
Shinya Kitaoka 120a6e
  TPointD scP2 = quad.getP2();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TPointD A = scP0 - 2 * scP1 + scP2;
Shinya Kitaoka 120a6e
  TPointD B = scP0 - scP1;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  double h;
Shinya Kitaoka 120a6e
  h         = invSqrtScale * m_min_step_at_normal_size;
Shinya Kitaoka 120a6e
  double h2 = h * h;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TPointD P = scP0, D2 = 2 * h2 * A, D1 = A * h2 - 2 * B * h;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  if (h < 0 || isAlmostZero(h)) return;
Shinya Kitaoka 120a6e
  assert(h > 0);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  // It draws the whole curve, using forward differencing
Shinya Kitaoka 120a6e
  glBegin(GL_LINE_STRIP);  // The curve starts from scP0
Shinya Kitaoka 120a6e
  glVertex2d(scP0.x, scP0.y);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  for (double t = h; t < 1; t = t + h) {
Shinya Kitaoka 120a6e
    P  = P + D1;
Shinya Kitaoka 120a6e
    D1 = D1 + D2;
Shinya Kitaoka 120a6e
    glVertex2d(P.x, P.y);
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  glVertex2d(scP2.x, scP2.y);  // The curve ends in scP2
Shinya Kitaoka 120a6e
  glEnd();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
}  // end of unnamed namespace
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Campbell Barton 8c6c57
static void makeOutline(const TStroke *stroke, int startQuad, int endQuad,
Campbell Barton 8c6c57
                        outlineBoundary &ob, double error2) {
Shinya Kitaoka 120a6e
  // std::ofstream cout("c:\\temp\\outline.txt");
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  assert(stroke);
Shinya Kitaoka 120a6e
  assert(startQuad >= 0);
Shinya Kitaoka 120a6e
  assert(endQuad < stroke->getChunkCount());
Shinya Kitaoka 120a6e
  assert(startQuad <= endQuad);
Shinya Kitaoka 120a6e
  TThickQuadratic *tq;
Shinya Kitaoka 120a6e
  std::vector<tquadratic *=""> arrayUp, arrayDown;</tquadratic>
Shinya Kitaoka 120a6e
  TQuadratic arc;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  if (!stroke->getChunkCount()) return;
Shinya Kitaoka 120a6e
  // if (startQuad==0)
Shinya Kitaoka 120a6e
  {
Shinya Kitaoka 120a6e
    const TThickQuadratic *tq = stroke->getChunk(startQuad);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    // trova i punti sul cerchio che corrispondono
Shinya Kitaoka 120a6e
    // a due fette di 90 gradi.
Shinya Kitaoka 120a6e
    // Ritorna una quadratica invece di tre singoli punti solo per compattezza.
Shinya Kitaoka 120a6e
    TQuadratic arc = getCircleQuarter(tq, QUARTER_BEGIN);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    // estrae le quadratiche che corrispondono ad i due archi...
Shinya Kitaoka 120a6e
    splitCircularArcIntoQuadraticCurves(tq->getP0(), arc.getP0(), arc.getP1(),
Shinya Kitaoka 120a6e
                                        arrayUp);
Shinya Kitaoka 120a6e
    // e le ordina in modo che l'outline sia composta sempre da
Shinya Kitaoka 120a6e
    // una curva superiore ed una inferiore corrispondente
Shinya Kitaoka 120a6e
    changeDirection(arrayUp);
Shinya Kitaoka 120a6e
    splitCircularArcIntoQuadraticCurves(tq->getP0(), arc.getP1(), arc.getP2(),
Shinya Kitaoka 120a6e
                                        arrayDown);
Shinya Kitaoka 120a6e
    changeDirection(arrayDown, true);
Shinya Kitaoka 120a6e
    // copia le curve nell'outline; se gli array non hanno la stessa dimensione
Shinya Kitaoka 120a6e
    //  quello con meno curve viene riempito con curve improprie
Shinya Kitaoka 120a6e
    //  che hanno i punti di controllo coincidente con l'ultimo estremo valido
Shinya Kitaoka 120a6e
    // cout<<"quads del semicerchio left:"<
Shinya Kitaoka 120a6e
    copy(/*cout,  */ arrayUp, arrayDown, ob);
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  for (int i = startQuad; i <= endQuad; ++i) {
Shinya Kitaoka 120a6e
    tq             = (TThickQuadratic *)stroke->getChunk(i);
Shinya Kitaoka 120a6e
    TThickPoint p0 = tq->getThickP0();
Shinya Kitaoka 120a6e
    TThickPoint p1 = tq->getThickP1();
Shinya Kitaoka 120a6e
    TThickPoint p2 = tq->getThickP2();
Shinya Kitaoka 120a6e
    if (p0.x == p1.x) {
Shinya Kitaoka 120a6e
      if (p1.x == p2.x &&
Shinya Kitaoka 120a6e
          ((p1.y > p0.y && p1.y > p2.y) || (p1.y < p0.y && p1.y < p2.y)))
Shinya Kitaoka 120a6e
        tq = new TThickQuadratic(p0, 0.5 * (p0 + p1), p1);
Shinya Kitaoka 120a6e
    } else if (p0.y == p1.y) {
Shinya Kitaoka 120a6e
      if (p0.y == p2.y &&
Shinya Kitaoka 120a6e
          ((p1.x > p0.x && p1.x > p2.x) || (p1.x < p0.x && p1.x < p2.x)))
Shinya Kitaoka 120a6e
        tq = new TThickQuadratic(p0, 0.5 * (p0 + p1), p1);
Shinya Kitaoka 120a6e
    } else {
Shinya Kitaoka 120a6e
      double fac1 = 1.0 / (p0.x - p1.x);
Shinya Kitaoka 120a6e
      double fac2 = 1.0 / (p0.y - p1.y);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
      double aux1 = fac1 * (p2.x - p1.x);
Shinya Kitaoka 120a6e
      double aux2 = fac2 * (p2.y - p1.y);
Shinya Kitaoka 120a6e
      double aux3 = fac1 * (p0.x - p2.x);
Shinya Kitaoka 120a6e
      double aux4 = fac2 * (p0.y - p2.y);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
      if ((areAlmostEqual(aux1, aux2) && aux1 >= 0) ||
Shinya Kitaoka 120a6e
          (areAlmostEqual(aux3, aux4) && aux3 >= 0 && aux3 <= 1))
Shinya Kitaoka 120a6e
        tq = new TThickQuadratic(p0, 0.5 * (p0 + p1), p1);
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    // cout<<"quad# "<
Shinya Kitaoka 120a6e
    makeOutline(/*cout, */ ob, *tq, error2);
Shinya Kitaoka 120a6e
    if (tq != stroke->getChunk(i)) delete tq;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  arrayUp.clear();
Shinya Kitaoka 120a6e
  arrayDown.clear();
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  // come sopra ultimo pezzo di arco
Shinya Kitaoka 120a6e
  //	if (endQuad==stroke->getChunkCount()-1)
Shinya Kitaoka 120a6e
  {
Shinya Kitaoka 120a6e
    arc = getCircleQuarter(tq, QUARTER_END);
Shinya Kitaoka 120a6e
    splitCircularArcIntoQuadraticCurves(tq->getP2(), arc.getP1(), arc.getP0(),
Shinya Kitaoka 120a6e
                                        arrayUp);
Shinya Kitaoka 120a6e
    changeDirection(arrayUp);
Shinya Kitaoka 120a6e
    splitCircularArcIntoQuadraticCurves(tq->getP2(), arc.getP2(), arc.getP1(),
Shinya Kitaoka 120a6e
                                        arrayDown);
Shinya Kitaoka 120a6e
    changeDirection(arrayDown, true);
Shinya Kitaoka 120a6e
    // cout<<"quads del semicerchio right:"<
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    copy(/*cout,*/ arrayUp, arrayDown, ob);
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Campbell Barton 8c6c57
static void drawOutline(const outlineBoundary &ob, double pixelSize) {
Shinya Kitaoka 120a6e
  for (UINT i = 0; i < ob.size(); ++i) {
Shinya Kitaoka 120a6e
    drawQuadratic(*ob[i].first, pixelSize);
Shinya Kitaoka 120a6e
    drawQuadratic(*ob[i].second, pixelSize);
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
void computeOutlines(const TStroke *stroke, int startQuad, int endQuad,
Shinya Kitaoka 120a6e
                     std::vector<tquadratic *=""> &quadArray, double error2) {</tquadratic>
Shinya Kitaoka 120a6e
  outlineBoundary ob;
Shinya Kitaoka 120a6e
  makeOutline(stroke, startQuad, endQuad, ob, error2);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  assert(quadArray.empty());
Shinya Kitaoka 120a6e
  quadArray.resize(ob.size() * 2);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int i, count = 0;
Shinya Kitaoka 120a6e
  for (i                                = 0; i < (int)ob.size(); i++)
Shinya Kitaoka 120a6e
    if (ob[i].first) quadArray[count++] = ob[i].first;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  for (i                                 = (int)ob.size() - 1; i >= 0; i--)
Shinya Kitaoka 120a6e
    if (ob[i].second) quadArray[count++] = ob[i].second;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  quadArray.resize(count);
Shinya Kitaoka 120a6e
  for (i = 0; i < (int)quadArray.size(); i++) quadArray[i]->reverse();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  std::reverse(quadArray.begin(), quadArray.end());
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
// End Of File
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------