Exemplo n.º 1
0
Point3D Line3D::getPoint(int i) const
{
    switch (i)
    {
        case 0:
            return getFirstPoint();
            break;
    
        case 1:
            return getSecondPoint();
            break;

        default:
            return Point3D();
            break;
    }
}
Exemplo n.º 2
0
		string Ellipse::createPathNodes(Point point, CoordinateSystem& drawing, bool alwaysShowFirstPoint) {
			string path("");
			Point startPoint = drawing.map(getFirstPoint());
			path += "M " + NumberUtil::formatFloat(startPoint.getX()) + "," 
						+ NumberUtil::formatFloat(startPoint.getY());
		
			for (int i = 1; i <= 4; i++) {
				Point nextPoint = drawing.map(EllipticalArc::point((float) (M_PI * i / 2.0),  m_radius, m_centre,m_eccentricity));
				path += " A " + NumberUtil::formatFloat(m_radius) + "," 
						+ NumberUtil::formatFloat(m_radius * m_eccentricity)
						+ NumberUtil::formatFloat(m_inclination) + " 0,0 "
						+ NumberUtil::formatFloat(nextPoint.getX()) + ","
						+ NumberUtil::formatFloat(nextPoint.getY());
			}
		
			path += " Z ";
			return path;
		}
Exemplo n.º 3
0
void Segment::majPerformance(ListePoints *mes_points) {

  int activable, desactivable;
  Point pc;
  Vecteur vect;
  Vecteur delta;

  if (mes_points->longueur() < 2) {
    loggerMsg("Historique insuffisant");
    return;
  }

  pc = *mes_points->getFirstPoint();

  if (!pc.isValid()) {
    loggerMsg("Premier point invalide");
    return;
  }

  activable = testActivation(mes_points);

  delta = _lpts.deltaListe();

  if (_actif == SEG_OFF) {
    if (activable > 0) {
      // activation
      pc = getFirstPoint();
      vect = mes_points->posRelative(pc);

      _monStart = vect._t;
      _monCur = vect._t;

      _monElev0 = vect._z;
      _monPElev = 0.;
      _elevTot = delta._z;
      _monAvance = 0.;
      _actif = SEG_START;

      Serial.print(F("Segment active : "));
      Serial.println(_nomFichier);
    }
  } else if (_actif > SEG_OFF) {
    // deja actif
    if (_actif == SEG_START) {
      _actif = SEG_ON;
    }

    desactivable = testDesactivation(mes_points);

    if (desactivable == 0) {
      // on met a jour la perfo

      vect = posAuSegment(pc);

      if (fabs(vect._y) < MARGE_ACT * DIST_ACT) {

        _monCur = vect._t;
        _monAvance = _monStart + vect._t - pc._rtime;

        _monElev0 = _lpts.getFirstPoint()->_alt;

        if (_elevTot > 5.) {
          _monPElev = vect._z;
          _monPElev -= pc._alt;
          _monPElev /= _elevTot;
        }

      } else {
        loggerMsg("Desactivation pendant segment de ");
        loggerMsg(_nomFichier.c_str());
        Serial.print(F("Desactivation pendant segment de "));
        Serial.print(_nomFichier);
        _actif = SEG_OFF;
      }

    } else {
      // on doit desactiver

      Point lp = *_lpts.getLastPoint();

      if (!lp.isValid()) {
        loggerMsg("Dernier point invalide !!!!!");
        Serial.print(F("Dernier point invalide !!!!!"));
        desallouerPoints();
        _actif = SEG_OFF;
        return;
      }

      // position relative du dernier point segment / mes points
      vect = mes_points->posRelative(lp);

      _monCur = vect._t - _monStart;
      _monAvance = delta._t - _monCur;
      Serial.println(String(_monStart, 2) + " - " + String(vect._t, 2) + " - " + String(delta._t, 2));

      _actif = SEG_FIN;

      Serial.print("Avance: ");
      Serial.println(_monAvance);
    }

  } else if (_actif < SEG_OFF) {
    _actif += 1;
  }



}