Hello world - Estendere un segmento
Vect2d LineP1, LineP2;
double m_MarginLeft = -1000,
double m_MarginRight = 1000;
Vect2d newLineP1, newLineP2, delta;
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
Posta un commento