Beispiel #1
0
float offness(Polygon2d p) {
      Region r=Region(p,oi->width,oi->height);
      r.makelist();
      V2d v=V2d(0,0);
      int cnt=0;
      for (int i=1;i<=r.list->len;i++) {
        int x=r.list->num(i).x;
        int y=r.list->num(i).y;
        if (angs->inmap(x,y)) {
          v=v+mag->pos[x][y]*V2d::rotate(V2d(1,0),angs->pos[x][y]);
          cnt++;
        }
      }
      float offness=v.mod()/(float)cnt;
      printf("Quad has offness %f count %i area %f\n",offness,cnt,p.area());
      return offness;
}
Beispiel #2
0
float areaofpoly(Polygon2d p) {
  return p.area();
}
Beispiel #3
0
  float Polygon2d::area(Polygon2d p) {
   return p.area();
 }