Example #1
0
 float paraheight() {
   if (type!=Paragraph && type!=Block)
     printf("Requested paraheight from non-Paragraph!\n");
   if (memparaheight==NULL)
     memparaheight=p2newfloat(furthest(lineori().perp()));
   return *memparaheight;
 }
Example #2
0
 float parawidth() {
   if (type!=Paragraph && type!=Block)
     printf("Requested parawidth from non-Paragraph!\n");
   if (memparawidth==NULL)
     memparawidth=p2newfloat(furthest(lineori()));
   return *memparawidth;
 }
Example #3
0
 float width() {
   if (type==Paragraph || type==Block)
     printf("Requested width from Paragraph!\n");
   if (memwidth==NULL)
     memwidth=p2newfloat(furthest(ori()));
   return *memwidth;
 }
Example #4
0
 float height() {
   if (type==Paragraph || type==Block)
     printf("Requested height from Paragraph!\n");
   if (memheight==NULL) {
     memheight=p2newfloat(furthest(ori().perp()));
   }
   return *memheight;
 }
Example #5
0
// returns (a, (b,c)), three points which define the narrowest diameter of the hull as the pair of
// lines going through b,c, and through a, parallel to b,c TODO: This can be made linear time by
// moving point tc incrementally from the previous value (it can only move in one direction).  It
// is currently n*O(furthest)
double ConvexHull::narrowest_diameter(Point &a, Point &b, Point &c) {
    Point tb = boundary.back();
    double d = INFINITY;
    for(unsigned i = 0; i < boundary.size(); i++) {
        Point tc = boundary[i];
        Point n = -rot90(tb-tc);
        Point ta = *furthest(n);
        double td = dot(n, ta-tb)/dot(n,n);
        if(td < d) {
            a = ta;
            b = tb;
            c = tc;
            d = td;
        }
        tb = tc;
    }
    return d;
}