Esempio n. 1
0
void GCSWrapper::circle_min_diameter(int id, double diameter)
{
	int s1 = add_segment(0.0, 0.0, 0.0, diameter);		
	
	line_vertical(s1);
	fix_length(s1, diameter);
	coincident_line_circle(s1, id);
}
Esempio n. 2
0
Point *			/* point where l1, l2 intersect (if any) */
line_interpt(LINE *l1, LINE *l2)
{
    Point	*result;
    double	x;
    
    if (line_parallel(l1, l2))
	return(NULL);
    if (line_vertical(l1))
	result = point_construct(l2->m * l1->C + l2->C, l1->C);
    else if (line_vertical(l2))
	result = point_construct(l1->m * l2->C + l1->C, l2->C);
    else {
	x = (l1->C - l2->C) / (l2->A - l1->A);
	result = point_construct(x, l1->m * x + l1->C);
    }
    return(result);
}
Esempio n. 3
0
double * 		/* distance between l1, l2 */
line_distance(LINE *l1, LINE *l2)
{
    double	*result;
    Point	*tmp;
    
    result = PALLOCTYPE(double);
    if (line_intersect(l1, l2)) {
	*result = 0.0;
	return(result);
    }
    if (line_vertical(l1))
	*result = fabs(l1->C - l2->C);
    else {
	tmp = point_construct(0.0, l1->C);
	result = dist_pl(tmp, l2);
	PFREE(tmp);
    }
    return(result);
}