Changeset 43

Show
Ignore:
Timestamp:
09/25/07 05:57:33 (5 years ago)
Author:
cs186
Message:

skeleton for HW2

Location:
hw/hw2/postgresql-8.2.4/src/backend/utils/adt
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • hw/hw2/postgresql-8.2.4/src/backend/utils/adt/geo_ops.c

    r42 r43  
    6868static Point *line_interpt_internal(LINE *l1, LINE *l2); 
    6969 
    70  
    7170/* 
    7271 * Delimiters for input and output strings. 
     
    809808} 
    810809 
     810double box_distance_internal(BOX *box1, BOX *box2) 
     811{ 
     812  Point         a, 
     813                                b; 
     814 
     815        box_cn(&a, box1); 
     816        box_cn(&b, box2); 
     817  return(HYPOT(a.x - b.x, a.y - b.y)); 
     818         
     819} 
    811820 
    812821/*              box_distance    -               returns the distance between the 
     
    818827        BOX                *box1 = PG_GETARG_BOX_P(0); 
    819828        BOX                *box2 = PG_GETARG_BOX_P(1); 
    820         Point           a, 
    821                                 b; 
    822  
    823         box_cn(&a, box1); 
    824         box_cn(&b, box2); 
    825  
    826         PG_RETURN_FLOAT8(HYPOT(a.x - b.x, a.y - b.y)); 
     829  double   result = box_distance_internal(box1, box2); 
     830 
     831        PG_RETURN_FLOAT8(result); 
    827832} 
    828833 
     
    52485253        return FALSE; 
    52495254} 
     5255 
     5256double box_mindist_internal(BOX *box1, BOX *box2) 
     5257{ 
     5258  /* CS186 HW2: fill me in! */ 
     5259} 
     5260 
     5261Datum box_mindistance(PG_FUNCTION_ARGS) 
     5262{ 
     5263        BOX            *box1 = PG_GETARG_BOX_P(0); 
     5264        BOX            *box2 = PG_GETARG_BOX_P(1); 
     5265         
     5266        PG_RETURN_FLOAT8(box_mindist_internal(box1, box2)); 
     5267} 
     5268 
     5269Datum box_true(PG_FUNCTION_ARGS) 
     5270{ 
     5271        PG_RETURN_BOOL(TRUE); 
     5272} 
  • hw/hw2/postgresql-8.2.4/src/backend/utils/adt/geo_selfuncs.c

    r42 r43  
    9494        PG_RETURN_FLOAT8(0.001); 
    9595} 
     96 
     97/* useful for near-neighbor predicates */ 
     98Datum 
     99zerosel(PG_FUNCTION_ARGS) 
     100{ 
     101        PG_RETURN_FLOAT8(0); 
     102}