//if point of intersection within the line segments bool is_intersection_within_line_segments(const line& l1, const line& l2) { point intersection; if (false == find_intersection_point(l1, l2, intersection)) return false; if (is_point_within_segment(l1, intersection) && is_point_within_segment(l2, intersection)) return true; return false; }
void Triangle::draw_doodle() { float rotate_angle = -1; for(int a = 0; a < 100; a++, rotate_angle-= 0.005) { for(int i = 0; i < 3; i++) { //[0] init vector from current //[1] rotate to some angle //[2] find intersection point of V and next line //[3] init second point of current with inters point values int cur = i; int next = i+1; if( 3 == next) next = 0; //[0] Line *vector = edges[cur]; //[1] // can be negative with vx value in rotate point line:81 rotate_vector(vector, this->center, rotate_angle); //[2] Point *inters_point = new Point(); find_intersection_point(edges[cur], edges[next], inters_point); //[3] edges[next]->a = inters_point; //try to find problem with this pointer edges[cur]->b->x = inters_point->x; edges[cur]->b->y = inters_point->y; edges[cur]->draw(); // sleep(2); usleep(10000); } } }