Hello world - Estendere un segmento

  Vect2d LineP1LineP2;
  double m_MarginLeft = -1000,
  double m_MarginRight = 1000;

  Vect2d newLineP1newLineP2delta;
  delta.x =  LineP2.x - LineP1.x;
  delta.y =  LineP2.y - LineP1.y;

  double ratio = delta.y / delta.x;

  newLineP1.x = m_MarginLeft;
  newLineP1.y = LineP1.y - ((LineP1.x - m_MarginLeft) * ratio);

  newLineP2.x = m_MarginRight;
  newLineP2.y = LineP2.y + ((m_MarginRight - LineP2.x) * ratio);

Commenti

Post popolari in questo blog

Indovinello: Soluzioni!!!

Gli indovinelli che ci avete mandato 10